CMakeLists.txt: Support emscripten 3.1.58 SINGLE_FILE without a worker.js file
Signed-off-by: Username404-59 <w.iron.zombie@gmail.com>
This commit is contained in:
parent
d4c854d8ef
commit
023af39a22
|
@ -81,7 +81,10 @@ if (${IS_GNU} OR ${IS_CLANG})
|
||||||
else()
|
else()
|
||||||
set(IS_HOST_NOT_ANDROID 0)
|
set(IS_HOST_NOT_ANDROID 0)
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "--closure 1 --closure-args=\"--compilation_level SIMPLE\" -lnodefs.js -lembind -sDYNAMIC_EXECUTION=0 -sFORCE_FILESYSTEM=1 -sWASM=0 -sEXPORTED_FUNCTIONS=_main -sEXIT_RUNTIME=1 -sSINGLE_FILE=1 -sSAFE_HEAP=${IS_HOST_NOT_ANDROID} -sMALLOC='emmalloc' -sABORTING_MALLOC=0 -sJS_MATH=1 -sENVIRONMENT='web,webview,worker,node,shell' -sNODEJS_CATCH_EXIT=0 -sSTRICT=1 -sMINIMAL_RUNTIME=0 -sDISABLE_EXCEPTION_CATCHING=0 -sSTACK_SIZE=8MB -sALLOW_MEMORY_GROWTH=1 -Wno-pthreads-mem-growth -sMEMORY_GROWTH_GEOMETRIC_STEP=0 -sDECLARE_ASM_MODULE_EXPORTS=1 ${CMAKE_EXE_LINKER_FLAGS}")
|
set(CMAKE_EXE_LINKER_FLAGS "--closure 1 --closure-args=\"--compilation_level SIMPLE\" -lnodefs.js -lembind -sDYNAMIC_EXECUTION=0 -sFORCE_FILESYSTEM=1 -sWASM=0 -sEXPORTED_FUNCTIONS=_main -sEXIT_RUNTIME=1 -sSINGLE_FILE=1 -sSAFE_HEAP=${IS_HOST_NOT_ANDROID} -sMALLOC='emmalloc' -sABORTING_MALLOC=0 -sJS_MATH=1 -sENVIRONMENT='web,webview,worker,node,shell' -sNODEJS_CATCH_EXIT=0 -sMINIMAL_RUNTIME=0 -sDISABLE_EXCEPTION_CATCHING=0 -sSTACK_SIZE=8MB -sALLOW_MEMORY_GROWTH=1 -Wno-pthreads-mem-growth -sMEMORY_GROWTH_GEOMETRIC_STEP=0 -sDECLARE_ASM_MODULE_EXPORTS=1 ${CMAKE_EXE_LINKER_FLAGS}")
|
||||||
|
if (EMSCRIPTEN_VERSION VERSION_LESS 3.1.58)
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -sSTRICT=1")
|
||||||
|
endif ()
|
||||||
if (EMSCRIPTEN_VERSION VERSION_LESS 3.1.54)
|
if (EMSCRIPTEN_VERSION VERSION_LESS 3.1.54)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -sDEMANGLE_SUPPORT=1")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -sDEMANGLE_SUPPORT=1")
|
||||||
elseif (EMSCRIPTEN_VERSION VERSION_LESS 3.1.55)
|
elseif (EMSCRIPTEN_VERSION VERSION_LESS 3.1.55)
|
||||||
|
@ -210,6 +213,9 @@ if (EMSCRIPTEN)
|
||||||
set(NODE_PACKAGE_PROGRAM "${NPM_PRESENT}")
|
set(NODE_PACKAGE_PROGRAM "${NPM_PRESENT}")
|
||||||
endif()
|
endif()
|
||||||
if (DEFINED NODE_PACKAGE_PROGRAM)
|
if (DEFINED NODE_PACKAGE_PROGRAM)
|
||||||
|
if (EMSCRIPTEN_VERSION VERSION_LESS 3.1.58)
|
||||||
|
set(YAO_ASSETS "\n \"assets\": \"../${EXENAME}.worker.js\",")
|
||||||
|
endif()
|
||||||
configure_file("resources/package.json" "processed/package.json" @ONLY)
|
configure_file("resources/package.json" "processed/package.json" @ONLY)
|
||||||
file(COPY "${CMAKE_CURRENT_BINARY_DIR}/processed/package.json" DESTINATION ".")
|
file(COPY "${CMAKE_CURRENT_BINARY_DIR}/processed/package.json" DESTINATION ".")
|
||||||
file(COPY "resources/.npmrc" DESTINATION ".")
|
file(COPY "resources/.npmrc" DESTINATION ".")
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
"bin": "@EXENAME@.js",
|
"bin": "@EXENAME@.js",
|
||||||
"license": "@CPACK_RPM_PACKAGE_LICENSE@",
|
"license": "@CPACK_RPM_PACKAGE_LICENSE@",
|
||||||
"devDependencies": { "@yao-pkg/pkg": "^5.9.0" },
|
"devDependencies": { "@yao-pkg/pkg": "^5.9.0" },
|
||||||
"pkg": {
|
"pkg": {@YAO_ASSETS@
|
||||||
"assets": "../@EXENAME@.worker.js",
|
|
||||||
"targets": [
|
"targets": [
|
||||||
"latest-macos-x64",
|
"latest-macos-x64",
|
||||||
"latest-macos-arm64"
|
"latest-macos-arm64"
|
||||||
|
|
Loading…
Reference in New Issue