Viewing is open to everyone. Downloading and starring need a GitHub sign-in. Sign in with GitHub

CMakeLists.txt

v0.1.0-build.85 Latest Commit ede38f5

Size
1.7 KB
Lines
43
Language
cmake
SHA-256
12810f65abaa…
View on GitHub

Sign in with GitHub to download. Each download is recorded with your GitHub username.

1# CKey Web SDK: the C core plus the bridge (src/ckey_web.cpp) compiled to
2# WebAssembly with Emscripten. Configure with emcmake:
3# emcmake cmake -S sdk/web -B sdk/web/build/wasm -DCMAKE_BUILD_TYPE=Release
4# cmake --build sdk/web/build/wasm
5# then scripts/assemble.mjs copies ckey-core.mjs/.wasm and the JS wrapper into
6# dist/ (scripts/build.sh does all three steps).
7cmake_minimum_required(VERSION 3.20)
8project(ckey_web LANGUAGES CXX)
9
10if(NOT EMSCRIPTEN)
11 message(FATAL_ERROR "sdk/web must be configured with emcmake (Emscripten); see scripts/build.sh")
12endif()
13
14set(CKEY_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..")
15set(CKEY_WEB_SOURCES
16 "${CKEY_ROOT}/src/ckey_codec.cpp"
17 "${CKEY_ROOT}/src/ckey_scan.cpp"
18 "${CKEY_ROOT}/src/ckey_render.cpp"
19 "${CKEY_ROOT}/src/telemetry.cpp"
20 "${CMAKE_CURRENT_SOURCE_DIR}/src/ckey_web.cpp")
21# Optical certification (ABI 4 cores) is bound when the core ships it.
22if(EXISTS "${CKEY_ROOT}/src/ckey_certify.cpp")
23 list(APPEND CKEY_WEB_SOURCES "${CKEY_ROOT}/src/ckey_certify.cpp")
24endif()
25
26add_executable(ckey-core ${CKEY_WEB_SOURCES})
27target_compile_features(ckey-core PRIVATE cxx_std_20)
28target_include_directories(ckey-core PRIVATE "${CKEY_ROOT}/include" "${CKEY_ROOT}/src")
29# Each core library compiles only the shared internals it calls.
30target_compile_options(ckey-core PRIVATE -O3 -Wno-unused-function)
31set_target_properties(ckey-core PROPERTIES SUFFIX ".mjs")
32target_link_options(ckey-core PRIVATE
33 -O3
34 -sMODULARIZE=1
35 -sEXPORT_ES6=1
36 -sEXPORT_NAME=createCKeyCore
37 -sFILESYSTEM=0
38 -sALLOW_MEMORY_GROWTH=1
39 -sENVIRONMENT=web,worker,node
40 -sEXPORTED_RUNTIME_METHODS=HEAPU8
41 -sDYNAMIC_EXECUTION=0
42 -sSTACK_SIZE=2097152
43 -sINITIAL_MEMORY=33554432)