diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ebdb21b..6c84ae84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ option(ENABLE_NV_EXTENSIONS "Enables support of Nvidia-specific extensions" ON) option(ENABLE_GLSLANG_WEB "Reduces glslang to minumum needed for web use" OFF) option(ENABLE_EMSCRIPTEN_SINGLE_FILE "If using emscripten, enables SINGLE_FILE build" OFF) +option(ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE "If using emscripten, builds to run on Node instead of Web" OFF) CMAKE_DEPENDENT_OPTION(ENABLE_HLSL "Enables HLSL input support" ON "NOT ENABLE_GLSLANG_WEB" OFF) @@ -113,13 +114,20 @@ if(ENABLE_GLSLANG_WEB) add_link_options("SHELL: -s FILESYSTEM=0") add_link_options("SHELL: --llvm-lto 1") add_link_options("SHELL: --closure 1") - add_link_options("SHELL: -s ENVIRONMENT=web,worker") add_link_options("SHELL: -s ALLOW_MEMORY_GROWTH=1") add_link_options("SHELL: -s MODULARIZE=1") if(ENABLE_EMSCRIPTEN_SINGLE_FILE) add_link_options("SHELL: -s SINGLE_FILE=1") endif(ENABLE_EMSCRIPTEN_SINGLE_FILE) + + if(ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE) + add_link_options("SHELL: -s ENVIRONMENT=node") + add_link_options("SHELL: -s BINARYEN_ASYNC_COMPILATION=0") + else() + add_link_options("SHELL: -s ENVIRONMENT=web,worker") + add_link_options("SHELL: -s EXPORT_ES6=1") + endif() else() if(MSVC) add_compile_options(/Os /GR-)