32 lines
1.3 KiB
CMake
32 lines
1.3 KiB
CMake
# WebAssembly (Emscripten) toolchain hook — STUB for Phase 0.
|
|
#
|
|
# The Phase 0 "WASM hello-world" task is validation-only and must NOT block
|
|
# Phase 1 (Rule R5). This file exists so the integration point is real; the
|
|
# full WASM build (PDFium + Skia + FreeType + HarfBuzz compiled together) is
|
|
# Phase 2 work.
|
|
#
|
|
# It chain-loads the real Emscripten toolchain from the active EMSDK, then lets
|
|
# vcpkg layer on top. Used by the `wasm` configure preset.
|
|
|
|
if(NOT DEFINED ENV{EMSDK})
|
|
message(FATAL_ERROR
|
|
"WASM build requested but EMSDK is not set in the environment.\n"
|
|
"Install and activate the Emscripten SDK:\n"
|
|
" git clone https://github.com/emscripten-core/emsdk\n"
|
|
" ./emsdk install latest && ./emsdk activate latest\n"
|
|
" source ./emsdk_env.sh (or emsdk_env.bat on Windows)\n"
|
|
"Then re-run: cmake --preset wasm")
|
|
endif()
|
|
|
|
set(_emscripten_toolchain
|
|
"$ENV{EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake")
|
|
|
|
if(NOT EXISTS "${_emscripten_toolchain}")
|
|
message(FATAL_ERROR "Emscripten toolchain not found at: ${_emscripten_toolchain}")
|
|
endif()
|
|
|
|
include("${_emscripten_toolchain}")
|
|
|
|
# Engine blueprint §6.3: large PDFs can exceed the default WASM heap.
|
|
set(CMAKE_EXE_LINKER_FLAGS_INIT "-sALLOW_MEMORY_GROWTH=1")
|