@@ -40,12 +40,11 @@ function(add_executable target)
40
40
set (wasm_target ${target} )
41
41
_add_executable (${wasm_target} ${ARGN} )
42
42
# Suppress CLI11 Encoding_inl.hpp std::wstring_convert deprecation warning
43
- set_property (TARGET ${wasm_target} APPEND PROPERTY COMPILE_OPTIONS "- Wno-deprecated-declarations" )
43
+ set_property (TARGET ${wasm_target} APPEND PROPERTY COMPILE_OPTIONS -msimd128 -flto - Wno-warn-absolute-paths -Wno- deprecated-declarations -DITK_WASM_NO_FILESYSTEM_IO )
44
44
if (EMSCRIPTEN )
45
45
kebab_to_camel (${target} targetCamel )
46
46
get_property (_link_flags TARGET ${target} PROPERTY LINK_FLAGS )
47
- set (common_link_flags " -s FORCE_FILESYSTEM=1 -s
48
- EXPORTED_RUNTIME_METHODS='[\" callMain\" ,\" cwrap\" ,\" ccall\" ,\" writeArrayToMemory\" ,\" lengthBytesUTF8\" ,\" stringToUTF8\" ,\" UTF8ToString\" , \" stackSave\" , \" stackRestore\" ]' -flto -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s WASM=1 -lnodefs.js -s WASM_ASYNC_COMPILATION=1 -s EXPORT_NAME=${targetCamel} -s MODULARIZE=1 -s EXIT_RUNTIME=0 -s INVOKE_RUN=0 --pre-js /ITKWebAssemblyInterface/src/emscripten-module/itkJSPipelinePre.js --post-js /ITKWebAssemblyInterface/src/emscripten-module/itkJSPost.js -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s EXPORTED_FUNCTIONS='[\" _main\" ]' ${_link_flags} " )
47
+ set (common_link_flags "-flto -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s FORCE_FILESYSTEM=1 -s EXPORTED_RUNTIME_METHODS='[\" callMain\" ,\" cwrap\" ,\" ccall\" ,\" writeArrayToMemory\" ,\" lengthBytesUTF8\" ,\" stringToUTF8\" ,\" UTF8ToString\" , \" stackSave\" , \" stackRestore\" ]' -flto -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s WASM=1 -lnodefs.js -s WASM_ASYNC_COMPILATION=1 -s EXPORT_NAME=${targetCamel} -s MODULARIZE=1 -s EXIT_RUNTIME=0 -s INVOKE_RUN=0 --pre-js /ITKWebAssemblyInterface/src/emscripten-module/itkJSPipelinePre.js --post-js /ITKWebAssemblyInterface/src/emscripten-module/itkJSPost.js -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s EXPORTED_FUNCTIONS='[\" _main\" ]' ${_link_flags} " )
49
48
set_property (TARGET ${wasm_target} PROPERTY LINK_FLAGS "${common_link_flags} -s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=1" )
50
49
51
50
get_property (_include_dirs TARGET ${target} PROPERTY INCLUDE_DIRECTORIES )
@@ -75,9 +74,13 @@ function(add_executable target)
75
74
get_property (_is_imported TARGET ${wasm_target} PROPERTY IMPORTED )
76
75
if (NOT ${_is_imported} )
77
76
_target_link_libraries (${target} PRIVATE $< $< LINK_LANGUAGE:CXX> :wasi-itk-extras> )
77
+ set_property (TARGET ${wasm_target} APPEND PROPERTY COMPILE_OPTIONS -flto -msimd128 -D_WASI_EMULATED_PROCESS_CLOCKS -D_WASI_EMULATED_SIGNAL )
78
+ target_compile_options (${wasm_target} PRIVATE $< $< CONFIG:Debug> :-fno-lto -g> )
78
79
get_property (_link_flags TARGET ${wasm_target} PROPERTY LINK_FLAGS )
79
80
set_property (TARGET ${wasm_target} PROPERTY LINK_FLAGS
80
- "-mexec-model=reactor -Wl,--export-if-defined=itk_wasm_input_array_alloc -Wl,--export-if-defined=itk_wasm_input_json_alloc -Wl,--export-if-defined=itk_wasm_output_json_address -Wl,--export-if-defined=itk_wasm_output_json_size -Wl,--export-if-defined=itk_wasm_output_array_address -Wl,--export-if-defined=itk_wasm_output_array_size -Wl,--export-if-defined=itk_wasm_free_all -Wl,--export-if-defined=_start -Wl,--export-if-defined=itk_wasm_delayed_start -Wl,--export-if-defined=itk_wasm_delayed_exit ${_link_flags} " )
81
+ "-flto -lwasi-emulated-process-clocks -lwasi-emulated-signal -lc-printscan-long-double -mexec-model=reactor -Wl,--export-if-defined=itk_wasm_input_array_alloc -Wl,--export-if-defined=itk_wasm_input_json_alloc -Wl,--export-if-defined=itk_wasm_output_json_address -Wl,--export-if-defined=itk_wasm_output_json_size -Wl,--export-if-defined=itk_wasm_output_array_address -Wl,--export-if-defined=itk_wasm_output_array_size -Wl,--export-if-defined=itk_wasm_free_all -Wl,--export-if-defined=_start -Wl,--export-if-defined=itk_wasm_delayed_start -Wl,--export-if-defined=itk_wasm_delayed_exit ${_link_flags} " )
82
+ set_property (TARGET ${wasm_target} PROPERTY LINK_FLAGS_DEBUG
83
+ "-fno-lto -lwasi-emulated-process-clocks -lwasi-emulated-signal -lc-printscan-long-double -mexec-model=reactor -Wl,--export-if-defined=itk_wasm_input_array_alloc -Wl,--export-if-defined=itk_wasm_input_json_alloc -Wl,--export-if-defined=itk_wasm_output_json_address -Wl,--export-if-defined=itk_wasm_output_json_size -Wl,--export-if-defined=itk_wasm_output_array_address -Wl,--export-if-defined=itk_wasm_output_array_size -Wl,--export-if-defined=itk_wasm_free_all -Wl,--export-if-defined=_start -Wl,--export-if-defined=itk_wasm_delayed_start -Wl,--export-if-defined=itk_wasm_delayed_exit ${_link_flags} " )
81
84
if (NOT ITK_WASM_NO_INTERFACE_LINK )
82
85
if (NOT TARGET WebAssemblyInterface )
83
86
find_package (ITK QUIET COMPONENTS WebAssemblyInterface )
0 commit comments