Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
snnn committed Sep 22, 2024
1 parent d348807 commit 69850bf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 187 deletions.
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@ find_package(Threads)
set(ONNXRUNTIME_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(ONNXRUNTIME_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
option(MLAS_ENABLE_WEBASSEMBLY_THREADS "Enable this option to create WebAssembly byte codes with multi-threads support" OFF)
option(MLAS_ENABLE_WEBASSEMBLY_BROWSER_TESTS "Build all executables as html files" OFF)

option(MLAS_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING "Enable this option to turn on exception catching" OFF)

message("CFLAGS: ${CMAKE_C_FLAGS}")
message("CXXFLAGS: ${CMAKE_CXX_FLAGS}")
if(MLAS_ENABLE_WEBASSEMBLY_BROWSER_TESTS)
#The variable cannot be set from cmake command line because otherwise emscripten's toolchain file will override it.
set(CMAKE_EXECUTABLE_SUFFIX ".html")
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
if(MLAS_ENABLE_WEBASSEMBLY_THREADS)
add_compile_options("-pthread" "-Wno-pthreads-mem-growth")
Expand All @@ -55,6 +59,9 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
if(MLAS_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING)
add_link_options("-fwasm-exceptions" "-sNO_DISABLE_EXCEPTION_CATCHING")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_link_options("-gsource-map" "-sASSERTIONS=2")
endif()
endif()

include(cmake/external_deps.cmake)
Expand Down
184 changes: 0 additions & 184 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -407,82 +407,6 @@
"CMAKE_SHARED_LINKER_FLAGS_INIT": "-fsanitize=address",
"CMAKE_CXX_STANDARD": "20"
}
},
{
"name": "emscripten_debug",
"displayName": "emscripten debug",
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build/default",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_FLAGS": "-ggdb3 -O0",
"CMAKE_CXX_FLAGS": "-ggdb3 -O0",
"CMAKE_EXE_LINKER_FLAGS_INIT": "-gsource-map",
"CMAKE_MODULE_LINKER_FLAGS_INIT": "-gsource-map",
"CMAKE_SHARED_LINKER_FLAGS_INIT": "-gsource-map",
"CMAKE_CXX_STANDARD": "20"
},
"environment": {
"CC": "emcc",
"CXX": "em++"
}
},
{
"name": "emscripten_debug_asan",
"displayName": "emscripten debug asan",
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build/default",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_FLAGS": "-ggdb3 -O0 -fsanitize=address",
"CMAKE_CXX_FLAGS": "-ggdb3 -O0 -fsanitize=address",
"CMAKE_EXE_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
"CMAKE_MODULE_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
"CMAKE_SHARED_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
"CMAKE_CXX_STANDARD": "20"
},
"environment": {
"CC": "emcc",
"CXX": "em++"
}
},
{
"name": "emscripten_release",
"displayName": "emscripten release",
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build/default",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_FLAGS": "-DNDEBUG -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -O3 -pipe",
"CMAKE_CXX_FLAGS": "-DNDEBUG -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -O3 -pipe",
"CMAKE_EXE_LINKER_FLAGS_INIT": "-gsource-map",
"CMAKE_MODULE_LINKER_FLAGS_INIT": "-gsource-map",
"CMAKE_SHARED_LINKER_FLAGS_INIT": "-gsource-map",
"CMAKE_CXX_STANDARD": "20"
},
"environment": {
"CC": "emcc",
"CXX": "em++"
}
},
{
"name": "emscripten_release_asan",
"displayName": "emscripten release asan",
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build/default",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_FLAGS": "-DNDEBUG -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -O3 -pipe -fsanitize=address",
"CMAKE_CXX_FLAGS": "-DNDEBUG -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -O3 -pipe -fsanitize=address",
"CMAKE_EXE_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
"CMAKE_MODULE_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
"CMAKE_SHARED_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
"CMAKE_CXX_STANDARD": "20"
},
"environment": {
"CC": "emcc",
"CXX": "em++"
}
}
],
"buildPresets": [
Expand Down Expand Up @@ -580,26 +504,6 @@
"name": "macos_x86_64_release_asan",
"configurePreset": "macos_x86_64_release_asan",
"configuration": "Release"
},
{
"name": "emscripten_debug",
"configurePreset": "emscripten_debug",
"configuration": "Debug"
},
{
"name": "emscripten_debug_asan",
"configurePreset": "emscripten_debug_asan",
"configuration": "Debug"
},
{
"name": "emscripten_release",
"configurePreset": "emscripten_release",
"configuration": "Release"
},
{
"name": "emscripten_release_asan",
"configurePreset": "emscripten_release_asan",
"configuration": "Release"
}
],
"testPresets": [
Expand Down Expand Up @@ -697,26 +601,6 @@
"name": "macos_x86_64_release_asan",
"configuration": "Release",
"configurePreset": "macos_x86_64_release_asan"
},
{
"name": "emscripten_debug",
"configuration": "Debug",
"configurePreset": "emscripten_debug"
},
{
"name": "emscripten_debug_asan",
"configuration": "Debug",
"configurePreset": "emscripten_debug_asan"
},
{
"name": "emscripten_release",
"configuration": "Release",
"configurePreset": "emscripten_release"
},
{
"name": "emscripten_release_asan",
"configuration": "Release",
"configurePreset": "emscripten_release_asan"
}
],
"workflowPresets": [
Expand Down Expand Up @@ -1042,74 +926,6 @@
"name": "macos_x86_64_release"
}
]
},
{
"name": "emscripten_debug_asan_workflow",
"steps": [
{
"type": "configure",
"name": "emscripten_debug_asan"
},
{
"type": "build",
"name": "emscripten_debug_asan"
},
{
"type": "test",
"name": "emscripten_debug_asan"
}
]
},
{
"name": "emscripten_debug_workflow",
"steps": [
{
"type": "configure",
"name": "emscripten_debug"
},
{
"type": "build",
"name": "emscripten_debug"
},
{
"type": "test",
"name": "emscripten_debug"
}
]
},
{
"name": "emscripten_release_asan_workflow",
"steps": [
{
"type": "configure",
"name": "emscripten_release_asan"
},
{
"type": "build",
"name": "emscripten_release_asan"
},
{
"type": "test",
"name": "emscripten_release_asan"
}
]
},
{
"name": "emscripten_release_workflow",
"steps": [
{
"type": "configure",
"name": "emscripten_release"
},
{
"type": "build",
"name": "emscripten_release"
},
{
"type": "test",
"name": "emscripten_release"
}
]
}
]
}
3 changes: 2 additions & 1 deletion tests/unittest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
else()
set_target_properties(mlas_unittest PROPERTIES LINK_FLAGS "-s ALLOW_MEMORY_GROWTH=1")
endif()
target_link_options(mlas_unittest PRIVATE "-sDEFAULT_PTHREAD_STACK_SIZE=131072")
#TODO: do we need to set both? Shouldn't them be the same?
target_link_options(mlas_unittest PRIVATE "-sDEFAULT_PTHREAD_STACK_SIZE=2097152" "-sSTACK_SIZE=5242880")
endif()

#gtest_discover_tests(mlas_unittest)
Expand Down

0 comments on commit 69850bf

Please sign in to comment.