Skip to content

Commit

Permalink
Add prebuildify step for mac
Browse files Browse the repository at this point in the history
  • Loading branch information
LandryNorris committed Jul 7, 2023
1 parent 9bbaf21 commit 8f9ab75
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions packages/rhsplib/scripts/build-RHSPlib.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,28 @@ await runCmakeWithArgs(["--build", ".", ...buildOptions]);

console.log("\nSuccessfully built RHSPlib");

if(platform() === "darwin") {
await prebuildify(["--napi", "--platform=darwin", "--arch=x64"], buildPath);
}

async function prebuildify(args, cwd) {
const prebuildify = spawn(`prebuildify`, args);
prebuildify.stderr.pipe(process.stderr);
prebuildify.stdout.pipe(process.stdout);

console.log("darwin");
fs.readdirSync(buildPath).forEach(file => {
console.log(file);
});
console.log();
await new Promise((resolve, reject) => {
prebuildify.on("error", (e) => reject(e));
prebuildify.on("exit", (code, signal) => {
if (signal != null) {
reject(new Error(`CMake execution was terminated by signal ${signal}`));
} else if (code === 0) {
resolve();
} else {
reject(`CMake exited with code ${code}`);
}
});
});
}

async function runCmakeWithArgs(args) {
const cmake = spawn("cmake", args, {
Expand Down

0 comments on commit 8f9ab75

Please sign in to comment.