From 38dabf303ff10ecb7a1d42e69e57e6307ee6ed63 Mon Sep 17 00:00:00 2001 From: Geert Arien Date: Thu, 20 Jun 2019 06:45:36 +0200 Subject: [PATCH] emscripten toolchain: Add option for embind and enable emscripten cmake modules --- cmake-toolchains/emscripten.toolchain.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake-toolchains/emscripten.toolchain.cmake b/cmake-toolchains/emscripten.toolchain.cmake index ed730d55..871bccc7 100644 --- a/cmake-toolchains/emscripten.toolchain.cmake +++ b/cmake-toolchains/emscripten.toolchain.cmake @@ -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) @@ -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() @@ -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)