2019-07-27 19:12:49 +00:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const process = require('process');
|
|
|
|
const runner = require('./runner.js');
|
2019-09-03 19:18:14 +00:00
|
|
|
let env = process.env;
|
2019-07-27 19:12:49 +00:00
|
|
|
|
2019-09-03 19:18:14 +00:00
|
|
|
let x32_steps = [];
|
|
|
|
let x64_steps = [];
|
2019-07-27 19:12:49 +00:00
|
|
|
|
2019-09-03 19:18:14 +00:00
|
|
|
if ((process.platform == "win32") || (process.platform == "win64")) {
|
|
|
|
// Windows
|
|
|
|
let extra_conf = [
|
2019-07-27 19:12:49 +00:00
|
|
|
`-DCMAKE_SYSTEM_VERSION=${process.env.CMAKE_SYSTEM_VERSION}`,
|
2019-12-22 05:26:28 +00:00
|
|
|
`-DCMAKE_PACKAGE_NAME=StreamFX`,
|
|
|
|
'-DCMAKE_INSTALL_PREFIX="build/distrib"',
|
|
|
|
'-DCMAKE_PACKAGE_PREFIX="build/package"',
|
2020-01-13 22:48:49 +00:00
|
|
|
'-DOBS_DOWNLOAD=true',
|
2019-07-27 19:12:49 +00:00
|
|
|
];
|
2019-09-03 19:18:14 +00:00
|
|
|
let extra_build = [
|
|
|
|
|
2019-07-27 19:12:49 +00:00
|
|
|
];
|
|
|
|
|
2019-09-03 19:18:14 +00:00
|
|
|
if(process.env.APPVEYOR) {
|
|
|
|
extra_build.concat(['--', '/logger:"C:\\Program Files\\AppVeyor\\BuildAgent\\Appveyor.MSBuildLogger.dll"']);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((process.env.CMAKE_GENERATOR_32 !== undefined) && (process.env.CMAKE_GENERATOR_32 !== "")) {
|
|
|
|
x32_steps.push(
|
|
|
|
[ 'cmake', [
|
2019-12-18 05:46:03 +00:00
|
|
|
'-H.', '-Bbuild/32',
|
|
|
|
`-G"${process.env.CMAKE_GENERATOR_32}"`, '-AWin32', '-T"host=x64"',
|
2019-09-03 19:18:14 +00:00
|
|
|
].concat(extra_conf), env ]
|
|
|
|
);
|
|
|
|
x32_steps.push(
|
|
|
|
[ 'cmake', [
|
|
|
|
'--build', 'build/32',
|
|
|
|
'--config', 'RelWithDebInfo',
|
|
|
|
'--target', 'INSTALL'
|
|
|
|
].concat(extra_build), env ]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if ((process.env.CMAKE_GENERATOR_64 !== undefined) && (process.env.CMAKE_GENERATOR_64 !== "")) {
|
|
|
|
x64_steps.push(
|
|
|
|
[ 'cmake', [
|
2019-12-18 05:46:03 +00:00
|
|
|
'-H.', '-Bbuild/64',
|
|
|
|
`-G"${process.env.CMAKE_GENERATOR_64}"`, '-Ax64', '-T"host=x64"',
|
2019-09-03 19:18:14 +00:00
|
|
|
].concat(extra_conf), env ]
|
|
|
|
);
|
|
|
|
x64_steps.push(
|
|
|
|
[ 'cmake', [
|
|
|
|
'--build', 'build/64',
|
|
|
|
'--config', 'RelWithDebInfo',
|
|
|
|
'--target', 'INSTALL'
|
|
|
|
].concat(extra_build), env ]
|
|
|
|
);
|
2019-07-27 19:12:49 +00:00
|
|
|
}
|
2019-09-03 19:18:14 +00:00
|
|
|
} else {
|
|
|
|
// Unix
|
2019-07-27 19:12:49 +00:00
|
|
|
|
|
|
|
}
|
2019-09-03 19:18:14 +00:00
|
|
|
|
|
|
|
function runRunners(runnerArray, name) {
|
|
|
|
return new Promise(async (resolve, reject) => {
|
|
|
|
let local = runnerArray.reverse();
|
|
|
|
while (local.length > 0) {
|
|
|
|
try {
|
|
|
|
let task = local.pop();
|
|
|
|
let work = new runner(name, task[0], task[1], task[2]);
|
|
|
|
await work.run();
|
|
|
|
} catch (e) {
|
|
|
|
reject(e);
|
|
|
|
return;
|
|
|
|
}
|
2019-07-27 19:12:49 +00:00
|
|
|
}
|
2019-09-03 19:18:14 +00:00
|
|
|
resolve(0);
|
2019-07-27 19:12:49 +00:00
|
|
|
});
|
2019-09-03 19:18:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
let promises = [];
|
|
|
|
promises.push(runRunners(x32_steps, "32-Bit"));
|
|
|
|
promises.push(runRunners(x64_steps, "64-Bit"));
|
|
|
|
Promise.all(promises).then(
|
|
|
|
res => {
|
|
|
|
process.exit(0);
|
|
|
|
},
|
|
|
|
err => {
|
|
|
|
console.log(err);
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
).catch(err => {
|
|
|
|
console.log(err);
|
|
|
|
process.exit(1);
|
|
|
|
})
|