From 00e4d79db112140c47e32af6b1b09454f4e04f05 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Thu, 10 Nov 2022 00:40:52 +0000 Subject: [PATCH] js: Enable STRICT_JS in Emscripten This turns on "use strict" in JavaScript, which enforces declaring variables among other things, and may allow better optimisations. --- cmake/platforms/emscripten.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/platforms/emscripten.cmake b/cmake/platforms/emscripten.cmake index 5c13f90..244cfcb 100644 --- a/cmake/platforms/emscripten.cmake +++ b/cmake/platforms/emscripten.cmake @@ -37,7 +37,8 @@ string(JOIN "," emcc_export_string ${emcc_export_list}) set(CMAKE_C_LINK_FLAGS "\ -s ALLOW_MEMORY_GROWTH=1 \ -s EXPORTED_FUNCTIONS='[${emcc_export_string}]' \ --s EXTRA_EXPORTED_RUNTIME_METHODS='[cwrap,callMain]'") +-s EXTRA_EXPORTED_RUNTIME_METHODS='[cwrap,callMain]' \ +-s STRICT_JS=1") if(WASM) set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -s WASM=1") else()