Introduce BOOST_SOURCE_ROOT for out-of-tree Boost sources

This commit is contained in:
yulya3102 2025-02-02 22:51:23 +01:00
parent 805826c160
commit 8f32d814c8
2 changed files with 9 additions and 1 deletions

View file

@ -2,7 +2,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL Emscripten)
set(BOOST_INCLUDE_LIBRARIES random stacktrace math)
set(BOOST_ENABLE_COMPATIBILITY_TARGETS 1)
add_compile_options(-fdeclspec) # math doesn't build otherwise
add_subdirectory(boost EXCLUDE_FROM_ALL)
# Use out-of-tree sources for boost, since we can't use pre-built
# libraries for the web build
if(BOOST_SOURCE_ROOT)
add_subdirectory(${BOOST_SOURCE_ROOT} boost EXCLUDE_FROM_ALL)
else()
message(FATAL_ERROR "For web builds BOOST_SOURCE_ROOT must be provided")
endif()
# TODO: make this available via find_package so we wouldn't have to
# special-case it in every library

View file

@ -13,6 +13,7 @@ rm -rf ./*
# Use emsdk wrapper for cmake - it sets some env variables to select the
# right toolchain.
emcmake cmake \
-DBOOST_SOURCE_ROOT=$(realpath ../source)/psemek/3rdparty/boost \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPSEMEK_PACKAGE_MODE=ON \
-DPSEMEK_PACKAGE_HOST=OFF \