diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 32e51db1ca..522b3e550a 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -356,6 +356,7 @@ if (onnxruntime_BUILD_WEBASSEMBLY) # (2) "-flto=thin" does not work correctly for wasm-ld. # we don't set onnxruntime_ENABLE_LTO because it appends flag "-flto=thin" # instead, we manually set CMAKE_CXX_FLAGS "-flto" + string(APPEND CMAKE_C_FLAGS " -flto") string(APPEND CMAKE_CXX_FLAGS " -flto") endif() @@ -368,9 +369,22 @@ if (onnxruntime_BUILD_WEBASSEMBLY) set(CMAKE_CXX_FLAGS_DEBUG "-g0") endif() + if (onnxruntime_ENABLE_WEBASSEMBLY_SIMD) + string(APPEND CMAKE_C_FLAGS " -msimd128") + string(APPEND CMAKE_CXX_FLAGS " -msimd128") + endif() + + if (onnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING) + string(APPEND CMAKE_C_FLAGS " -s DISABLE_EXCEPTION_CATCHING=0") + string(APPEND CMAKE_CXX_FLAGS " -s DISABLE_EXCEPTION_CATCHING=0") + endif() + # Build WebAssembly with multi-threads support. if (onnxruntime_ENABLE_WEBASSEMBLY_THREADS) + string(APPEND CMAKE_C_FLAGS " -pthread") string(APPEND CMAKE_CXX_FLAGS " -pthread") + string(APPEND CMAKE_C_FLAGS " -s USE_PTHREADS=1 -Wno-pthreads-mem-growth") + string(APPEND CMAKE_CXX_FLAGS " -s USE_PTHREADS=1 -Wno-pthreads-mem-growth") endif() endif() @@ -2130,18 +2144,6 @@ if (onnxruntime_BUILD_CSHARP) endif() if (onnxruntime_BUILD_WEBASSEMBLY) - if (onnxruntime_ENABLE_WEBASSEMBLY_SIMD) - string(APPEND CMAKE_CXX_FLAGS " -msimd128") - endif() - - if (onnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING) - string(APPEND CMAKE_CXX_FLAGS " -s DISABLE_EXCEPTION_CATCHING=0") - endif() - - if (onnxruntime_ENABLE_WEBASSEMBLY_THREADS) - string(APPEND CMAKE_CXX_FLAGS " -s USE_PTHREADS=1 -Wno-pthreads-mem-growth") - endif() - message(STATUS "WebAssembly Build is enabled") include(onnxruntime_webassembly.cmake) endif() diff --git a/cmake/external/xnnpack.cmake b/cmake/external/xnnpack.cmake index 7f7307b079..4df57b5ed1 100644 --- a/cmake/external/xnnpack.cmake +++ b/cmake/external/xnnpack.cmake @@ -59,10 +59,6 @@ if(onnxruntime_BUILD_WEBASSEMBLY) set(${target_srcs} ${bazel_srcs} PARENT_SCOPE) endfunction() - if(onnxruntime_ENABLE_WEBASSEMBLY_THREADS) - target_compile_options(XNNPACK PRIVATE "-pthread") - endif() - GetSrcListFromBazel("PROD_SCALAR_WASM_MICROKERNEL_SRCS" prod_scalar_wasm_srcs) GetSrcListFromBazel("ALL_WASM_MICROKERNEL_SRCS" all_wasm_srcs) GetSrcListFromBazel("WASM32_ASM_MICROKERNEL_SRCS" wasm32_asm_srcs) @@ -82,9 +78,6 @@ if(onnxruntime_BUILD_WEBASSEMBLY) if(onnxruntime_ENABLE_WEBASSEMBLY_SIMD) GetSrcListFromBazel("ALL_WASMSIMD_MICROKERNEL_SRCS" all_wasmsimd_srcs) message(DEBUG "all_wasmsimd_srcs: ${all_wasmsimd_srcs}") - - target_compile_options(params_init PRIVATE "-msimd128") - target_compile_options(XNNPACK PRIVATE "-msimd128") target_sources(XNNPACK PRIVATE ${all_wasmsimd_srcs}) endif() endif() diff --git a/tools/ci_build/github/azure-pipelines/templates/web-ci.yml b/tools/ci_build/github/azure-pipelines/templates/web-ci.yml index 6d31ac3e6a..df53f23a26 100644 --- a/tools/ci_build/github/azure-pipelines/templates/web-ci.yml +++ b/tools/ci_build/github/azure-pipelines/templates/web-ci.yml @@ -85,7 +85,7 @@ stages: ExtraBuildArgs: '$(ExtraBuildArgs)' PoolName: ${{ parameters.PoolName }} SkipPublish: true - TimeoutInMinutes: 150 + TimeoutInMinutes: 180 - stage: Build_web_Release dependsOn: Build_wasm_Release