From 0d5ebaa7d9d40ed4553c4b2883d4250a5cc97e82 Mon Sep 17 00:00:00 2001 From: Xevion Date: Sun, 14 Apr 2024 02:30:19 -0500 Subject: [PATCH] Add README, improve build script help --- README.md | 19 +++++++++++++++++++ scripts/build.sh | 9 +++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..095a6e2 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# rust-sdl2-emscripten + +This is an experimental repository while testing a Rust + SDL2 project built with Emscripten. + +- [hello-rust-sdl2-wasm](https://github.com/awwsmm/hello-rust-sdl2-wasm) - A bit of a weird repository, I'm not sure that the creator knows Rust that well, but it compiles. Note that the `asmjs-unknown-emscripten` target is deprecated, and you should use `wasm32-unknown-emscripten` instead. You'll need to change all the files, flags etc. to make it match. + +- [build.sh](./scripts/build.sh) - One of the core files in this repository, it builds the project with Emscripten. Note all the flags available for modifying the behavior of the build. + +### Goals + +- [X] Reproducible SDL2 Emscripten Builds + - This ensures that the project can iterate safely and be inspected in a safe environment, free from errors. Helps ensure errors are isolated to the machine or build script. +- [ ] SDL2 Image, TFF, Mixer Usage + - All of these libraries are common and necessary for a lot of projects. Ensuring they work is important. +- [ ] Example of External Javascript Interop + - The basic ability to provide some kind of Javascript binding would be important for a decent web-based project or game. + - The ability to use localStorage, fetch, or some browser-only API would be important. +- [ ] Windows, MacOS, Linux Builds + - Simple ability to provide multi-platform builds in addition to the WASM build. \ No newline at end of file diff --git a/scripts/build.sh b/scripts/build.sh index fb36eee..b8bd790 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -7,14 +7,19 @@ skip_emsdk='false' clean='false' print_usage() { - printf "Usage: -r RELEASE -d DEBUG -s SERVE\n" + printf "Usage: -erdsc\n" + printf " -e: Skip EMSDK setup (GitHub workflow only)\n" + printf " -r: Build in release mode\n" + printf " -d: Build in debug mode\n" + printf " -s: Serve the WASM files once built\n" + printf " -c: Clean the target/dist directory\n" } while getopts 'erdsc' flag; do case "${flag}" in e) skip_emsdk='true' ;; r) release='true' ;; - d) release='false' ;; + d) release='false' ;; # doesn't actually do anything, but last flag wins s) serve='true' ;; c) clean='true' ;; *)