Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for embind and enable emscripten cmake modules #226

Merged
merged 1 commit into from
Jun 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cmake-toolchains/emscripten.toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ option(FIPS_EMSCRIPTEN_USE_MEMORY_PROFILER "enable the built-in memory profiler"
option(FIPS_EMSCRIPTEN_USE_WEBGL2 "use WebGL2" OFF)
option(FIPS_EMSCRIPTEN_USE_CLOSURE "run closure compiler on JS code" OFF)
option(FIPS_EMSCRIPTEN_USE_EMMALLOC "use emmalloc allocator" OFF)
option(FIPS_EMSCRIPTEN_USE_EMBIND "use embind" OFF)
option(FIPS_EMSCRIPTEN_ALLOW_MEMORY_GROWTH "allow memory growth" ON)
option(FIPS_EMSCRIPTEN_USE_WASM_TRAP_MODE_CLAMP "use trap-mode clamp for wasm" ON)
option(FIPS_EMSCRIPTEN_DEMANGLE "compile with libcxxabi-provided demangling support" OFF)
Expand Down Expand Up @@ -73,6 +74,9 @@ endif()
if (FIPS_EMSCRIPTEN_USE_EMMALLOC)
set(EMSC_LINKER_FLAGS "${EMSC_LINKER_FLAGS} -s \"MALLOC='emmalloc'\"")
endif()
if (FIPS_EMSCRIPTEN_USE_EMBIND)
set(EMSC_LINKER_FLAGS "${EMSC_LINKER_FLAGS} --bind")
endif()
if (FIPS_EMSCRIPTEN_USE_FS)
set(EMSC_LINKER_FLAGS "${EMSC_LINKER_FLAGS} -s NO_FILESYSTEM=0")
else()
Expand Down Expand Up @@ -173,6 +177,9 @@ set(CMAKE_AR "${EMSCRIPTEN_ROOT}/emar${EMCC_SUFFIX}" CACHE PATH "archive" FORCE)
set(CMAKE_LINKER "${EMSCRIPTEN_ROOT}/emcc${EMCC_SUFFIX}" CACHE PATH "linker" FORCE)
set(CMAKE_RANLIB "${EMSCRIPTEN_ROOT}/emranlib${EMCC_SUFFIX}" CACHE PATH "ranlib" FORCE)

# override cmake modules with emscripten cmake modules
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${EMSCRIPTEN_ROOT_PATH}/cmake/Modules")

# only search for libraries and includes in the toolchain
set(CMAKE_FIND_ROOT_PATH ${EMSCRIPTEN_ROOT})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
Expand Down