• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/cmake/emscripten.cmake

  1 # CMake toolchain file for building ucode for WebAssembly (wasm32) with
  2 # emscripten.
  3 #
  4 #   cmake -B build-wasm -DCMAKE_TOOLCHAIN_FILE=cmake/emscripten.cmake
  5 #
  6 # Requires an activated emsdk environment (emcc on PATH). Produces
  7 # libucode.a and ucode-modules.a for static linking into an embedder's
  8 # executable; see the UCODE_WASM section of CMakeLists.txt.
  9 #
 10 # Note: the dependency setup (json-c, libmd) cannot live in this file --
 11 # toolchain files are re-included by every try_compile() probe build --
 12 # so CMakeLists.txt pulls in cmake/emscripten-deps.cmake when it detects
 13 # the emscripten compiler.
 14 
 15 set(CMAKE_SYSTEM_NAME Generic)
 16 set(CMAKE_SYSTEM_PROCESSOR wasm32)
 17 
 18 set(CMAKE_C_COMPILER emcc)
 19 set(CMAKE_CXX_COMPILER em++)
 20 set(CMAKE_ASM_COMPILER emcc)
 21 
 22 set(CMAKE_C_COMPILER_WORKS TRUE)
 23 set(CMAKE_CXX_COMPILER_WORKS TRUE)
 24 
 25 # Declare the emscripten build to CMakeLists.txt. Some CMake versions
 26 # detect emcc as plain "Clang" (no Emscripten branch in the compiler ID
 27 # source), so do not rely on CMAKE_C_COMPILER_ID alone. An explicit
 28 # -DUCODE_WASM=... on the command line takes precedence. (Cache writes
 29 # in this file do not leak into try_compile() probe builds, which use
 30 # their own cache.)
 31 if(NOT DEFINED CACHE{UCODE_WASM})
 32   set(UCODE_WASM ON CACHE BOOL "Build static libraries for wasm32" FORCE)
 33 endif()

This page was automatically generated by LXR 0.3.1.  •  OpenWrt