From b5a1b38775913cc25c2914c9598f8f53117539ad Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Thu, 5 Mar 2026 18:53:53 +0000 Subject: [PATCH 1/8] add tests to ctest --- include/boost/pfr/config.hpp | 2 ++ modules/boost_pfr.cppm | 1 + test/cmake_subdir_test/CMakeLists.txt | 1 + 3 files changed, 4 insertions(+) diff --git a/include/boost/pfr/config.hpp b/include/boost/pfr/config.hpp index bd92fe5a..23649d38 100644 --- a/include/boost/pfr/config.hpp +++ b/include/boost/pfr/config.hpp @@ -8,6 +8,8 @@ #define BOOST_PFR_CONFIG_HPP #pragma once +#include + #if !defined(BOOST_USE_MODULES) && (__cplusplus >= 201402L || (defined(_MSC_VER) && defined(_MSVC_LANG) && _MSC_VER > 1900)) #include // to get non standard platform macro definitions (__GLIBCXX__ for example) #endif diff --git a/modules/boost_pfr.cppm b/modules/boost_pfr.cppm index 62482b28..80aee7cf 100644 --- a/modules/boost_pfr.cppm +++ b/modules/boost_pfr.cppm @@ -11,6 +11,7 @@ module; #include #include #include +#include #ifdef BOOST_PFR_USE_STD_MODULE import std; diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt index a0fb66c3..4684b7dc 100644 --- a/test/cmake_subdir_test/CMakeLists.txt +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -17,4 +17,5 @@ add_subdirectory(../../../mp11 boostorg/mp11) add_subdirectory(../../../throw_exception boostorg/throw_exception) add_subdirectory(../../../type_traits boostorg/type_traits) +enable_testing() add_subdirectory(../../ boostorg/pfr) From 44d427c0d1f48ea6d679dfc7843cc381986e4eb4 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Thu, 5 Mar 2026 18:54:11 +0000 Subject: [PATCH 2/8] enable tests in CI --- .github/workflows/ci.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f76df0a3..dc8754f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,19 +95,23 @@ jobs: rm -rf __build - name: Run modules tests - if: false - # if: ${{matrix.toolset == 'clang-19'}} + if: ${{matrix.toolset == 'clang-19'}} run: | cd ../boost-root/libs/pfr - mkdir build_module - cd build_module - cmake -DBUILD_TESTING=1 -DBOOST_USE_MODULES=1 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja ../test/cmake_subdir_test - cmake --build . - ctest -V - cd .. + cmake -S test/cmake_subdir_test -B build_module \ + -GNinja \ + -DBUILD_TESTING=1 \ + -DBOOST_USE_MODULES=1 \ + -DCMAKE_CXX_COMPILER=clang++-19 \ + -DCMAKE_CXX_FLAGS=-stdlib=libc++ \ + -DCMAKE_CXX_STANDARD=23 \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 \ + -DCMAKE_CXX_MODULE_STD=ON + cmake --build build_module + ctest --test-dir build_module -VV rm -rf build_module - - name: Run modules tests wihtout 'import std;' + - name: Run modules tests without 'import std;' if: ${{matrix.toolset == 'clang-19'}} run: | cd ../boost-root/libs/pfr From ebac701f25f09d2c281c3d677b3565f2c4cca77f Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Thu, 5 Mar 2026 19:39:50 +0000 Subject: [PATCH 3/8] fix build --- modules/usage_sample.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/usage_sample.cpp b/modules/usage_sample.cpp index b6734de1..2da4736c 100644 --- a/modules/usage_sample.cpp +++ b/modules/usage_sample.cpp @@ -8,7 +8,6 @@ //[pfr_module_example #include -#include #include import boost.pfr; From e210d4cac47e91d58aafab348b40d084037a48fb Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Thu, 5 Mar 2026 19:40:03 +0000 Subject: [PATCH 4/8] use modern way to launch cmake --- .github/workflows/ci.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc8754f6..c53d8a26 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,12 +86,13 @@ jobs: if: ${{matrix.toolset == 'gcc-14'}} run: | cd ../boost-root/ - mkdir __build - cd __build - cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=pfr -DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_C_COMPILER=gcc-14 .. - cmake --build . --target tests - ctest --output-on-failure --no-tests=error - cd .. + cmake -S . -B __build \ + -DBUILD_TESTING=1 \ + -DBOOST_INCLUDE_LIBRARIES=pfr \ + -DCMAKE_CXX_COMPILER=g++-14 \ + -DCMAKE_C_COMPILER=gcc-14 + cmake --build __build --target tests + ctest --test-dir __build --output-on-failure --no-tests=error rm -rf __build - name: Run modules tests @@ -108,7 +109,7 @@ jobs: -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 \ -DCMAKE_CXX_MODULE_STD=ON cmake --build build_module - ctest --test-dir build_module -VV + ctest --test-dir build_module --no-tests=error -VV rm -rf build_module - name: Run modules tests without 'import std;' From 31d049899cf3c59c4c0e3ee417ba859cf21c1b0a Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Thu, 5 Mar 2026 19:51:34 +0000 Subject: [PATCH 5/8] test simple cmake tests with clang++19 --- .github/workflows/ci.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c53d8a26..4121d826 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,7 @@ jobs: - toolset: gcc-14 # Do not remove! It is the only toolset that tests CMake tests down below cxxstd: "03,11,14,17,20" os: ubuntu-24.04 + compiler: g++-14 - toolset: gcc-12 cxxstd: "03,11,14,17,2a" os: ubuntu-22.04 @@ -47,6 +48,7 @@ jobs: - toolset: clang-19 # tests misc/strip_boost_namespace.sh and modules cxxstd: "20,23" os: ubuntu-24.04 + compiler: clang++-19 install: clang-19 llvm-19 libclang-rt-19-dev libc++-19-dev libc++abi-19-dev clang-tools-19 runs-on: ${{matrix.os}} @@ -83,14 +85,13 @@ jobs: ./b2 variant=debug tools/inspect - name: Run CMake tests - if: ${{matrix.toolset == 'gcc-14'}} + if: ${{matrix.toolset == 'gcc-14' || matrix.toolset == 'clang-19'}} run: | cd ../boost-root/ cmake -S . -B __build \ -DBUILD_TESTING=1 \ -DBOOST_INCLUDE_LIBRARIES=pfr \ - -DCMAKE_CXX_COMPILER=g++-14 \ - -DCMAKE_C_COMPILER=gcc-14 + -DCMAKE_CXX_COMPILER=${{matrix.compiler}} \ cmake --build __build --target tests ctest --test-dir __build --output-on-failure --no-tests=error rm -rf __build @@ -116,12 +117,12 @@ jobs: if: ${{matrix.toolset == 'clang-19'}} run: | cd ../boost-root/libs/pfr - mkdir build_module - cd build_module - cmake -DBOOST_USE_MODULES=1 -DBUILD_TESTING=1 -GNinja -DCMAKE_CXX_COMPILER=clang++-19 ../test/cmake_subdir_test - cmake --build . - ctest -V - cd .. + cmake -S test/cmake_test_subdir -B build_module -GNinja \ + -DBOOST_USE_MODULES=1 + -DBUILD_TESTING=1 + -DCMAKE_CXX_COMPILER=clang++-19 + cmake --build build_module + ctest --test-dir build_module --no-tests=error -VV rm -rf build_module - name: Run tests From 0708825594b2ce6b47bcc1fc72944cf2c06609df Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Thu, 5 Mar 2026 19:55:19 +0000 Subject: [PATCH 6/8] try fix cmake call --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4121d826..4b2d1637 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,7 +91,7 @@ jobs: cmake -S . -B __build \ -DBUILD_TESTING=1 \ -DBOOST_INCLUDE_LIBRARIES=pfr \ - -DCMAKE_CXX_COMPILER=${{matrix.compiler}} \ + -DCMAKE_CXX_COMPILER=${{matrix.compiler}} cmake --build __build --target tests ctest --test-dir __build --output-on-failure --no-tests=error rm -rf __build From c838b5774c81ff8bde9b98ecbddf28bad52386d0 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Thu, 5 Mar 2026 20:01:28 +0000 Subject: [PATCH 7/8] fix directory name --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b2d1637..eafc1af6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,9 +117,9 @@ jobs: if: ${{matrix.toolset == 'clang-19'}} run: | cd ../boost-root/libs/pfr - cmake -S test/cmake_test_subdir -B build_module -GNinja \ - -DBOOST_USE_MODULES=1 - -DBUILD_TESTING=1 + cmake -S test/cmake_subdir_test -B build_module -GNinja \ + -DBOOST_USE_MODULES=1 \ + -DBUILD_TESTING=1 \ -DCMAKE_CXX_COMPILER=clang++-19 cmake --build build_module ctest --test-dir build_module --no-tests=error -VV From 96d80b441ab375c3bd554d7a3c19b3e5e24a3b0c Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Thu, 5 Mar 2026 21:05:33 +0000 Subject: [PATCH 8/8] try fix non module build --- include/boost/pfr/config.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/boost/pfr/config.hpp b/include/boost/pfr/config.hpp index acf5c8bf..4912545f 100644 --- a/include/boost/pfr/config.hpp +++ b/include/boost/pfr/config.hpp @@ -8,7 +8,9 @@ #define BOOST_PFR_CONFIG_HPP #pragma once +#if defined(BOOST_USE_MODULES) #include +#endif #if !defined(BOOST_USE_MODULES) && (__cplusplus >= 201402L || (defined(_MSC_VER) && defined(_MSVC_LANG) && _MSC_VER > 1900)) #include // to get non standard platform macro definitions (__GLIBCXX__ for example)