Skip to content

Commit

Permalink
Fix WASM build on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jwbonner committed Oct 5, 2024
1 parent 874944a commit 13ab648
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"format": "prettier --write .",
"check-format": "prettier --check .",
"test-ytdl": "node testYtdl.mjs",
"wasm:compile": "emcc src/hub/dataSources/wpilog/indexer/wpilogIndexer.c -o bundles/hub\\$wpilogIndexer.js -sEXPORTED_FUNCTIONS=_run,_malloc -sALLOW_MEMORY_GROWTH -O3",
"wasm:compile": "node wasmCompile.mjs",
"docs:start": "cd docsSite && npm run start && cd ..",
"docs:build": "cd docsSite && npm run build && cd ..",
"docs:build-embed": "cd docsSite && npm run build-embed && cd ..",
Expand Down
13 changes: 13 additions & 0 deletions wasmCompile.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { exec } from "child_process";

await new Promise((resolve) => {
let inPath, outPath;
if (process.platform === "win32") {
inPath = "src\\hub\\dataSources\\wpilog\\indexer\\wpilogIndexer.c";
outPath = "bundles\\hub$wpilogIndexer.js";
} else {
inPath = "'src/hub/dataSources/wpilog/indexer/wpilogIndexer.c'";
outPath = "'bundles/hub$wpilogIndexer.js' ";
}
exec(`emcc ${inPath} -o ${outPath} -sEXPORTED_FUNCTIONS=_run,_malloc -sALLOW_MEMORY_GROWTH -O3`, resolve);
});

0 comments on commit 13ab648

Please sign in to comment.