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 = {
|
||||
name: 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.
|
||||
*/
|
||||
export interface GeneralVariable {
|
||||
CMAKE_BUILD_TYPE?: "Debug" | "Release" | "RelWithDebInfo" | "MinSizeRel"
|
||||
CMAKE_BUILD_TYPE?: "Debug" | "Release" | "RelWithDebInfo" | "MinSizeRel";
|
||||
BUILD_SHARED_LIBS?: boolean,
|
||||
CMAKE_INSTALL_PREFIX?: string,
|
||||
CMAKE_SYSROOT?: string,
|
||||
@@ -28,20 +28,20 @@ export interface GeneralVariable {
|
||||
* CMake variables suitable for LLVM project.
|
||||
*/
|
||||
export interface LLVMVariable {
|
||||
LLVM_TARGETS_TO_BUILD?: string[]
|
||||
LLVM_TARGETS_TO_BUILD?: string[];
|
||||
LLVM_ENABLE_CLASSIC_FLANG?: boolean,
|
||||
LLVM_ENABLE_PROJECTS?: ("clang" | "openmp" | "lld" | "clang-tools-extra")[]
|
||||
LIBOMP_ARCH?: "Sw64"
|
||||
LIBOMP_USE_ITT_NOTIFY?: boolean
|
||||
LIBOMP_ENABLE_SHARED?: boolean
|
||||
OPENMP_ENABLE_LIBOMPTARGET?: boolean
|
||||
LLVM_ENABLE_PROJECTS?: ("clang" | "openmp" | "lld" | "clang-tools-extra")[];
|
||||
LIBOMP_ARCH?: "Sw64";
|
||||
LIBOMP_USE_ITT_NOTIFY?: boolean;
|
||||
LIBOMP_ENABLE_SHARED?: boolean;
|
||||
OPENMP_ENABLE_LIBOMPTARGET?: boolean;
|
||||
}
|
||||
|
||||
export interface CFlangCMakeVariable {
|
||||
FLANG_INCLUDE_DIRS?: boolean
|
||||
FLANG_LLVM_EXTENSIONS?: boolean
|
||||
WITH_WERROR?: boolean
|
||||
LLVM_CONFIG?: string
|
||||
FLANG_INCLUDE_DIRS?: boolean;
|
||||
FLANG_LLVM_EXTENSIONS?: boolean;
|
||||
WITH_WERROR?: boolean;
|
||||
LLVM_CONFIG?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,22 +57,22 @@ export function variable(object: Object): CMakeDefinition[] {
|
||||
name: k,
|
||||
value: v ? "ON" : "OFF",
|
||||
type: "BOOL"
|
||||
}
|
||||
};
|
||||
} else if (typeof v === "object" && Array.isArray(v)) {
|
||||
return {
|
||||
name: k,
|
||||
value: v.join(";"),
|
||||
type: "STRING"
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
name: k,
|
||||
value: v,
|
||||
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
|
||||
*/
|
||||
export interface CMakeGenerateOptions {
|
||||
pathToBuild?: string
|
||||
pathToSource?: string
|
||||
pathToBuild?: string;
|
||||
pathToSource?: string;
|
||||
|
||||
/**
|
||||
* 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,
|
||||
* not a cache-format file.
|
||||
*/
|
||||
preloadCache?: string
|
||||
preloadCache?: string;
|
||||
|
||||
|
||||
definitions?: CMakeDefinition[]
|
||||
definitions?: CMakeDefinition[];
|
||||
|
||||
/**
|
||||
* Specify a build system generator.
|
||||
@@ -106,7 +106,7 @@ export interface CMakeGenerateOptions {
|
||||
* 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.
|
||||
*/
|
||||
generator?: "Unix Makefiles" | "Ninja"
|
||||
generator?: "Unix Makefiles" | "Ninja";
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
toolchain?: string
|
||||
toolchain?: string;
|
||||
}
|
||||
|
||||
export function command(o: CMakeGenerateOptions): string[] {
|
||||
@@ -127,5 +127,6 @@ export function command(o: CMakeGenerateOptions): string[] {
|
||||
])),
|
||||
...optFlag("-B", o.pathToBuild),
|
||||
...optFlag("-S", o.pathToSource),
|
||||
]
|
||||
...optFlag('-C', o.preloadCache),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user