pcbjam/wasm/cmake/FindKiplatformWASM.cmake
Viktor Vaczi 3034d9d76f Add KiCad WASM build infrastructure and dependency scripts
- Add build environment setup (scripts/common/env.sh, versions.sh, functions.sh)
- Add dependency build scripts for Zstd, GLM, FreeType, HarfBuzz, Pixman, Cairo
- Add placeholder scripts for OpenCASCADE, ngspice, protobuf
- Add WASM compatibility layer (wasm/kiplatform/, wasm/libcontext/)
- Add CMake modules for KiCad WASM cross-compilation
- Add PCBnew test infrastructure (tests/kicad/)
- Add build plan documentation

Successfully tested builds: Zstd 1.5.5, GLM 0.9.9.8, FreeType 2.13.2,
HarfBuzz 8.3.0, Pixman 0.42.2, Cairo 1.18.0

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 13:15:04 +01:00

49 lines
1.5 KiB
CMake

# FindKiplatformWASM.cmake
# Find module for WASM implementation of kiplatform
#
# This module is used instead of the platform-specific kiplatform
# when building KiCad for WebAssembly.
#
# This module defines:
# KIPLATFORM_FOUND - System has kiplatform for WASM
# KIPLATFORM_INCLUDE_DIRS - Include directories
# KIPLATFORM_LIBRARIES - Libraries to link
# KIPLATFORM_SOURCES - Source files to compile
include(FindPackageHandleStandardArgs)
if(NOT EMSCRIPTEN)
message(FATAL_ERROR "FindKiplatformWASM is only for Emscripten builds")
endif()
# Get the directory containing this file
get_filename_component(_FIND_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(KIPLATFORM_WASM_DIR "${_FIND_DIR}/../kiplatform" ABSOLUTE)
# Define source files
set(KIPLATFORM_SOURCES
${KIPLATFORM_WASM_DIR}/app.cpp
${KIPLATFORM_WASM_DIR}/drivers.cpp
${KIPLATFORM_WASM_DIR}/environment.cpp
${KIPLATFORM_WASM_DIR}/io.cpp
${KIPLATFORM_WASM_DIR}/policy.cpp
${KIPLATFORM_WASM_DIR}/secrets.cpp
${KIPLATFORM_WASM_DIR}/sysinfo.cpp
${KIPLATFORM_WASM_DIR}/ui.cpp
)
# Include directory for platform headers
# We use KiCad's own headers, just provide our implementation
set(KIPLATFORM_INCLUDE_DIRS ${KIPLATFORM_WASM_DIR})
# No prebuilt library - sources are compiled directly into KiCad
set(KIPLATFORM_LIBRARIES "")
# Mark as found
set(KIPLATFORM_FOUND TRUE)
find_package_handle_standard_args(KiplatformWASM
REQUIRED_VARS KIPLATFORM_SOURCES KIPLATFORM_INCLUDE_DIRS
)
mark_as_advanced(KIPLATFORM_SOURCES KIPLATFORM_INCLUDE_DIRS KIPLATFORM_LIBRARIES)