summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-11-17 11:31:12 -0500
committerFreya Murphy <freya@freyacat.org>2025-11-17 11:31:12 -0500
commit988bb3d9048c65e2c54d8b7e46a0e2d69e8aea13 (patch)
tree0a8cdcd1b1a45a5dd58d6229d4bbb432e07d1a0e /Makefile
parentwasm support! (diff)
downloadDungeonCrawl-988bb3d9048c65e2c54d8b7e46a0e2d69e8aea13.tar.gz
DungeonCrawl-988bb3d9048c65e2c54d8b7e46a0e2d69e8aea13.tar.bz2
DungeonCrawl-988bb3d9048c65e2c54d8b7e46a0e2d69e8aea13.zip
get wasm building with just nixpkgs, remove docker
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile23
1 files changed, 17 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 02714d0..5835dda 100644
--- a/Makefile
+++ b/Makefile
@@ -5,20 +5,31 @@ ASSETS_DST = $(patsubst game/www/%,dist/%,$(ASSETS_SRC))
TEST_PORT ?= 8000
-IMAGE := dungeon_crawl_builder
+EMCC_CFLAGS := -O3 \
+ -sUSE_GLFW=3 \
+ -sASSERTIONS=1 \
+ -sWASM=1 \
+ -sASYNCIFY \
+ -sGL_ENABLE_GET_PROC_ADDRESS=1 \
+ -sEXPORTED_RUNTIME_METHODS=HEAPF32,ccall,cwrap
web: dist $(ASSETS_DST)
test: web
cd dist && python3 -m http.server $(TEST_PORT)
-image:
- docker build -t $(IMAGE) .
-
dist:
- docker run --rm -it -v .:/data -v ~/.cargo:/home/builder/.cargo $(IMAGE)
+ env \
+ CC=emcc \
+ CXX=em++ \
+ AR=emar \
+ CFLAGS="$(EMCC_CFLAGS)" \
+ CXXFLAGS="$(EMCC_CFLAGS)" \
+ EMCC_CFLAGS="$(EMCC_CFLAGS)" \
+ CMAKE_INSTALL_LIBDIR=lib \
+ cargo build --target wasm32-unknown-emscripten --profile wasm
mkdir -p dist
- cp ./target/wasm32-unknown-emscripten/release/game.{js,wasm} dist
+ cp ./target/wasm32-unknown-emscripten/wasm/game.{js,wasm} dist
dist/%: game/www/%
cp -r $< $@