Files
LiveSplitOne/buildCore.js
T
Christopher Serr df51936aea Update livesplit-core (#716)
This updates `livesplit-core` to the latest version. This mostly adds
custom variable columns and allows for the timer to visualize the delta
for the background. There's some performance improvements as well.

Also we now build `livesplit-core` in debug mode by default when
building locally. So compilation is a little bit
faster and additional debug checks are active, such as integer
overflows.
2022-09-28 20:27:36 +02:00

41 lines
1.0 KiB
JavaScript

const { execSync } = require("child_process");
const fs = require("fs");
let buildFlags = "";
let targetFolder = "debug";
if (process.argv.some((v) => v === "--production")) {
buildFlags = "--release";
targetFolder = "release";
}
execSync(
"cargo run",
{
cwd: "livesplit-core/capi/bind_gen",
stdio: "inherit",
},
);
execSync(
`cargo rustc -p livesplit-core-capi --crate-type cdylib --features wasm-web --target wasm32-unknown-unknown ${buildFlags}`,
{
cwd: "livesplit-core",
stdio: "inherit",
env: {
...process.env,
'RUSTFLAGS': '-C target-feature=+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext',
},
},
);
execSync(
`wasm-bindgen livesplit-core/target/wasm32-unknown-unknown/${targetFolder}/livesplit_core.wasm --out-dir src/livesplit-core`,
{
stdio: "inherit",
},
);
fs
.createReadStream("livesplit-core/capi/bindings/wasm_bindgen/index.ts")
.pipe(fs.createWriteStream("src/livesplit-core/index.ts"));