pcbjam/wasm/cmake/FindZLIB.cmake
Viktor Vaczi 9f4ed1e51e Add KiCad PCBnew WASM build support and documentation
Build infrastructure:
- Update build-pcbnew.sh with stub library compilation
- Update build-wxuniversal-wasm.sh with library symlinks and stubs
- Add stub libraries for libgit2 and curl (network ops via JS)
- Add WASM-specific CMake Find modules

Documentation:
- Add KICAD_WASM_BUILD.md with complete modification list
- Document 68 KiCad files modified for WASM support
- Document disabled features and reasons
- Document stub libraries and wxWidgets changes

Submodule updates:
- kicad: Add WASM/Emscripten build support (wasm-port branch)
- wxwidgets: Add KiCad compatibility fixes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 18:26:57 +01:00

38 lines
1.2 KiB
CMake

# FindZLIB.cmake - WASM builds use Emscripten's zlib port
# Emscripten provides zlib via -sUSE_ZLIB=1 flag
if(EMSCRIPTEN)
message(STATUS "Using Emscripten's zlib port (-sUSE_ZLIB=1)")
# Find the Emscripten cache sysroot
execute_process(
COMMAND em-config CACHE
OUTPUT_VARIABLE EMSCRIPTEN_CACHE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Set ZLIB variables
set(ZLIB_FOUND TRUE)
set(ZLIB_INCLUDE_DIR "${EMSCRIPTEN_CACHE}/sysroot/include")
set(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}")
# The library will be linked via -sUSE_ZLIB=1
# We set a placeholder for CMake checks
set(ZLIB_LIBRARY "-sUSE_ZLIB=1")
set(ZLIB_LIBRARIES "-sUSE_ZLIB=1")
set(ZLIB_VERSION_STRING "1.3.1")
# Create imported target
if(NOT TARGET ZLIB::ZLIB)
add_library(ZLIB::ZLIB INTERFACE IMPORTED)
set_target_properties(ZLIB::ZLIB PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "-sUSE_ZLIB=1"
)
endif()
mark_as_advanced(ZLIB_INCLUDE_DIR ZLIB_LIBRARY)
else()
# For non-WASM builds, use the system FindZLIB
include(${CMAKE_ROOT}/Modules/FindZLIB.cmake OPTIONAL)
endif()