diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2022-10-26 22:49:36 +0100 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2022-10-27 09:59:04 +0100 |
| commit | 5af0cd4ac1f906fb09e0bf1cac967c1c27dc240f (patch) | |
| tree | 1ebf4158903c5aca7f8129d756c94b2913d826c1 /cmake | |
| parent | 6f5debe417dbcb4b17be00fa4790b80ed887158c (diff) | |
| download | puzzles-5af0cd4ac1f906fb09e0bf1cac967c1c27dc240f.zip puzzles-5af0cd4ac1f906fb09e0bf1cac967c1c27dc240f.tar.gz puzzles-5af0cd4ac1f906fb09e0bf1cac967c1c27dc240f.tar.bz2 puzzles-5af0cd4ac1f906fb09e0bf1cac967c1c27dc240f.tar.xz | |
js: Add a CMake variable to control whether Emscripten emits WASM
I've finally got bored of keeping (and occasionally losing) a patch
that turns it off unconditionally.
Diffstat (limited to 'cmake')
| -rw-r--r-- | cmake/platforms/emscripten.cmake | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cmake/platforms/emscripten.cmake b/cmake/platforms/emscripten.cmake index 5673ebe..6526037 100644 --- a/cmake/platforms/emscripten.cmake +++ b/cmake/platforms/emscripten.cmake @@ -3,6 +3,9 @@ set(platform_gui_libs) set(platform_libs) set(CMAKE_EXECUTABLE_SUFFIX ".js") +set(WASM ON + CACHE BOOL "Compile to WebAssembly rather than plain JavaScript") + set(emcc_export_list # Event handlers for mouse and keyboard input _mouseup @@ -33,6 +36,11 @@ set(CMAKE_C_LINK_FLAGS "\ -s ALLOW_MEMORY_GROWTH=1 \ -s EXPORTED_FUNCTIONS='[${emcc_export_string}]' \ -s EXTRA_EXPORTED_RUNTIME_METHODS='[cwrap,callMain]'") +if(WASM) + set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -s WASM=1") +else() + set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -s WASM=0") +endif() set(build_cli_programs FALSE) set(build_gui_programs FALSE) |