mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-12-28 18:41:14 +00:00
ci: Use improved build scripts
This commit is contained in:
parent
c716e75ba3
commit
b0f8efb90d
5 changed files with 164 additions and 108 deletions
|
@ -12,7 +12,7 @@ image:
|
|||
|
||||
environment:
|
||||
CMAKE_SYSTEM_VERSION: 10.0.17134.0
|
||||
PACKAGE_PREFIX: amd-encoder-for-obs-studio
|
||||
PACKAGE_PREFIX: obs-stream-effects
|
||||
INNOSETUP_URL: http://www.jrsoftware.org/download.php/is.exe
|
||||
CURL_VERSION: 7.39.0
|
||||
|
||||
|
@ -39,7 +39,7 @@ install:
|
|||
- cmd: ci/appveyor-install.bat
|
||||
|
||||
build_script:
|
||||
- cmd: node ci/appveyor-build.js
|
||||
- cmd: node ci/builder.js
|
||||
|
||||
after_build:
|
||||
- cmd: ci/appveyor-package.bat
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
const cp = require('child_process');
|
||||
|
||||
var config32 = cp.spawn(
|
||||
"cmake", [
|
||||
'-H.',
|
||||
'-B"build/32"',
|
||||
'-G"Visual Studio 15 2017"',
|
||||
'-DCMAKE_INSTALL_PREFIX="build/distrib"',
|
||||
'-DCMAKE_PACKAGE_PREFIX="build"',
|
||||
'-DCMAKE_PACKAGE_NAME="obs-stream-effects"'
|
||||
], {
|
||||
windowsVerbatimArguments: true,
|
||||
windowsHide: true
|
||||
}
|
||||
);
|
||||
config32.stdout.on('data', (data) => {
|
||||
process.stdout.write(`[32:Out] ${data}`);
|
||||
});
|
||||
config32.stderr.on('data', (data) => {
|
||||
console.log(`[32:Err] ${data}`);
|
||||
});
|
||||
config32.on('exit', (code, signal) => {
|
||||
if (code != 0) {
|
||||
process.exit(code)
|
||||
}
|
||||
var build32 = cp.spawn(
|
||||
"cmake", [
|
||||
'--build build/32',
|
||||
'--target INSTALL',
|
||||
'--config RelWithDebInfo',
|
||||
'--',
|
||||
'/logger:"C:\\Program Files\\AppVeyor\\BuildAgent\\Appveyor.MSBuildLogger.dll"'
|
||||
], {
|
||||
windowsVerbatimArguments: true,
|
||||
windowsHide: true
|
||||
}
|
||||
);
|
||||
build32.stdout.on('data', (data) => {
|
||||
process.stdout.write(`[32:Out] ${data}`);
|
||||
});
|
||||
build32.stderr.on('data', (data) => {
|
||||
process.stderr.write(`[32:Err] ${data}`);
|
||||
});
|
||||
build32.on('exit', (code, signal) => {
|
||||
if (code != 0) {
|
||||
process.exit(code)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var config64 = cp.spawn(
|
||||
"cmake", [
|
||||
'-H.',
|
||||
'-B"build/64"',
|
||||
'-G"Visual Studio 15 2017 Win64"',
|
||||
'-DCMAKE_INSTALL_PREFIX="build/distrib"',
|
||||
'-DCMAKE_PACKAGE_PREFIX="build"',
|
||||
'-DCMAKE_PACKAGE_NAME="obs-stream-effects"'
|
||||
], {
|
||||
windowsVerbatimArguments: true,
|
||||
windowsHide: true
|
||||
}
|
||||
);
|
||||
config64.stdout.on('data', (data) => {
|
||||
process.stdout.write(`[64:Out] ${data}`);
|
||||
});
|
||||
config64.stderr.on('data', (data) => {
|
||||
console.log(`[64:Err] ${data}`);
|
||||
});
|
||||
config64.on('exit', (code, signal) => {
|
||||
if (code != 0) {
|
||||
process.exit(code)
|
||||
}
|
||||
var build64 = cp.spawn(
|
||||
"cmake", [
|
||||
'--build build/64',
|
||||
'--target INSTALL',
|
||||
'--config RelWithDebInfo',
|
||||
'--',
|
||||
'/logger:"C:\\Program Files\\AppVeyor\\BuildAgent\\Appveyor.MSBuildLogger.dll"'
|
||||
], {
|
||||
windowsVerbatimArguments: true,
|
||||
windowsHide: true
|
||||
}
|
||||
);
|
||||
build64.stdout.on('data', (data) => {
|
||||
process.stdout.write(`[32:Out] ${data}`);
|
||||
});
|
||||
build64.stderr.on('data', (data) => {
|
||||
process.stderr.write(`[32:Err] ${data}`);
|
||||
});
|
||||
build64.on('exit', (code, signal) => {
|
||||
if (code != 0) {
|
||||
process.exit(code)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -1,9 +1,3 @@
|
|||
@ECHO OFF
|
||||
IF "%APPVEYOR_REPO_TAG%"=="true" (
|
||||
ECHO -- Building 7z Archive --
|
||||
cmake --build build/64 --target PACKAGE_7Z --config RelWithDebInfo
|
||||
ECHO -- Building Zip Archive --
|
||||
cmake --build build/64 --target PACKAGE_ZIP --config RelWithDebInfo
|
||||
ECHO -- Building Installer --
|
||||
"C:\Program Files (x86)\Inno Setup 5\ISCC.exe" /Qp ".\build\64\installer.iss" > nul
|
||||
)
|
||||
ECHO -- Building Installer --
|
||||
"C:\Program Files (x86)\Inno Setup 5\ISCC.exe" /Qp ".\build\64\installer.iss" > nul
|
||||
|
|
109
ci/builder.js
Normal file
109
ci/builder.js
Normal file
|
@ -0,0 +1,109 @@
|
|||
"use strict";
|
||||
|
||||
const process = require('process');
|
||||
const runner = require('./runner.js');
|
||||
|
||||
// Steps
|
||||
let configure_runners = [];
|
||||
let build_runners = [];
|
||||
let package_runners = [];
|
||||
|
||||
{
|
||||
let cmake_configure_extra = [
|
||||
`-DCMAKE_SYSTEM_VERSION=${process.env.CMAKE_SYSTEM_VERSION}`,
|
||||
'-DCMAKE_INSTALL_PREFIX="build/distrib/"',
|
||||
'-DCMAKE_PACKAGE_PREFIX="build/"',
|
||||
`-DCMAKE_PACKAGE_NAME="${process.env.PACKAGE_PREFIX}"`,
|
||||
];
|
||||
let cmake_build_extra = [
|
||||
];
|
||||
|
||||
// Configuration depends on platform
|
||||
if (process.platform == "win32" || process.platform == "win64") {
|
||||
configure_runners.push(new runner('32-bit', 'cmake', [
|
||||
'-H.',
|
||||
'-Bbuild/32',
|
||||
`-G"Visual Studio 15 2017"`,
|
||||
].concat(cmake_configure_extra)));
|
||||
configure_runners.push(new runner('64-bit', 'cmake', [
|
||||
'-H.',
|
||||
'-Bbuild/64',
|
||||
`-G"Visual Studio 15 2017 Win64"`,
|
||||
'-T"host=x64"',
|
||||
].concat(cmake_configure_extra)));
|
||||
|
||||
// Extra build steps for AppVeyor on Windows for Logging purposes.
|
||||
if(process.env.APPVEYOR) {
|
||||
cmake_build_extra.concat(['--', '/logger:"C:\\Program Files\\AppVeyor\\BuildAgent\\Appveyor.MSBuildLogger.dll"']);
|
||||
}
|
||||
} else if (process.platform == "linux") {
|
||||
configure_runners.push(new runner('32-bit', 'cmake', [
|
||||
'-H.',
|
||||
'-Bbuild32',
|
||||
`-G"Unix Makefiles"`,
|
||||
`-DCOPIED_DEPENDENCIES=false`,
|
||||
].concat(cmake_configure_extra),
|
||||
{ ...process.env, ...{
|
||||
CFLAGS: `${process.env.COMPILER_FLAGS_32}`,
|
||||
CXXFLAGS: `${process.env.COMPILER_FLAGS_32}`,
|
||||
}}));
|
||||
configure_runners.push(new runner('64-bit', 'cmake', [
|
||||
'-H.',
|
||||
'-Bbuild64',
|
||||
`-G"Unix Makefiles"`,
|
||||
`-DCOPIED_DEPENDENCIES=false`,
|
||||
].concat(cmake_configure_extra),
|
||||
{ ...process.env, ...{
|
||||
CFLAGS: `${process.env.COMPILER_FLAGS_64}`,
|
||||
CXXFLAGS: `${process.env.COMPILER_FLAGS_64}`,
|
||||
}}));
|
||||
}
|
||||
|
||||
build_runners.push(new runner('32-bit', 'cmake', [
|
||||
'--build', 'build/32',
|
||||
'--config', 'RelWithDebInfo',
|
||||
'--target', 'INSTALL'
|
||||
].concat(cmake_build_extra)));
|
||||
build_runners.push(new runner('64-bit', 'cmake', [
|
||||
'--build', 'build/64',
|
||||
'--config', 'RelWithDebInfo',
|
||||
'--target', 'INSTALL'
|
||||
].concat(cmake_build_extra)));
|
||||
package_runners.push(new runner('64-bit', 'cmake', [
|
||||
'--build', 'build/64',
|
||||
'--target', 'PACKAGE_7Z',
|
||||
'--config', 'RelWithDebInfo'
|
||||
].concat(cmake_build_extra)));
|
||||
package_runners.push(new runner('64-bit', 'cmake', [
|
||||
'--build', 'build/64',
|
||||
'--target', 'PACKAGE_ZIP',
|
||||
'--config', 'RelWithDebInfo'
|
||||
].concat(cmake_build_extra)));
|
||||
}
|
||||
|
||||
// Run Configure steps.
|
||||
let configure_promises = [];
|
||||
for (let config of configure_runners) {
|
||||
configure_promises.push(config.run());
|
||||
}
|
||||
Promise.all(configure_promises).then(function(result) {
|
||||
let build_promises = [];
|
||||
for (let build of build_runners) {
|
||||
build_promises.push(build.run());
|
||||
}
|
||||
Promise.all(build_promises).then(function(result) {
|
||||
let package_promises = [];
|
||||
for (let pack of package_runners) {
|
||||
package_promises.push(pack.run());
|
||||
}
|
||||
Promise.all(package_promises).then(function(result) {
|
||||
process.exit(result);
|
||||
}).catch(function(result) {
|
||||
process.exit(result);
|
||||
});
|
||||
}).catch(function(result) {
|
||||
process.exit(result);
|
||||
});
|
||||
}).catch(function(result) {
|
||||
process.exit(result);
|
||||
});
|
51
ci/runner.js
Normal file
51
ci/runner.js
Normal file
|
@ -0,0 +1,51 @@
|
|||
"use strict";
|
||||
|
||||
const process = require('process');
|
||||
const cp = require('child_process');
|
||||
|
||||
class Runner {
|
||||
constructor(name, cmd, args, env) {
|
||||
this.name = name;
|
||||
this.cmd = cmd;
|
||||
if (args == undefined)
|
||||
args = [];
|
||||
this.args = args;
|
||||
if (env == undefined)
|
||||
env = process.env;
|
||||
this.env = env;
|
||||
}
|
||||
|
||||
run() {
|
||||
let self = this;
|
||||
return new Promise(function(resolve, reject) {
|
||||
console.log(self.cmd, self.args);
|
||||
self.proc = cp.spawn(
|
||||
self.cmd, self.args, {
|
||||
windowsVerbatimArguments: true,
|
||||
windowsHide: true,
|
||||
env: self.env,
|
||||
}
|
||||
);
|
||||
self.proc.stdout.on('data', (data) => {
|
||||
process.stdout.write(`[${self.name}:Out] ${data}`);
|
||||
});
|
||||
self.proc.stderr.on('data', (data) => {
|
||||
process.stderr.write(`[${self.name}:Err] ${data}`);
|
||||
});
|
||||
self.proc.on('exit', (code, signal) => {
|
||||
if (code != 0) {
|
||||
reject(code);
|
||||
return;
|
||||
}
|
||||
resolve(code);
|
||||
return;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
execute() {
|
||||
return this.run();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Runner;
|
Loading…
Reference in a new issue