Skip to content

Commit

Permalink
Support Emscripten
Browse files Browse the repository at this point in the history
  • Loading branch information
seven332 committed Sep 21, 2024
1 parent 021c1ae commit f8c715a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,18 @@ add_executable(cmd src/main.cpp)
target_compile_options(cmd PRIVATE "-fno-exceptions" "-fno-rtti")
target_link_libraries(cmd PRIVATE minifier writer tint_utils_cli nlohmann_json)
set_target_properties(cmd PROPERTIES OUTPUT_NAME "wgslx")

if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
target_link_options(
cmd
PRIVATE
-sENVIRONMENT=node
-sALLOW_MEMORY_GROWTH=1
-sINITIAL_MEMORY=32MB
-sDISABLE_EXCEPTION_CATCHING=1
-sEXIT_RUNTIME=0
-sSTACK_SIZE=1MB
-lnodefs.js
-lnoderawfs.js
)
endif()
2 changes: 1 addition & 1 deletion cmd/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ int main(int argc, char* argv[]) {
nlohmann::json j;
j["wgsl"] = writer_res.wgsl;
j["remappings"] = minifier_res.remappings;
std::cout << j.dump();
std::cout << j.dump() << "\n";

return 0;
}

0 comments on commit f8c715a

Please sign in to comment.