build/llvmPackages: add --msimd-math to set -msimd option while compiling libpgmath
This commit is contained in:
@@ -21,6 +21,11 @@ const args = await yargs(hideBin(process.argv))
|
|||||||
describe: "Install prefix",
|
describe: "Install prefix",
|
||||||
type: "string",
|
type: "string",
|
||||||
})
|
})
|
||||||
|
.option("msimd-math", {
|
||||||
|
describe: "Add -msimd for libpgmath",
|
||||||
|
type: "boolean",
|
||||||
|
demandOption: true,
|
||||||
|
})
|
||||||
.help()
|
.help()
|
||||||
.parse();
|
.parse();
|
||||||
|
|
||||||
@@ -38,7 +43,8 @@ const packages = llvmPackages({
|
|||||||
platform: {
|
platform: {
|
||||||
buildPlatform: { arch: arch() },
|
buildPlatform: { arch: arch() },
|
||||||
hostPlatform: { arch: arch() },
|
hostPlatform: { arch: arch() },
|
||||||
}
|
},
|
||||||
|
enableLibpgmathSIMD: args['msimd-math']
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const pkg of packages) {
|
for (const pkg of packages) {
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ export interface LLVMPackageOptions {
|
|||||||
buildDir: (packageName: 'llvm' | 'libpgmath' | 'cflang') => string,
|
buildDir: (packageName: 'llvm' | 'libpgmath' | 'cflang') => string,
|
||||||
|
|
||||||
platform: PackagePlatform;
|
platform: PackagePlatform;
|
||||||
|
|
||||||
|
enableLibpgmathSIMD: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function llvmPackages({
|
export function llvmPackages({
|
||||||
@@ -68,6 +70,7 @@ export function llvmPackages({
|
|||||||
buildDir,
|
buildDir,
|
||||||
cmakeDefinitionOverrides,
|
cmakeDefinitionOverrides,
|
||||||
spawnOverrides,
|
spawnOverrides,
|
||||||
|
enableLibpgmathSIMD = false,
|
||||||
}: LLVMPackageOptions & LLVMPackageOverrides): PackageTask[] {
|
}: LLVMPackageOptions & LLVMPackageOverrides): PackageTask[] {
|
||||||
const rm = "rm";
|
const rm = "rm";
|
||||||
const cmake = "cmake";
|
const cmake = "cmake";
|
||||||
@@ -135,13 +138,19 @@ export function llvmPackages({
|
|||||||
configurePhase: async () => {
|
configurePhase: async () => {
|
||||||
await promisifySpawn(spawn(rm, ["-rf", build], spawnOptions));
|
await promisifySpawn(spawn(rm, ["-rf", build], spawnOptions));
|
||||||
|
|
||||||
|
// Flags shared between C and C++ compiler.
|
||||||
|
const cxFlags = ["-mlong-double-64"];
|
||||||
|
if (enableLibpgmathSIMD) {
|
||||||
|
cxFlags.push("-msimd");
|
||||||
|
}
|
||||||
|
|
||||||
// Configure libpgmath.
|
// Configure libpgmath.
|
||||||
await promisifySpawn(spawn(cmake, command({
|
await promisifySpawn(spawn(cmake, command({
|
||||||
definitions: variable({
|
definitions: variable({
|
||||||
...general,
|
...general,
|
||||||
...{
|
...{
|
||||||
CMAKE_C_FLAGS: "-mlong-double-64",
|
CMAKE_C_FLAGS: cxFlags.join(" "),
|
||||||
CMAKE_CXX_FLAGS: "-mlong-double-64",
|
CMAKE_CXX_FLAGS: cxFlags.join(" "),
|
||||||
CMAKE_C_COMPILER: path.join(installPrefix, "bin", "clang"),
|
CMAKE_C_COMPILER: path.join(installPrefix, "bin", "clang"),
|
||||||
CMAKE_CXX_COMPILER: path.join(installPrefix, "bin", "clang++"),
|
CMAKE_CXX_COMPILER: path.join(installPrefix, "bin", "clang++"),
|
||||||
} as GeneralVariable,
|
} as GeneralVariable,
|
||||||
|
|||||||
Reference in New Issue
Block a user