Files
swift-mirror/cmake/caches/EmscriptenHostSwiftLLDShim.cmake
Max Desiatov 5cc48a1ff0 Add CMake for Emscripten-hosted compiler (#90334)
Added three cache files: one each for the cross-LLVM and the Swift
compiler, the third is a top-level include that pre-defines the lld
imported targets `find_package(Clang)` expects. Two existing CMake files
gain `SWIFT_HOST_VARIANT_SDK == EMSCRIPTEN` branches for the runtime
link and module include paths, which don't affect other hosts. The one
non-gated change wraps a `CROSSCOMPILE` swift-stdlib ordering dependency
in an existence check. It is a no-op unless that target is absent, which
happens only when building against a prebuilt stdlib.
2026-07-04 08:54:10 +01:00

17 lines
626 B
CMake

if(NOT SWIFT_EMSCRIPTEN_HOST_LLVM_LIB_DIR)
message(FATAL_ERROR
"SWIFT_EMSCRIPTEN_HOST_LLVM_LIB_DIR is not set. This top-level include "
"expects -DSWIFT_EMSCRIPTEN_HOST_LLVM_LIB_DIR=<emscriptenhostllvm>/lib, "
"pointing at the EmscriptenHostLLVM build's lib directory (the one "
"containing liblldWasm.a / liblldCommon.a).")
endif()
foreach(_lldlib lldWasm lldCommon)
if(NOT TARGET ${_lldlib})
add_library(${_lldlib} STATIC IMPORTED GLOBAL)
set_target_properties(${_lldlib} PROPERTIES
IMPORTED_LOCATION
"${SWIFT_EMSCRIPTEN_HOST_LLVM_LIB_DIR}/lib${_lldlib}.a")
endif()
endforeach()