diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1294803..ffe90a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -251,6 +251,7 @@ jobs: cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY git submodule update --init tools/boostdep python3 tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + python3 libs/assert/tools/setup_boost_with_modules.py # Temporary ./bootstrap.sh ./b2 -d0 headers @@ -306,6 +307,7 @@ jobs: xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\ git submodule update --init tools/boostdep python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY% + python libs/assert/tools/setup_boost_with_modules.py # Temporary cmd /c bootstrap b2 -d0 headers @@ -351,6 +353,7 @@ jobs: cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY git submodule update --init tools/boostdep python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + python libs/assert/tools/setup_boost_with_modules.py # Temporary - name: Use library with add_subdirectory run: | @@ -396,6 +399,7 @@ jobs: cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY git submodule update --init tools/boostdep python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + python libs/assert/tools/setup_boost_with_modules.py # Temporary - name: Configure run: | @@ -451,6 +455,7 @@ jobs: cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY git submodule update --init tools/boostdep python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + python libs/assert/tools/setup_boost_with_modules.py # Temporary - name: Configure run: | @@ -499,6 +504,7 @@ jobs: xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\ git submodule update --init tools/boostdep python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY% + python libs/assert/tools/setup_boost_with_modules.py # Temporary - name: Use library with add_subdirectory (Debug) shell: cmd @@ -547,6 +553,7 @@ jobs: xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\ git submodule update --init tools/boostdep python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY% + python libs/assert/tools/setup_boost_with_modules.py # Temporary - name: Configure shell: cmd @@ -613,6 +620,7 @@ jobs: xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\ git submodule update --init tools/boostdep python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY% + python libs/assert/tools/setup_boost_with_modules.py # Temporary - name: Configure shell: cmd @@ -644,3 +652,383 @@ jobs: run: | cd ../boost-root/__build__ ctest --output-on-failure --no-tests=error -C Release + + posix-cmake-subdir-modules: + strategy: + fail-fast: false + matrix: + include: + - name: "clang-21 Debug" + packages: "clang-21 libc++-21-dev" + cmake-args: "-DCMAKE_CXX_COMPILER=clang++-21 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-21/lib/libc++.modules.json -DCMAKE_BUILD_TYPE=Debug" + - name: "clang-21 Release" + packages: "clang-21 libc++-21-dev" + cmake-args: "-DCMAKE_CXX_COMPILER=clang++-21 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-21/lib/libc++.modules.json -DCMAKE_BUILD_TYPE=Release" + - name: "gcc-15 Debug" + packages: "g++-15" + cmake-args: "-DCMAKE_CXX_COMPILER=g++-15 -DCMAKE_BUILD_TYPE=Debug" + + name: CMake subdir modules ${{ matrix.name }} + + + runs-on: ubuntu-latest + container: ubuntu:26.04 + + steps: + - uses: actions/checkout@v4 + + - name: Install packages + run: | + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y --no-install-recommends wget ninja-build git ca-certificates python3 python-is-python3 ${{ matrix.packages }} + ./tools/install-cmake.sh + + - name: Setup Boost + run: | + echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + LIBRARY=${GITHUB_REPOSITORY#*/} + echo LIBRARY: $LIBRARY + echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + echo GITHUB_BASE_REF: $GITHUB_BASE_REF + echo GITHUB_REF: $GITHUB_REF + REF=${GITHUB_BASE_REF:-$GITHUB_REF} + REF=${REF#refs/heads/} + echo REF: $REF + BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true + echo BOOST_BRANCH: $BOOST_BRANCH + cd .. + git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py $LIBRARY + python libs/assert/tools/setup_boost_with_modules.py # Temporary + + - name: Use library with add_subdirectory + run: | + cd ../boost-root/libs/$LIBRARY/test/cmake_subdir_test + mkdir __build__ && cd __build__ + cmake \ + -G Ninja \ + -DCMAKE_CXX_STANDARD=23 \ + -DBUILD_TESTING=ON \ + -DBOOST_INCLUDE_LIBRARIES=$LIBRARY \ + -DBOOST_USE_MODULES=ON \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ + ${{ matrix.cmake-args }} \ + .. + cmake --build . + ctest --output-on-failure --no-tests=error + + posix-cmake-install-modules: + strategy: + fail-fast: false + matrix: + include: + - name: "clang-21 Debug" + packages: "clang-21 libc++-21-dev" + cmake-args: "-DCMAKE_CXX_COMPILER=clang++-21 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-21/lib/libc++.modules.json -DCMAKE_BUILD_TYPE=Debug" + - name: "clang-21 Release" + packages: "clang-21 libc++-21-dev" + cmake-args: "-DCMAKE_CXX_COMPILER=clang++-21 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-21/lib/libc++.modules.json -DCMAKE_BUILD_TYPE=Release" + - name: "gcc-15 Debug" + packages: "g++-15" + cmake-args: "-DCMAKE_CXX_COMPILER=g++-15 -DCMAKE_BUILD_TYPE=Debug" + + name: CMake install modules ${{ matrix.name }} + + runs-on: ubuntu-latest + container: ubuntu:26.04 + + steps: + - uses: actions/checkout@v4 + + - name: Install packages + run: | + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y --no-install-recommends wget ninja-build git ca-certificates python3 python-is-python3 ${{ matrix.packages }} + ./tools/install-cmake.sh + + - name: Setup Boost + run: | + echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + LIBRARY=${GITHUB_REPOSITORY#*/} + echo LIBRARY: $LIBRARY + echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + echo GITHUB_BASE_REF: $GITHUB_BASE_REF + echo GITHUB_REF: $GITHUB_REF + REF=${GITHUB_BASE_REF:-$GITHUB_REF} + REF=${REF#refs/heads/} + echo REF: $REF + BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true + echo BOOST_BRANCH: $BOOST_BRANCH + cd .. + git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py $LIBRARY + python libs/assert/tools/setup_boost_with_modules.py # Temporary + + - name: Configure + run: | + cd ../boost-root + mkdir __build__ && cd __build__ + cmake \ + -G Ninja \ + -DCMAKE_CXX_STANDARD=23 \ + -DBOOST_INCLUDE_LIBRARIES=$LIBRARY \ + -DCMAKE_INSTALL_PREFIX=~/.local \ + -DBOOST_USE_MODULES=ON \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ + ${{ matrix.cmake-args }} \ + .. + + - name: Install + run: | + cd ../boost-root/__build__ + cmake --build . --target install + + - name: Use the installed library + run: | + cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__ + cmake \ + -G Ninja \ + -DCMAKE_CXX_STANDARD=23 \ + -DCMAKE_INSTALL_PREFIX=~/.local \ + -DBOOST_USE_MODULES=ON \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ + ${{ matrix.cmake-args }} \ + .. + cmake --build . + ctest --output-on-failure --no-tests=error + + posix-cmake-test-modules: + strategy: + fail-fast: false + matrix: + include: + - name: "clang-21 Debug" + packages: "clang-21 libc++-21-dev" + cmake-args: "-DCMAKE_CXX_COMPILER=clang++-21 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-21/lib/libc++.modules.json -DCMAKE_BUILD_TYPE=Debug" + - name: "clang-21 Release" + packages: "clang-21 libc++-21-dev" + cmake-args: "-DCMAKE_CXX_COMPILER=clang++-21 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-21/lib/libc++.modules.json -DCMAKE_BUILD_TYPE=Release" + - name: "gcc-15 Debug" + packages: "g++-15" + cmake-args: "-DCMAKE_CXX_COMPILER=g++-15 -DCMAKE_BUILD_TYPE=Debug" + + name: CMake test modules ${{ matrix.name }} + + runs-on: ubuntu-latest + container: ubuntu:26.04 + + steps: + - uses: actions/checkout@v4 + + - name: Install packages + run: | + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y --no-install-recommends wget ninja-build git ca-certificates python3 python-is-python3 ${{ matrix.packages }} + ./tools/install-cmake.sh + + - name: Setup Boost + run: | + echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + LIBRARY=${GITHUB_REPOSITORY#*/} + echo LIBRARY: $LIBRARY + echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + echo GITHUB_BASE_REF: $GITHUB_BASE_REF + echo GITHUB_REF: $GITHUB_REF + REF=${GITHUB_BASE_REF:-$GITHUB_REF} + REF=${REF#refs/heads/} + echo REF: $REF + BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true + echo BOOST_BRANCH: $BOOST_BRANCH + cd .. + git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py $LIBRARY + python libs/assert/tools/setup_boost_with_modules.py # Temporary + + - name: Configure + run: | + cd ../boost-root + mkdir __build__ && cd __build__ + cmake \ + -G Ninja \ + -DCMAKE_CXX_STANDARD=23 \ + -DBOOST_INCLUDE_LIBRARIES=$LIBRARY \ + -DBUILD_TESTING=ON \ + -DBOOST_USE_MODULES=ON \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ + ${{ matrix.cmake-args }} \ + .. + + - name: Build tests + run: | + cd ../boost-root/__build__ + cmake --build . --target tests + + - name: Run tests + run: | + cd ../boost-root/__build__ + ctest --output-on-failure --no-tests=error + + windows-cmake-subdir-modules: + runs-on: windows-2022 + + steps: + - uses: actions/checkout@v4 + + - name: Install packages + run: choco install --no-progress ninja + + - name: Setup Boost + shell: cmd + run: | + echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY% + for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi + echo LIBRARY: %LIBRARY% + echo LIBRARY=%LIBRARY%>>%GITHUB_ENV% + echo GITHUB_BASE_REF: %GITHUB_BASE_REF% + echo GITHUB_REF: %GITHUB_REF% + if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF% + set BOOST_BRANCH=develop + for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master + echo BOOST_BRANCH: %BOOST_BRANCH% + cd .. + git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\ + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY% + python libs/assert/tools/setup_boost_with_modules.py # Temporary + + - name: Use library with add_subdirectory + shell: cmd + run: | + call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64 + cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test + mkdir __build__ && cd __build__ + cmake -DBOOST_USE_MODULES=1 -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja .. + cmake --build . + ctest --output-on-failure --no-tests=error + + windows-cmake-install-modules: + runs-on: windows-2022 + + steps: + - uses: actions/checkout@v4 + + - name: Install packages + run: choco install --no-progress ninja + + - name: Setup Boost + shell: cmd + run: | + echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY% + for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi + echo LIBRARY: %LIBRARY% + echo LIBRARY=%LIBRARY%>>%GITHUB_ENV% + echo GITHUB_BASE_REF: %GITHUB_BASE_REF% + echo GITHUB_REF: %GITHUB_REF% + if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF% + set BOOST_BRANCH=develop + for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master + echo BOOST_BRANCH: %BOOST_BRANCH% + cd .. + git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\ + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY% + python libs/assert/tools/setup_boost_with_modules.py # Temporary + + - name: Configure + shell: cmd + run: | + call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64 + cd ../boost-root + mkdir __build__ && cd __build__ + cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix -DBOOST_USE_MODULES=1 -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja .. + + - name: Install + shell: cmd + run: | + call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64 + cd ../boost-root/__build__ + cmake --build . --target install + + - name: Use the installed library + shell: cmd + run: | + call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64 + cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test && mkdir __build__ && cd __build__ + cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja .. + cmake --build . + ctest --output-on-failure --no-tests=error + + windows-cmake-test-modules: + strategy: + fail-fast: false + matrix: + include: + - cmake-build-type: Debug + - cmake-build-type: Release + + runs-on: windows-2022 + + steps: + - uses: actions/checkout@v4 + + - name: Install packages + run: choco install --no-progress ninja + + - name: Setup Boost + shell: cmd + run: | + echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY% + for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi + echo LIBRARY: %LIBRARY% + echo LIBRARY=%LIBRARY%>>%GITHUB_ENV% + echo GITHUB_BASE_REF: %GITHUB_BASE_REF% + echo GITHUB_REF: %GITHUB_REF% + if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF% + set BOOST_BRANCH=develop + for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master + echo BOOST_BRANCH: %BOOST_BRANCH% + cd .. + git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\ + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY% + python libs/assert/tools/setup_boost_with_modules.py # Temporary + + - name: Configure + shell: cmd + run: | + call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64 + cd ../boost-root + mkdir __build__ && cd __build__ + cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DBUILD_TESTING=ON -DBOOST_USE_MODULES=1 -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -DCMAKE_BUILD_TYPE=${{matrix.cmake-build-type}} -G Ninja .. + + - name: Build tests + shell: cmd + run: | + call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64 + cd ../boost-root/__build__ + cmake --build . --target tests + + - name: Run tests + shell: cmd + run: | + call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64 + cd ../boost-root/__build__ + ctest --output-on-failure --no-tests=error diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b33422..d96c594 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,10 @@ target_link_libraries(boost_assert Boost::config ) +if (BOOST_USE_MODULES) + target_compile_definitions(boost_assert INTERFACE BOOST_USE_MODULES) +endif() + # Add headers and .natvis to project, for better IDE integration if(NOT CMAKE_VERSION VERSION_LESS 3.19) diff --git a/include/boost/assert.hpp b/include/boost/assert.hpp index 48c9bcc..f997155 100644 --- a/include/boost/assert.hpp +++ b/include/boost/assert.hpp @@ -29,6 +29,14 @@ // BOOST_ASSERT, BOOST_ASSERT_MSG, BOOST_ASSERT_IS_VOID // +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_ASSERT) +# error "Please #include in your module global fragment" +#endif + +// Don't include the file again in module purviews +#ifndef BOOST_IN_MODULE_PURVIEW + #undef BOOST_ASSERT #undef BOOST_ASSERT_MSG #undef BOOST_ASSERT_IS_VOID @@ -88,4 +96,6 @@ namespace boost # define BOOST_VERIFY(expr) BOOST_ASSERT(expr) # define BOOST_VERIFY_MSG(expr, msg) BOOST_ASSERT_MSG(expr,msg) +#endif // BOOST_IN_MODULE_PURVIEW + #endif diff --git a/include/boost/assert/source_location.hpp b/include/boost/assert/source_location.hpp index 3c2d60e..b83a66d 100644 --- a/include/boost/assert/source_location.hpp +++ b/include/boost/assert/source_location.hpp @@ -1,3 +1,8 @@ +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED #define BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED @@ -9,16 +14,16 @@ #include #include -#include -#include -#include +#include +#include +#include #if !defined(BOOST_NO_IOSTREAM) -#include +#include #endif #if defined(__cpp_lib_source_location) && __cpp_lib_source_location >= 201907L -# include +# include #endif namespace boost diff --git a/include/boost/current_function.hpp b/include/boost/current_function.hpp index 731d1b1..7ea8b42 100644 --- a/include/boost/current_function.hpp +++ b/include/boost/current_function.hpp @@ -1,3 +1,8 @@ +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CURRENT_FUNCTION_HPP_INCLUDED) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED #define BOOST_CURRENT_FUNCTION_HPP_INCLUDED diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8703c22..d90982c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,6 +6,10 @@ include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) if(HAVE_BOOST_TEST) +if(BOOST_USE_MODULES) + set(CMAKE_CXX_MODULE_STD ON) +endif() + boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::assert Boost::core) endif() diff --git a/test/assert_msg_test2.cpp b/test/assert_msg_test2.cpp index f079e15..4e097c9 100644 --- a/test/assert_msg_test2.cpp +++ b/test/assert_msg_test2.cpp @@ -9,7 +9,7 @@ // #include -#include +#include // default case, !NDEBUG // BOOST_ASSERT_MSG(x) -> assert(x) diff --git a/test/assert_test.cpp b/test/assert_test.cpp index 5e440f5..a36d6f4 100644 --- a/test/assert_test.cpp +++ b/test/assert_test.cpp @@ -72,7 +72,7 @@ void test_disabled() #define BOOST_ENABLE_ASSERT_HANDLER #include #include -#include +#include int handler_invoked = 0; int msg_handler_invoked = 0; diff --git a/test/assert_test2.cpp b/test/assert_test2.cpp index 9879ecb..2e36661 100644 --- a/test/assert_test2.cpp +++ b/test/assert_test2.cpp @@ -9,7 +9,7 @@ // #include -#include +#include // default case, !NDEBUG // BOOST_ASSERT(x) -> assert(x) diff --git a/test/check_cmake_version.cpp b/test/check_cmake_version.cpp index 2fd4648..708f7ce 100644 --- a/test/check_cmake_version.cpp +++ b/test/check_cmake_version.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include int main( int ac, char const* av[] ) { diff --git a/test/current_function_test.cpp b/test/current_function_test.cpp index c664696..c265321 100644 --- a/test/current_function_test.cpp +++ b/test/current_function_test.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include void message(char const * file, long line, char const * func, char const * msg) { diff --git a/test/current_function_test2.cpp b/test/current_function_test2.cpp index e3c2523..484a9ac 100644 --- a/test/current_function_test2.cpp +++ b/test/current_function_test2.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include int f() { diff --git a/test/exp/assert_exp_test.cpp b/test/exp/assert_exp_test.cpp index c56cdef..61c8903 100644 --- a/test/exp/assert_exp_test.cpp +++ b/test/exp/assert_exp_test.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include // Each backslash in __FILE__ when passed through BOOST_STRINGIZE is doubled static std::string quote( std::string const & s ) diff --git a/test/exp/assert_msg_exp_test.cpp b/test/exp/assert_msg_exp_test.cpp index faff616..4b96068 100644 --- a/test/exp/assert_msg_exp_test.cpp +++ b/test/exp/assert_msg_exp_test.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include // Each backslash in __FILE__ when passed through BOOST_STRINGIZE is doubled static std::string quote( std::string const & s ) diff --git a/test/exp/verify_exp_test.cpp b/test/exp/verify_exp_test.cpp index 844513b..13c0be5 100644 --- a/test/exp/verify_exp_test.cpp +++ b/test/exp/verify_exp_test.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include // default case, !NDEBUG // BOOST_VERIFY(x) -> BOOST_ASSERT(x) diff --git a/test/exp/verify_msg_exp_test.cpp b/test/exp/verify_msg_exp_test.cpp index 02090fe..4047860 100644 --- a/test/exp/verify_msg_exp_test.cpp +++ b/test/exp/verify_msg_exp_test.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include // default case, !NDEBUG // BOOST_VERIFY_MSG(x,"m") -> BOOST_ASSERT_MSG(x,"m") diff --git a/test/source_location_test.cpp b/test/source_location_test.cpp index e3e7311..1ecde1f 100644 --- a/test/source_location_test.cpp +++ b/test/source_location_test.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include static char const* adjust_filename( char const* file ) { diff --git a/test/source_location_test3.cpp b/test/source_location_test3.cpp index 810c3ee..8f218b9 100644 --- a/test/source_location_test3.cpp +++ b/test/source_location_test3.cpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include static char const* adjust_filename( char const* file ) { diff --git a/test/source_location_test4.cpp b/test/source_location_test4.cpp index 1242314..a0928a7 100644 --- a/test/source_location_test4.cpp +++ b/test/source_location_test4.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include static char const* adjust_filename( char const* file ) { diff --git a/test/source_location_test5.cpp b/test/source_location_test5.cpp index ef8a0dc..443d259 100644 --- a/test/source_location_test5.cpp +++ b/test/source_location_test5.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include template class result { diff --git a/test/verify_test.cpp b/test/verify_test.cpp index ea46d53..74f0b8d 100644 --- a/test/verify_test.cpp +++ b/test/verify_test.cpp @@ -67,7 +67,7 @@ void test_disabled() #define BOOST_ENABLE_ASSERT_HANDLER #include #include -#include +#include int handler_invoked = 0; diff --git a/tools/install-cmake.sh b/tools/install-cmake.sh new file mode 100755 index 0000000..d2fd0bb --- /dev/null +++ b/tools/install-cmake.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# +# Copyright (c) 2026 Ruben Perez Hidalgo (rubenperez038 at gmail dot com) +# +# 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) +# + +set -e + +wget https://github.com/Kitware/CMake/releases/download/v4.2.3/cmake-4.2.3-linux-x86_64.tar.gz +tar -xf cmake-4.2.3-linux-x86_64.tar.gz +mv cmake-4.2.3-linux-x86_64 /opt/cmake +update-alternatives --install /usr/bin/cmake cmake /opt/cmake/bin/cmake 100 +update-alternatives --install /usr/bin/ctest ctest /opt/cmake/bin/ctest 100 diff --git a/tools/setup_boost_with_modules.py b/tools/setup_boost_with_modules.py new file mode 100644 index 0000000..8a43d61 --- /dev/null +++ b/tools/setup_boost_with_modules.py @@ -0,0 +1,28 @@ +#!/usr/bin/python3 + +# This is a temporary workaround to make CIs use the +# "Boost with C++20 modules" proposal, instead of the regular develop branch +# Call it instead of depinst + +from subprocess import run +import os + +def main(): + + submodules = [ + ('tools/cmake', 'https://github.com/anarthal/boost-cmake'), + ('libs/core', 'https://github.com/anarthal/core'), + ('libs/throw_exception','https://github.com/anarthal/throw_exception'), + ('libs/config', 'https://github.com/anarthal/config'), + ] + + for submodule, url in submodules: + os.chdir(submodule) + run(['git', 'remote', 'add', 'modules', url]) + run(['git', 'fetch', '--depth', '1', 'modules', 'feature/cxx20-modules']) + run(['git', 'checkout', 'modules/feature/cxx20-modules']) + os.chdir('../..') + + +if __name__ == '__main__': + main()