From eb7ff254b81b6a4d3fd0012a9691e91c8591d312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Ferdinand=20Rivera=20Morell?= Date: Thu, 26 Jun 2025 09:24:28 -0500 Subject: [PATCH] Add support for modular build structure. (#64) * Make the library modular usable. * Fix to avoid using gcc/clang option in other compilers. * Switch to library requirements instead of source. As source puts extra source in install targets. * Change global boost refs to local refs. * Add requires-b2 check to top-level build file. * Add missing test deps. * Fix library name in lib declaration. * Bump B2 require to 5.2 * Update copyright dates. * Move inter-lib dependencies to a project variable and into the build targets. * Adjust self dependencies as inter-lib deps no longer apply globally. * Kludge node20 into containers. * Checkout needs to happen after node20 is set up. * Rewrite GHA CI to use alandefreitas/cpp-actions utilities. * Fix GHA CI matrix evaluation value. * Need to copy tested lib to boost-root. * Tweak copy-library step to work on Windows bash. * Move library name to matrix variable instead of env var. * Add test dir to scan to fill missing deps. * Clear out library dir to be able to copy in workspace tree. * Avoid the boost tree cache for testing the scanning. * Remove CI debug listing. * Tweak factors to reduce over-builds. * Try and coax more msvc testing. * Move project global include to target local include. * Only msvc gets minor version tests. * Revert GHA CI changes. * Less impactful update of CI. * Bump gcc-11 container and be explicit about the exe to try and make it findable. * Be explicit about compiler gcc commands. * Undo compiler spec change. --- .github/workflows/ci.yml | 72 ++++++++++++++++++++++++++-------------- build.jam | 41 +++++++++++++++++++++++ doc/Jamfile.v2 | 28 ++++++++-------- example/Jamfile.v2 | 8 ++--- test/Jamfile.v2 | 8 ++--- 5 files changed, 110 insertions(+), 47 deletions(-) create mode 100644 build.jam diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0dad7a..d28a629 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,22 +34,27 @@ jobs: install: g++-6 - toolset: gcc-7 cxxstd: "11,14,17" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 install: g++-7 - toolset: gcc-8 cxxstd: "11,14,17,2a" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 install: g++-8 - toolset: gcc-9 cxxstd: "11,14,17,2a" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 - toolset: gcc-10 cxxstd: "11,14,17,2a" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 install: g++-10 - toolset: gcc-11 cxxstd: "11,14,17,2a" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:24.04 install: g++-11 - toolset: gcc-12 cxxstd: "11,14,17,20,2b" @@ -58,7 +63,7 @@ jobs: - toolset: gcc-13 cxxstd: "11,14,17,20,2b" os: ubuntu-latest - container: ubuntu:23.04 + container: ubuntu:24.04 install: g++-13 - toolset: clang compiler: clang++-3.9 @@ -81,37 +86,44 @@ jobs: - toolset: clang compiler: clang++-6.0 cxxstd: "11,14,17" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 install: clang-6.0 - toolset: clang compiler: clang++-7 cxxstd: "11,14,17" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 install: clang-7 - toolset: clang compiler: clang++-8 cxxstd: "11,14,17" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 install: clang-8 - toolset: clang compiler: clang++-9 cxxstd: "11,14,17" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 install: clang-9 - toolset: clang compiler: clang++-10 cxxstd: "11,14,17,2a" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 install: clang-10 - toolset: clang compiler: clang++-11 cxxstd: "11,14,17,2a" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 install: clang-11 - toolset: clang compiler: clang++-12 cxxstd: "11,14,17,2a" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 install: clang-12 - toolset: clang compiler: clang++-13 @@ -131,39 +143,49 @@ jobs: - toolset: clang compiler: clang++-16 cxxstd: "11,14,17,20,2b" - os: ubuntu-latest - container: ubuntu:23.04 + os: ubuntu-24.04 install: clang-16 - - toolset: clang - cxxstd: "11,14,17,2a" - os: macos-11 - - toolset: clang - cxxstd: "11,14,17,20,2b" - os: macos-12 - toolset: clang cxxstd: "11,14,17,20,2b" os: macos-13 + - toolset: clang + cxxstd: "11,14,17,20,2b" + os: macos-14 + - toolset: clang + cxxstd: "11,14,17,20,2b" + os: macos-15 runs-on: ${{matrix.os}} - container: ${{matrix.container}} + container: + image: ${{matrix.container}} + volumes: + - /node20217:/node20217:rw,rshared + - ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }} defaults: run: shell: bash steps: - - uses: actions/checkout@v3 - - name: Setup container environment if: matrix.container run: | apt-get update - apt-get -y install sudo python3 git g++ + apt-get -y install sudo python3 git g++ curl xz-utils + + - name: Install nodejs20glibc2.17 + if: ${{ startsWith( matrix.container, 'ubuntu:1' ) }} + run: | + curl -LO https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz + tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217 + ldd /__e/node20/bin/node - name: Install packages if: matrix.install run: sudo apt-get -y install ${{matrix.install}} + - uses: actions/checkout@v3 + - name: Setup Boost run: | echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY diff --git a/build.jam b/build.jam new file mode 100644 index 0000000..5ccb142 --- /dev/null +++ b/build.jam @@ -0,0 +1,41 @@ +# Copyright René Ferdinand Rivera Morell 2023-2024 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +require-b2 5.2 ; + +constant boost_dependencies : + /boost/array//boost_array + /boost/assert//boost_assert + /boost/circular_buffer//boost_circular_buffer + /boost/concept_check//boost_concept_check + /boost/config//boost_config + /boost/core//boost_core + /boost/fusion//boost_fusion + /boost/iterator//boost_iterator + /boost/mpl//boost_mpl + /boost/numeric_conversion//boost_numeric_conversion + /boost/ublas//boost_ublas + /boost/parameter//boost_parameter + /boost/preprocessor//boost_preprocessor + /boost/range//boost_range + /boost/serialization//boost_serialization + /boost/static_assert//boost_static_assert + /boost/throw_exception//boost_throw_exception + /boost/tuple//boost_tuple + /boost/type_traits//boost_type_traits + /boost/typeof//boost_typeof ; + +project /boost/accumulators + ; + +explicit + [ alias boost_accumulators : : : + : include $(boost_dependencies) ] + [ alias all : boost_accumulators example test ] + ; + +call-if : boost-library accumulators + ; + diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 65c0053..42fc231 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -52,8 +52,8 @@ else # features shows the dependency relationships between them. doxygen tagfile : - ../../../boost/accumulators/framework/depends_on.hpp - ../../../boost/accumulators/framework/extractor.hpp + ../include/boost/accumulators/framework/depends_on.hpp + ../include/boost/accumulators/framework/extractor.hpp : MACRO_EXPANSION=YES EXPAND_ONLY_PREDEF=YES @@ -68,10 +68,10 @@ doxygen tagfile doxygen accdoc : - [ glob ../../../boost/accumulators/accumulators*.hpp ] - [ glob ../../../boost/accumulators/framework/*.hpp ] - [ glob ../../../boost/accumulators/framework/parameters/*.hpp ] - [ glob ../../../boost/accumulators/framework/accumulators/*.hpp ] + [ glob ../include/boost/accumulators/accumulators*.hpp ] + [ glob ../include/boost/accumulators/framework/*.hpp ] + [ glob ../include/boost/accumulators/framework/parameters/*.hpp ] + [ glob ../include/boost/accumulators/framework/accumulators/*.hpp ] : EXTRACT_ALL=YES "PREDEFINED=\"BOOST_ACCUMULATORS_DOXYGEN_INVOKED=1\" \\ @@ -97,9 +97,9 @@ doxygen accdoc # generate .png images for the LaTeX formulas embedded in the doc comments. doxygen statsdoc.html : - [ glob ../../../boost/accumulators/statistics*.hpp ] - [ glob ../../../boost/accumulators/statistics/*.hpp ] - [ glob ../../../boost/accumulators/statistics/variates/*.hpp ] + [ glob ../include/boost/accumulators/statistics*.hpp ] + [ glob ../include/boost/accumulators/statistics/*.hpp ] + [ glob ../include/boost/accumulators/statistics/variates/*.hpp ] : latex.check dvips.check @@ -141,9 +141,9 @@ make statsdoclatex.tag doxygen statsdoc : - [ glob ../../../boost/accumulators/statistics*.hpp ] - [ glob ../../../boost/accumulators/statistics/*.hpp ] - [ glob ../../../boost/accumulators/statistics/variates/*.hpp ] + [ glob ../include/boost/accumulators/statistics*.hpp ] + [ glob ../include/boost/accumulators/statistics/*.hpp ] + [ glob ../include/boost/accumulators/statistics/variates/*.hpp ] : EXTRACT_ALL=YES "PREDEFINED=\"BOOST_ACCUMULATORS_DOXYGEN_INVOKED=1\" \\ @@ -171,8 +171,8 @@ doxygen statsdoc doxygen opdoc : - [ glob ../../../boost/accumulators/numeric/functional.hpp ] - [ glob ../../../boost/accumulators/numeric/functional/*.hpp ] + [ glob ../include/boost/accumulators/numeric/functional.hpp ] + [ glob ../include/boost/accumulators/numeric/functional/*.hpp ] : EXTRACT_ALL=YES "PREDEFINED=\"BOOST_NUMERIC_FUNCTIONAL_DOXYGEN_INVOKED=1\" \\ diff --git a/example/Jamfile.v2 b/example/Jamfile.v2 index eff105b..c02911e 100644 --- a/example/Jamfile.v2 +++ b/example/Jamfile.v2 @@ -6,8 +6,8 @@ exe example : main.cpp : - ../../.. - $(BOOST_ROOT) - /boost/serialization - "-Wno-deprecated-declarations" + /boost/accumulators//boost_accumulators + /boost/foreach//boost_foreach + gcc:"-Wno-deprecated-declarations" + clang:"-Wno-deprecated-declarations" ; diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 4770113..48d0d46 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -19,8 +19,9 @@ project : default-build static : requirements - /boost/test//boost_unit_test_framework - ../../.. + /boost/accumulators//boost_accumulators + /boost/test//boost_unit_test_framework/static + /boost/random//boost_random msvc:_SCL_SECURE_NO_DEPRECATE # MSVC's iterator debugging causes some tests to run forever. msvc:off @@ -28,7 +29,6 @@ project gcc:"-Wno-deprecated-declarations" clang:"-Wno-deprecated-declarations" intel-linux:"-Wno-deprecated-declarations" - /boost/serialization ; alias accumulators_regular_tests @@ -57,7 +57,7 @@ alias accumulators_regular_tests [ run skewness.cpp ] [ run sum.cpp ] [ run sum_kahan.cpp ] - [ run tail.cpp ] + [ run tail.cpp : : : /boost/foreach//boost_foreach ] [ run tail_mean.cpp ] [ run tail_quantile.cpp ] [ run variance.cpp ]