Skip to content

Commit 69850bf

Browse files
committed
update
1 parent d348807 commit 69850bf

File tree

3 files changed

+11
-187
lines changed

3 files changed

+11
-187
lines changed

CMakeLists.txt

+9-2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,14 @@ find_package(Threads)
4141
set(ONNXRUNTIME_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/src)
4242
set(ONNXRUNTIME_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
4343
option(MLAS_ENABLE_WEBASSEMBLY_THREADS "Enable this option to create WebAssembly byte codes with multi-threads support" OFF)
44+
option(MLAS_ENABLE_WEBASSEMBLY_BROWSER_TESTS "Build all executables as html files" OFF)
45+
4446
option(MLAS_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING "Enable this option to turn on exception catching" OFF)
4547

46-
message("CFLAGS: ${CMAKE_C_FLAGS}")
47-
message("CXXFLAGS: ${CMAKE_CXX_FLAGS}")
48+
if(MLAS_ENABLE_WEBASSEMBLY_BROWSER_TESTS)
49+
#The variable cannot be set from cmake command line because otherwise emscripten's toolchain file will override it.
50+
set(CMAKE_EXECUTABLE_SUFFIX ".html")
51+
endif()
4852
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
4953
if(MLAS_ENABLE_WEBASSEMBLY_THREADS)
5054
add_compile_options("-pthread" "-Wno-pthreads-mem-growth")
@@ -55,6 +59,9 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
5559
if(MLAS_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING)
5660
add_link_options("-fwasm-exceptions" "-sNO_DISABLE_EXCEPTION_CATCHING")
5761
endif()
62+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
63+
add_link_options("-gsource-map" "-sASSERTIONS=2")
64+
endif()
5865
endif()
5966

6067
include(cmake/external_deps.cmake)

CMakePresets.json

-184
Original file line numberDiff line numberDiff line change
@@ -407,82 +407,6 @@
407407
"CMAKE_SHARED_LINKER_FLAGS_INIT": "-fsanitize=address",
408408
"CMAKE_CXX_STANDARD": "20"
409409
}
410-
},
411-
{
412-
"name": "emscripten_debug",
413-
"displayName": "emscripten debug",
414-
"generator": "Unix Makefiles",
415-
"binaryDir": "${sourceDir}/build/default",
416-
"cacheVariables": {
417-
"CMAKE_BUILD_TYPE": "Debug",
418-
"CMAKE_C_FLAGS": "-ggdb3 -O0",
419-
"CMAKE_CXX_FLAGS": "-ggdb3 -O0",
420-
"CMAKE_EXE_LINKER_FLAGS_INIT": "-gsource-map",
421-
"CMAKE_MODULE_LINKER_FLAGS_INIT": "-gsource-map",
422-
"CMAKE_SHARED_LINKER_FLAGS_INIT": "-gsource-map",
423-
"CMAKE_CXX_STANDARD": "20"
424-
},
425-
"environment": {
426-
"CC": "emcc",
427-
"CXX": "em++"
428-
}
429-
},
430-
{
431-
"name": "emscripten_debug_asan",
432-
"displayName": "emscripten debug asan",
433-
"generator": "Unix Makefiles",
434-
"binaryDir": "${sourceDir}/build/default",
435-
"cacheVariables": {
436-
"CMAKE_BUILD_TYPE": "Debug",
437-
"CMAKE_C_FLAGS": "-ggdb3 -O0 -fsanitize=address",
438-
"CMAKE_CXX_FLAGS": "-ggdb3 -O0 -fsanitize=address",
439-
"CMAKE_EXE_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
440-
"CMAKE_MODULE_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
441-
"CMAKE_SHARED_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
442-
"CMAKE_CXX_STANDARD": "20"
443-
},
444-
"environment": {
445-
"CC": "emcc",
446-
"CXX": "em++"
447-
}
448-
},
449-
{
450-
"name": "emscripten_release",
451-
"displayName": "emscripten release",
452-
"generator": "Unix Makefiles",
453-
"binaryDir": "${sourceDir}/build/default",
454-
"cacheVariables": {
455-
"CMAKE_BUILD_TYPE": "Release",
456-
"CMAKE_C_FLAGS": "-DNDEBUG -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -O3 -pipe",
457-
"CMAKE_CXX_FLAGS": "-DNDEBUG -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -O3 -pipe",
458-
"CMAKE_EXE_LINKER_FLAGS_INIT": "-gsource-map",
459-
"CMAKE_MODULE_LINKER_FLAGS_INIT": "-gsource-map",
460-
"CMAKE_SHARED_LINKER_FLAGS_INIT": "-gsource-map",
461-
"CMAKE_CXX_STANDARD": "20"
462-
},
463-
"environment": {
464-
"CC": "emcc",
465-
"CXX": "em++"
466-
}
467-
},
468-
{
469-
"name": "emscripten_release_asan",
470-
"displayName": "emscripten release asan",
471-
"generator": "Unix Makefiles",
472-
"binaryDir": "${sourceDir}/build/default",
473-
"cacheVariables": {
474-
"CMAKE_BUILD_TYPE": "Release",
475-
"CMAKE_C_FLAGS": "-DNDEBUG -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -O3 -pipe -fsanitize=address",
476-
"CMAKE_CXX_FLAGS": "-DNDEBUG -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -O3 -pipe -fsanitize=address",
477-
"CMAKE_EXE_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
478-
"CMAKE_MODULE_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
479-
"CMAKE_SHARED_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
480-
"CMAKE_CXX_STANDARD": "20"
481-
},
482-
"environment": {
483-
"CC": "emcc",
484-
"CXX": "em++"
485-
}
486410
}
487411
],
488412
"buildPresets": [
@@ -580,26 +504,6 @@
580504
"name": "macos_x86_64_release_asan",
581505
"configurePreset": "macos_x86_64_release_asan",
582506
"configuration": "Release"
583-
},
584-
{
585-
"name": "emscripten_debug",
586-
"configurePreset": "emscripten_debug",
587-
"configuration": "Debug"
588-
},
589-
{
590-
"name": "emscripten_debug_asan",
591-
"configurePreset": "emscripten_debug_asan",
592-
"configuration": "Debug"
593-
},
594-
{
595-
"name": "emscripten_release",
596-
"configurePreset": "emscripten_release",
597-
"configuration": "Release"
598-
},
599-
{
600-
"name": "emscripten_release_asan",
601-
"configurePreset": "emscripten_release_asan",
602-
"configuration": "Release"
603507
}
604508
],
605509
"testPresets": [
@@ -697,26 +601,6 @@
697601
"name": "macos_x86_64_release_asan",
698602
"configuration": "Release",
699603
"configurePreset": "macos_x86_64_release_asan"
700-
},
701-
{
702-
"name": "emscripten_debug",
703-
"configuration": "Debug",
704-
"configurePreset": "emscripten_debug"
705-
},
706-
{
707-
"name": "emscripten_debug_asan",
708-
"configuration": "Debug",
709-
"configurePreset": "emscripten_debug_asan"
710-
},
711-
{
712-
"name": "emscripten_release",
713-
"configuration": "Release",
714-
"configurePreset": "emscripten_release"
715-
},
716-
{
717-
"name": "emscripten_release_asan",
718-
"configuration": "Release",
719-
"configurePreset": "emscripten_release_asan"
720604
}
721605
],
722606
"workflowPresets": [
@@ -1042,74 +926,6 @@
1042926
"name": "macos_x86_64_release"
1043927
}
1044928
]
1045-
},
1046-
{
1047-
"name": "emscripten_debug_asan_workflow",
1048-
"steps": [
1049-
{
1050-
"type": "configure",
1051-
"name": "emscripten_debug_asan"
1052-
},
1053-
{
1054-
"type": "build",
1055-
"name": "emscripten_debug_asan"
1056-
},
1057-
{
1058-
"type": "test",
1059-
"name": "emscripten_debug_asan"
1060-
}
1061-
]
1062-
},
1063-
{
1064-
"name": "emscripten_debug_workflow",
1065-
"steps": [
1066-
{
1067-
"type": "configure",
1068-
"name": "emscripten_debug"
1069-
},
1070-
{
1071-
"type": "build",
1072-
"name": "emscripten_debug"
1073-
},
1074-
{
1075-
"type": "test",
1076-
"name": "emscripten_debug"
1077-
}
1078-
]
1079-
},
1080-
{
1081-
"name": "emscripten_release_asan_workflow",
1082-
"steps": [
1083-
{
1084-
"type": "configure",
1085-
"name": "emscripten_release_asan"
1086-
},
1087-
{
1088-
"type": "build",
1089-
"name": "emscripten_release_asan"
1090-
},
1091-
{
1092-
"type": "test",
1093-
"name": "emscripten_release_asan"
1094-
}
1095-
]
1096-
},
1097-
{
1098-
"name": "emscripten_release_workflow",
1099-
"steps": [
1100-
{
1101-
"type": "configure",
1102-
"name": "emscripten_release"
1103-
},
1104-
{
1105-
"type": "build",
1106-
"name": "emscripten_release"
1107-
},
1108-
{
1109-
"type": "test",
1110-
"name": "emscripten_release"
1111-
}
1112-
]
1113929
}
1114930
]
1115931
}

tests/unittest/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
6767
else()
6868
set_target_properties(mlas_unittest PROPERTIES LINK_FLAGS "-s ALLOW_MEMORY_GROWTH=1")
6969
endif()
70-
target_link_options(mlas_unittest PRIVATE "-sDEFAULT_PTHREAD_STACK_SIZE=131072")
70+
#TODO: do we need to set both? Shouldn't them be the same?
71+
target_link_options(mlas_unittest PRIVATE "-sDEFAULT_PTHREAD_STACK_SIZE=2097152" "-sSTACK_SIZE=5242880")
7172
endif()
7273

7374
#gtest_discover_tests(mlas_unittest)

0 commit comments

Comments
 (0)