feat(build): add cross-platform support and validation#66
Open
davehorner wants to merge 1 commit intotsoding:mainfrom
Open
feat(build): add cross-platform support and validation#66davehorner wants to merge 1 commit intotsoding:mainfrom
davehorner wants to merge 1 commit intotsoding:mainfrom
Conversation
- docs(readme): switch to `npm run build` instead of `node run build` - build: use `npx` for tsc, detect platform for math-lib flags and wasm compiler - build: introduce `getMathLibFlag()`, `getWasmCompiler()` and `getPackerOutput()` - build: validate existence of `build/pack.h`, throwing a clear error if missing - build: update clang invocations for WASM to include correct include paths and output filenames I believe we are down to c3 issues; too much for my recreational session today. - construct `PingMessage` via struct initializer and call `platform::send_message(&ping_msg)` - change `other_players` to `var other_players: HashMap(uint, Player)` - streamline `os::native_fwrite_fn` lambda signature Here’s a summary of what we did to get your build working: 1. **Cross-Platform Build Fixes:** - Updated your build.js to use `npx` for TypeScript compilation in a way that works on both Windows and Unix. - Patched the script so that the C packer binary is named `packer.exe` on Windows and `packer` elsewhere, and all references use the correct name. 2. **Math Library Linking:** - Fixed the build script to only add the `-lm` flag (math library) on non-Windows platforms, preventing linker errors on Windows. 3. **Wasm Compilation on Windows:** - Switched the wasm build commands to use `emcc` (Emscripten) on Windows, since standard clang does not support `wasm32` out of the box. 4. **Build Order and File Generation:** - Ensured that pack.h is generated by running the packer before any compilation steps that require it. - Added a check to throw a clear error if pack.h is not generated. 5. **C3 Source Code Fixes:** - Fixed struct literal usage by assigning to a temporary variable before taking its address. - Removed or corrected invalid type aliasing for generics in C3. - Corrected function literal syntax for C3. - Cleaned up other C3 syntax issues as reported by the compiler. I used the following: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression1 scoop install c3 you need to install and do a emsdk_env before building. https://emscripten.org/docs/getting_started/downloads.html I installed via choco; I'm not sure I suggest it. we're closer to a working build for windows.
Author
|
last_build_attempt_250610.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
npm run buildinstead ofnode run buildnpxfor tsc, detect platform for math-lib flags and wasm compilergetMathLibFlag(),getWasmCompiler()andgetPackerOutput()build/pack.h, throwing a clear error if missingI believe we are down to c3 issues; too much for my recreational session today.
PingMessagevia struct initializer and callplatform::send_message(&ping_msg)other_playerstovar other_players: HashMap(uint, Player)os::native_fwrite_fnlambda signatureHere’s a summary of what we did to get your build working:
Cross-Platform Build Fixes:
npxfor TypeScript compilation in a way that works on both Windows and Unix.packer.exeon Windows andpackerelsewhere, and all references use the correct name.Math Library Linking:
-lmflag (math library) on non-Windows platforms, preventing linker errors on Windows.Wasm Compilation on Windows:
emcc(Emscripten) on Windows, since standard clang does not supportwasm32out of the box.Build Order and File Generation:
C3 Source Code Fixes:
I used the following:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression1
scoop install c3
you need to install and do a emsdk_env before building. https://emscripten.org/docs/getting_started/downloads.html I installed via choco; I'm not sure I suggest it.
we're closer to a working build for windows.