From 3c1f44a42c6fb6d97f0d2e05fc6336943b861540 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Tue, 15 Sep 2026 18:05:32 +0500 Subject: [PATCH] cmake: require just 2 boost component by default `program_options`, `regex` Tested locally that build succeeds with all other components being header-only or unused by now. `regex` is only needed for Boost <1.76, see https://www.boost.org/releases/1.76.0/ --- .github/workflows/ci-ifcwrap-standalone.yml | 4 ---- .github/workflows/ci.yml | 4 ---- .github/workflows/release.yml | 4 ---- cmake/CMakeLists.txt | 14 ++++++++++---- cmake/IfcOpenShellConfig.cmake.in | 3 --- nix/build-all.py | 4 ---- win/build-deps.cmd | 2 +- win/installers.py | 3 --- 8 files changed, 11 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci-ifcwrap-standalone.yml b/.github/workflows/ci-ifcwrap-standalone.yml index 38e601b2d7..09a7585a36 100644 --- a/.github/workflows/ci-ifcwrap-standalone.yml +++ b/.github/workflows/ci-ifcwrap-standalone.yml @@ -37,13 +37,9 @@ jobs: bison \ gcc \ g++ \ - libboost-date-time-dev \ - libboost-filesystem-dev \ libboost-iostreams-dev \ libboost-program-options-dev \ libboost-regex-dev \ - libboost-system-dev \ - libboost-thread-dev \ libeigen3-dev \ libocct-data-exchange-dev \ libocct-draw-dev \ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1cb31a13bb..4d1e28b201 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,13 +80,9 @@ jobs: sudo apt-get install --no-install-recommends \ git cmake gcc g++ \ - libboost-date-time-dev \ - libboost-filesystem-dev \ libboost-iostreams-dev \ libboost-program-options-dev \ libboost-regex-dev \ - libboost-system-dev \ - libboost-thread-dev \ libpcre3-dev libxml2-dev \ libtbb-dev nlohmann-json3-dev \ libocct-foundation-dev libocct-modeling-algorithms-dev libocct-modeling-data-dev libocct-ocaf-dev libocct-visualization-dev libocct-data-exchange-dev \ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8f306c69e2..b77c9a17d0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,13 +25,9 @@ jobs: sudo apt update sudo apt-get install --no-install-recommends \ git cmake gcc g++ \ - libboost-date-time-dev \ - libboost-filesystem-dev \ libboost-iostreams-dev \ libboost-program-options-dev \ libboost-regex-dev \ - libboost-system-dev \ - libboost-thread-dev \ python3-all-dev python3-pip \ swig libpcre3-dev libxml2-dev \ libtbb-dev nlohmann-json3-dev \ diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 85910e6e75..71051a3c24 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -373,10 +373,12 @@ endif() if(WASM_BUILD) set(BOOST_COMPONENTS) else() - # @todo review this, shouldn't this be all possible header-only now? - # ... or rewritten using C++17 features? - # set(BOOST_COMPONENTS system program_options regex thread date_time iostreams) - set(BOOST_COMPONENTS program_options regex thread date_time iostreams) + set(BOOST_COMPONENTS "") + if(BUILD_IFCGEOM OR BUILD_CONVERT) + # TODO: drop `regex` once BOOST_MIN_VERSION >= 1.76, where its matcher engine + # became header-only (boostorg/regex@49e8067b) and no longer needs linking. + set(BOOST_COMPONENTS ${BOOST_COMPONENTS} program_options regex) + endif() endif() if(USE_MMAP) @@ -389,6 +391,10 @@ if(USE_MMAP) endif() find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS}) +# TODO: drop this whole `if` (and the `regex` component above) once BOOST_MIN_VERSION >= 1.76. +if(Boost_VERSION VERSION_GREATER_EQUAL 1.76) + list(REMOVE_ITEM Boost_LIBRARIES ${Boost_REGEX_LIBRARY} Boost::regex) +endif() # This is only needed for FindBoost, when libraries are just paths to the library files on the disk. # If Boost is found using cmake config, then all its Boost_LIBRARIES are targets # and automatically depend on the headers. diff --git a/cmake/IfcOpenShellConfig.cmake.in b/cmake/IfcOpenShellConfig.cmake.in index ddd7f87fbb..966882477d 100644 --- a/cmake/IfcOpenShellConfig.cmake.in +++ b/cmake/IfcOpenShellConfig.cmake.in @@ -30,11 +30,8 @@ if(NOT "${IFCOPENSHELL_BOOST_USE_MULTITHREADED}" STREQUAL "") set(Boost_USE_MULTITHREADED ${IFCOPENSHELL_BOOST_USE_MULTITHREADED}) endif() set(Boost_COMPONENTS - system program_options regex - thread - date_time iostreams ) find_dependency(Boost CONFIG COMPONENTS ${Boost_COMPONENTS}) diff --git a/nix/build-all.py b/nix/build-all.py index a6ad08afb6..3f0469605c 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -1519,13 +1519,9 @@ if "boost" in targets: mode="bjam", build_tool_args=[ f"--stagedir={Dependencies.get_install_dir('boost')}", - "--with-system", "--with-program_options", "--with-regex", - "--with-thread", - "--with-date_time", "--with-iostreams", - "--with-filesystem", # By default boost will keep ICU enabled, if it manages to find dev ICU dev package on the system. # Which then creates issues when during our executables packaging. # E.g. it ends up linking system's `libicudata.so.67`, so then we need to somehow detect and bundle diff --git a/win/build-deps.cmd b/win/build-deps.cmd index 754dd7a89f..bf80cb5378 100644 --- a/win/build-deps.cmd +++ b/win/build-deps.cmd @@ -421,7 +421,7 @@ if /I "%VS_PLATFORM%"=="x64" ( echo "Failed to identify architecture" GOTO :Error ) -set BOOST_LIBS=--with-system --with-regex --with-thread --with-program_options --with-date_time --with-iostreams --with-filesystem +set BOOST_LIBS=--with-regex --with-program_options --with-iostreams --with-filesystem :: NOTE Boost is fast to build with limited set of libraries so build it always. cd "%DEPENDENCY_DIR%" call cecho.cmd 0 13 "Building %DEPENDENCY_NAME% %BOOST_LIBS% Please be patient, this will take a while." diff --git a/win/installers.py b/win/installers.py index 7f272e5e20..e93d38be75 100644 --- a/win/installers.py +++ b/win/installers.py @@ -307,11 +307,8 @@ def install_boost( sys.exit(1) BOOST_LIBS = ( - "--with-system", "--with-program_options", "--with-regex", - "--with-thread", - "--with-date_time", "--with-iostreams", "--with-filesystem", )