konsumer / raylib-wasm

Ideas around a wasm runtime for raylib (to make raylib games in js & browser)
https://konsumer.js.org/raylib-wasm/
MIT License
22 stars 3 forks source link

Build under Windows #6

Closed Filyus closed 2 months ago

Filyus commented 2 months ago

This works for me with Windows 10 in package.json:

"build:wasm:windows": "docker run -it --rm -v %cd%:/src -v /tmp/emscripten-cache:/emsdk/upstream/emscripten/cache/ emscripten/emsdk ./tools/build.sh",

To install Docker, Windows 10 must be updated, for example, via this link.

Also, ./tools/build.sh must be LF-encoded.

konsumer commented 2 months ago

I don't use windows, so i can't really verify quickly, but under docker, it should act just like Linux (no special encoding for script, etc.)

Later tonight, I can spin up an emulator, and try to verify that some specific setup is needed, but it should not need that.

The idea with the repo is not to have special builds for each OS, like users can just grab the prebuilt wasm, or use docker to build their own, and it should normalize the environment for everyone. On my own system (mac) I don't even build it outside of docker, since emscripten often requires specific versions of everything to work right, and I don't really want to try to manage all the possible tooling differences for every user's OS, etc.

Filyus commented 2 months ago

For Windows I use the same Docker options except that there no user specified (no -u $(id -u):$(id -g)) and %cd% is used instead of $(pwd) to get the current directory.

konsumer commented 2 months ago

Feel free to run that windows-specific command, on your own machine, if you really need to build it on windows. As I said, the idea with this repo is not to make special settings for every user's environment, they should just use docker, on a regular POSIX host, and keep it all the same.

You can get $(pwd) for example, by running WSL. I disagree with -u $(id -u):$(id -g)) part (I think it's fine they are owned by root, run sudo chown $(whoami) whatever to give ownership.) Since it's all in docker, you can feel free to run it however makes sense for you, but it's not something I want in the repo. I am simply not interested in supporting every possible combination of host-environments & tools, especially considering windows is the weird one here, and other OS's support all this fine.

The npm run tasks are just for development, primarily for me, which is done on mac & linux. If you don't want to use Linux or WSL, then feel free to write your own batch files that do it however you want.

If you are not developing featured for raylib-wasm, then I would recommend just downloading the wasm file. There is no reason to build it yourself.

konsumer commented 2 months ago

I'm going to close this as wontfix since it's not a part of the goals of this project.

konsumer commented 2 months ago

I locked in versions for raygui and raylib, and also included the built-files in repo (so people who just want to work on web stuff don't need all the build things.) This should sort of address the issue I think you were originally having. If you want to build it yourself on windows, use WSL, but the built version should work fine.