summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-11-17 17:01:47 -0500
committerFreya Murphy <freya@freyacat.org>2025-11-17 17:01:47 -0500
commitce86e8a5a4bb3e095a37efb8774eb971ed1e7587 (patch)
tree10d0cdcadbd3c00588adc45a8da30dbc7e097710
parentwasm: Update emscripten defaults (diff)
downloadDungeonCrawl-ce86e8a5a4bb3e095a37efb8774eb971ed1e7587.tar.gz
DungeonCrawl-ce86e8a5a4bb3e095a37efb8774eb971ed1e7587.tar.bz2
DungeonCrawl-ce86e8a5a4bb3e095a37efb8774eb971ed1e7587.zip
wasm: make building alot simpler (most was nix only)
-rw-r--r--Makefile3
-rw-r--r--README.md4
-rw-r--r--flake.nix6
3 files changed, 3 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index aeccf61..75f3d0d 100644
--- a/Makefile
+++ b/Makefile
@@ -5,8 +5,6 @@ ASSETS_DST = $(patsubst game/www/%,dist/%,$(ASSETS_SRC))
TEST_PORT ?= 8000
-EMSDK ?= /usr/lib/emscripten
-EMSDK_SYSROOT ?= $(EMSDK)/upstream/emscripten/cache/sysroot
EMCC_CFLAGS := -O3 \
-sUSE_GLFW=3 \
-sASSERTIONS=1 \
@@ -24,7 +22,6 @@ dist:
env \
CC=emcc \
EMCC_CFLAGS="$(EMCC_CFLAGS)" \
- C_INCLUDE_PATH="$(EMSDK_SYSROOT)/include:$(C_INCLUDE_PATH)" \
cargo build --target wasm32-unknown-emscripten --profile wasm
mkdir -p dist
cp ./target/wasm32-unknown-emscripten/wasm/game.js dist/game.js
diff --git a/README.md b/README.md
index 7fd9fb3..98d7bab 100644
--- a/README.md
+++ b/README.md
@@ -25,9 +25,7 @@ cargo build --release --path game
Web builds require the [emscripten](https://emscripten.org/docs/getting_started/downloads.html) toolchain.
-Download emscripten, and make sure its added into your path.
-
-If you having build issues, make sure `EMSDK` is set to the library path of the toolchain. If you continue to have issues try installing emscripten though the git repo and the `emsdk` script.
+Download emscripten, and make sure `emcc` is in your path.
To build for web, invoke the makefile. The output website will be in `dist`.
diff --git a/flake.nix b/flake.nix
index ba35e69..00d3f5b 100644
--- a/flake.nix
+++ b/flake.nix
@@ -62,15 +62,13 @@
fi
# setup wasm
- export PATH="$EMSDK/share/emscripten:$PATH"
+ export PATH="${pkgs.emscripten}/share/emscripten:$PATH"
export EM_CACHE="$HOME"/.emscripten_cache
'';
LD_LIBRARY_PATH = lib.makeLibraryPath libs;
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
-
- EMSDK = "${pkgs.emscripten}";
- EMSDK_SYSROOT = "${pkgs.emscripten}/share/emscripten/cache/sysroot";
+ C_INCLUDE_PATH = "${pkgs.emscripten}/share/emscripten/cache/sysroot/include";
};
formatter = pkgs.alejandra;