Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1707c56

Browse files
authored
support emscripten build (taskflow#422)
build : emcmake cmake ... Run example with node.js : node --experimental-wasm-threads --experimental-wasm-bulk-memory examples/simple.js
1 parent 555a9bb commit 1707c56

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

examples/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ foreach(example IN LISTS TF_EXAMPLES)
3838
target_link_libraries(
3939
${example} ${PROJECT_NAME} tf::default_settings
4040
)
41+
# set emcc options
42+
if (CMAKE_SYSTEM_NAME STREQUAL Emscripten)
43+
target_link_options(${example} PUBLIC -sASSERTIONS=1 -sPROXY_TO_PTHREAD -sTOTAL_MEMORY=1536MB -sEXIT_RUNTIME=1 -sUSE_PTHREADS=1)
44+
target_compile_options(${example} PUBLIC -matomics)
45+
endif()
4146
endforeach()
4247

4348
# -----------------------------------------------------------------------------

taskflow/utility/os.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,6 @@
7676
#define TF_OS_SOLARIS 1
7777
#endif
7878

79-
#if (1 != \
80-
TF_OS_LINUX + TF_OS_DRAGONFLY + TF_OS_FREEBSD + TF_OS_NETBSD + \
81-
TF_OS_OPENBSD + TF_OS_DARWIN + TF_OS_WINDOWS + TF_OS_HURD + \
82-
TF_OS_SOLARIS)
83-
#error Unknown OS
84-
#endif
85-
8679
#if TF_OS_LINUX || TF_OS_DRAGONFLY || TF_OS_FREEBSD || TF_OS_NETBSD || \
8780
TF_OS_OPENBSD || TF_OS_DARWIN || TF_OS_HURD || TF_OS_SOLARIS
8881
#undef TF_OS_UNIX

0 commit comments

Comments
 (0)