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
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). |
| 7 | cmake_minimum_required(VERSION 3.20) |
| 8 | project(ckey_web LANGUAGES CXX) |
| 9 | |
| 10 | if(NOT EMSCRIPTEN) |
| 11 | message(FATAL_ERROR "sdk/web must be configured with emcmake (Emscripten); see scripts/build.sh") |
| 12 | endif() |
| 13 | |
| 14 | set(CKEY_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") |
| 15 | set(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. |
| 22 | if(EXISTS "${CKEY_ROOT}/src/ckey_certify.cpp") |
| 23 | list(APPEND CKEY_WEB_SOURCES "${CKEY_ROOT}/src/ckey_certify.cpp") |
| 24 | endif() |
| 25 | |
| 26 | add_executable(ckey-core ${CKEY_WEB_SOURCES}) |
| 27 | target_compile_features(ckey-core PRIVATE cxx_std_20) |
| 28 | target_include_directories(ckey-core PRIVATE "${CKEY_ROOT}/include" "${CKEY_ROOT}/src") |
| 29 | # Each core library compiles only the shared internals it calls. |
| 30 | target_compile_options(ckey-core PRIVATE -O3 -Wno-unused-function) |
| 31 | set_target_properties(ckey-core PROPERTIES SUFFIX ".mjs") |
| 32 | target_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) |