commands/cmake: format file, add preloadCache option
This commit is contained in:
@@ -1,18 +1,18 @@
|
|||||||
import { optFlag, undefList } from "./common"
|
import { optFlag, undefList } from "./common";
|
||||||
|
|
||||||
export type CMakeDefinition = {
|
export type CMakeDefinition = {
|
||||||
name: string,
|
name: string,
|
||||||
value: string,
|
value: string,
|
||||||
type?: CMakeVariableType
|
type?: CMakeVariableType;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type CMakeVariableType = "BOOL" | "FILEPATH" | "PATH" | "STRING" | "INTERNAL"
|
export type CMakeVariableType = "BOOL" | "FILEPATH" | "PATH" | "STRING" | "INTERNAL";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* General CMake variables.
|
* General CMake variables.
|
||||||
*/
|
*/
|
||||||
export interface GeneralVariable {
|
export interface GeneralVariable {
|
||||||
CMAKE_BUILD_TYPE?: "Debug" | "Release" | "RelWithDebInfo" | "MinSizeRel"
|
CMAKE_BUILD_TYPE?: "Debug" | "Release" | "RelWithDebInfo" | "MinSizeRel";
|
||||||
BUILD_SHARED_LIBS?: boolean,
|
BUILD_SHARED_LIBS?: boolean,
|
||||||
CMAKE_INSTALL_PREFIX?: string,
|
CMAKE_INSTALL_PREFIX?: string,
|
||||||
CMAKE_SYSROOT?: string,
|
CMAKE_SYSROOT?: string,
|
||||||
@@ -28,20 +28,20 @@ export interface GeneralVariable {
|
|||||||
* CMake variables suitable for LLVM project.
|
* CMake variables suitable for LLVM project.
|
||||||
*/
|
*/
|
||||||
export interface LLVMVariable {
|
export interface LLVMVariable {
|
||||||
LLVM_TARGETS_TO_BUILD?: string[]
|
LLVM_TARGETS_TO_BUILD?: string[];
|
||||||
LLVM_ENABLE_CLASSIC_FLANG?: boolean,
|
LLVM_ENABLE_CLASSIC_FLANG?: boolean,
|
||||||
LLVM_ENABLE_PROJECTS?: ("clang" | "openmp" | "lld" | "clang-tools-extra")[]
|
LLVM_ENABLE_PROJECTS?: ("clang" | "openmp" | "lld" | "clang-tools-extra")[];
|
||||||
LIBOMP_ARCH?: "Sw64"
|
LIBOMP_ARCH?: "Sw64";
|
||||||
LIBOMP_USE_ITT_NOTIFY?: boolean
|
LIBOMP_USE_ITT_NOTIFY?: boolean;
|
||||||
LIBOMP_ENABLE_SHARED?: boolean
|
LIBOMP_ENABLE_SHARED?: boolean;
|
||||||
OPENMP_ENABLE_LIBOMPTARGET?: boolean
|
OPENMP_ENABLE_LIBOMPTARGET?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CFlangCMakeVariable {
|
export interface CFlangCMakeVariable {
|
||||||
FLANG_INCLUDE_DIRS?: boolean
|
FLANG_INCLUDE_DIRS?: boolean;
|
||||||
FLANG_LLVM_EXTENSIONS?: boolean
|
FLANG_LLVM_EXTENSIONS?: boolean;
|
||||||
WITH_WERROR?: boolean
|
WITH_WERROR?: boolean;
|
||||||
LLVM_CONFIG?: string
|
LLVM_CONFIG?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,22 +57,22 @@ export function variable(object: Object): CMakeDefinition[] {
|
|||||||
name: k,
|
name: k,
|
||||||
value: v ? "ON" : "OFF",
|
value: v ? "ON" : "OFF",
|
||||||
type: "BOOL"
|
type: "BOOL"
|
||||||
}
|
};
|
||||||
} else if (typeof v === "object" && Array.isArray(v)) {
|
} else if (typeof v === "object" && Array.isArray(v)) {
|
||||||
return {
|
return {
|
||||||
name: k,
|
name: k,
|
||||||
value: v.join(";"),
|
value: v.join(";"),
|
||||||
type: "STRING"
|
type: "STRING"
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
name: k,
|
name: k,
|
||||||
value: v,
|
value: v,
|
||||||
type: "STRING"
|
type: "STRING"
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -81,8 +81,8 @@ export function variable(object: Object): CMakeDefinition[] {
|
|||||||
* @see https://cmake.org/cmake/help/latest/manual/cmake.1.html#generate-a-project-buildsystem
|
* @see https://cmake.org/cmake/help/latest/manual/cmake.1.html#generate-a-project-buildsystem
|
||||||
*/
|
*/
|
||||||
export interface CMakeGenerateOptions {
|
export interface CMakeGenerateOptions {
|
||||||
pathToBuild?: string
|
pathToBuild?: string;
|
||||||
pathToSource?: string
|
pathToSource?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pre-load a script to populate the cache.
|
* Pre-load a script to populate the cache.
|
||||||
@@ -94,10 +94,10 @@ export interface CMakeGenerateOptions {
|
|||||||
* The given file should be a CMake script containing set() commands that use the CACHE option,
|
* The given file should be a CMake script containing set() commands that use the CACHE option,
|
||||||
* not a cache-format file.
|
* not a cache-format file.
|
||||||
*/
|
*/
|
||||||
preloadCache?: string
|
preloadCache?: string;
|
||||||
|
|
||||||
|
|
||||||
definitions?: CMakeDefinition[]
|
definitions?: CMakeDefinition[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify a build system generator.
|
* Specify a build system generator.
|
||||||
@@ -106,7 +106,7 @@ export interface CMakeGenerateOptions {
|
|||||||
* A generator is responsible for generating a particular build system.
|
* A generator is responsible for generating a particular build system.
|
||||||
* Possible generator names are specified in the [cmake-generators(7)](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#manual:cmake-generators(7)) manual.
|
* Possible generator names are specified in the [cmake-generators(7)](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#manual:cmake-generators(7)) manual.
|
||||||
*/
|
*/
|
||||||
generator?: "Unix Makefiles" | "Ninja"
|
generator?: "Unix Makefiles" | "Ninja";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the cross compiling toolchain file, equivalent to setting CMAKE_TOOLCHAIN_FILE variable.
|
* Specify the cross compiling toolchain file, equivalent to setting CMAKE_TOOLCHAIN_FILE variable.
|
||||||
@@ -115,7 +115,7 @@ export interface CMakeGenerateOptions {
|
|||||||
*
|
*
|
||||||
* New in version 3.21.
|
* New in version 3.21.
|
||||||
*/
|
*/
|
||||||
toolchain?: string
|
toolchain?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function command(o: CMakeGenerateOptions): string[] {
|
export function command(o: CMakeGenerateOptions): string[] {
|
||||||
@@ -127,5 +127,6 @@ export function command(o: CMakeGenerateOptions): string[] {
|
|||||||
])),
|
])),
|
||||||
...optFlag("-B", o.pathToBuild),
|
...optFlag("-B", o.pathToBuild),
|
||||||
...optFlag("-S", o.pathToSource),
|
...optFlag("-S", o.pathToSource),
|
||||||
]
|
...optFlag('-C', o.preloadCache),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user