Skip to content

Commit b4b44e0

Browse files
committed
make cmake target default for emscripten, check for emsdk in Makefile
1 parent 475ea2c commit b4b44e0

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

experimental/wasm/emscripten/Makefile

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1-
21
FLAGS=--target=wasm32 -nostdlib -Wl,--no-entry -Wl,--export-all -Wl,--import-memory -Wl,--allow-undefined -fexceptions -std=c++17 -O3
32

3+
# For all targets, make sure emsdk is installed and `source emsdk_env.sh` is run in the emsdk directory
44

5-
# Make sure you have:
6-
# 1) emsdk installed
7-
# 2) `source emsdk_env.sh` in the emsdk directory
8-
build/run.wasm:
9-
em++ -sUSE_WEBGPU=1 -sUSE_GLFW=3 run.cpp -o build/run.wasm
105

11-
cmake:
6+
.PHONY: cmake check-emsdk browser clean
7+
8+
# make clean explicit here because custom_shell.html changes don't trigger a rebuild
9+
cmake: check-emsdk clean
1210
emcmake cmake -B build && cmake --build build -j4
1311
npx http-server
1412

13+
build/run.wasm: check-emsdk run.cpp
14+
em++ -sUSE_WEBGPU=1 -sUSE_GLFW=3 run.cpp -o build/run.wasm
15+
1516
browser:
1617
open http://127.0.0.1:8000/build/run.html
1718

1819
clean:
1920
rm -rf build/*
21+
22+
check-emsdk:
23+
@which emcc > /dev/null || (echo "emsdk not found. Please install emsdk and run 'source emsdk_env.sh' in the emsdk directory." && exit 1)

0 commit comments

Comments
 (0)