From 4ab6ac61c8b28b84c54262a9f1c1ed30c1a7cd27 Mon Sep 17 00:00:00 2001 From: Justen Di Ruscio Date: Tue, 6 Oct 2026 13:25:34 -0300 Subject: [PATCH 1/8] include ut.hpp in ut.cppm w/ relative path --- include/boost/ut.cppm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/ut.cppm b/include/boost/ut.cppm index 0625db1d..2a1244de 100644 --- a/include/boost/ut.cppm +++ b/include/boost/ut.cppm @@ -9,7 +9,7 @@ export module boost.ut; import std; #define BOOST_UT_CXX_MODULES 1 -#include +#include "./ut.hpp" template class boost::ut::reporter_junit; template void boost::ut::reporter_junit::on(boost::ut::events::log); From 53a932af1526c03b33794bdf6691f027730c7e32 Mon Sep 17 00:00:00 2001 From: Justen Di Ruscio Date: Tue, 6 Oct 2026 13:26:39 -0300 Subject: [PATCH 2/8] limit developer compile flags to build interface --- cmake/WarningsAsErrors.cmake | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cmake/WarningsAsErrors.cmake b/cmake/WarningsAsErrors.cmake index c277462b..6b7bbad9 100644 --- a/cmake/WarningsAsErrors.cmake +++ b/cmake/WarningsAsErrors.cmake @@ -1,12 +1,15 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC") - add_compile_options(/W4 /WX) + set(boost_ut_compile_options /W4 /WX) elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") - add_compile_options(-Wall -Wextra -Wpedantic -Werror -Wshadow) + set(boost_ut_compile_options -Wall -Wextra -Wpedantic -Werror -Wshadow) if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 10.0) - add_compile_options(-Wdeprecated-copy-dtor -Wnewline-eof) + set(boost_ut_compile_options -Wdeprecated-copy-dtor -Wnewline-eof) endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") string(REGEX REPLACE " /W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - add_compile_options(/W4 /WX) + set(boost_ut_compile_options /W4 /WX) endif() + +add_compile_options("$") +unset(boost_ut_compile_options) From 6340e8393d44680b9845a6e6088a5e958213b5e6 Mon Sep 17 00:00:00 2001 From: Justen Di Ruscio Date: Tue, 6 Oct 2026 13:26:59 -0300 Subject: [PATCH 3/8] correct tbb linking for libstdc++ --- example/CMakeLists.txt | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index db1b067e..cd3c407e 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -26,20 +26,13 @@ endfunction() example(cfg/printer printer) example(cfg/runner runner) +example(cfg/parallel_runner parallel_runner) -if(APPLE OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - example(cfg/parallel_runner parallel_runner) +if(CMAKE_CXX_STANDARD_LIBRARY STREQUAL libstdc++) + find_package(TBB REQUIRED) + target_link_libraries(boost_ut_parallel_runner PRIVATE TBB::tbb) endif() -# if(DEFINED ENV{TBB_ROOT}) -# set(TBB_ROOT $ENV{TBB_ROOT}) -# # FIXME: include could not find load file: -# include(${TBB_ROOT}/cmake/TBBBuild.cmake) -# tbb_build(TBB_ROOT ${TBB_ROOT} CONFIG_DIR TBB_DIR MAKE_ARGS stdver="c++17") -# find_package(TBB) -# target_link_libraries(boost_ut_parallel_runner ${TBB_IMPORTED_TARGETS}) -# endif() - example(cfg/reporter reporter) if(NOT WIN32) From def0e789d01d001bd937017d0e5246508b62772e Mon Sep 17 00:00:00 2001 From: Justen Di Ruscio Date: Tue, 6 Oct 2026 14:17:34 -0300 Subject: [PATCH 4/8] Revert "include ut.hpp in ut.cppm w/ relative path" This reverts commit 4ab6ac61c8b28b84c54262a9f1c1ed30c1a7cd27. --- include/boost/ut.cppm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/ut.cppm b/include/boost/ut.cppm index 2a1244de..0625db1d 100644 --- a/include/boost/ut.cppm +++ b/include/boost/ut.cppm @@ -9,7 +9,7 @@ export module boost.ut; import std; #define BOOST_UT_CXX_MODULES 1 -#include "./ut.hpp" +#include template class boost::ut::reporter_junit; template void boost::ut::reporter_junit::on(boost::ut::events::log); From 11a8a7ea309d744720cc13f114c116c4b667a29c Mon Sep 17 00:00:00 2001 From: Justen Di Ruscio Date: Tue, 6 Oct 2026 14:27:03 -0300 Subject: [PATCH 5/8] investigate macos + g++ + libstdc++ --- example/CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index cd3c407e..7c53bc52 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -29,8 +29,12 @@ example(cfg/runner runner) example(cfg/parallel_runner parallel_runner) if(CMAKE_CXX_STANDARD_LIBRARY STREQUAL libstdc++) - find_package(TBB REQUIRED) - target_link_libraries(boost_ut_parallel_runner PRIVATE TBB::tbb) + find_package(TBB) + message(STATUS "TBB_FOUND: ${TBB_FOUND}") + if(TBB_FOUND) + target_link_libraries(boost_ut_parallel_runner PRIVATE TBB::tbb) + endif() +else() endif() example(cfg/reporter reporter) From 60af8a462eb99517f161916bb09c4321fdef086d Mon Sep 17 00:00:00 2001 From: Justen Di Ruscio Date: Tue, 6 Oct 2026 14:47:09 -0300 Subject: [PATCH 6/8] correct libstdc++ check --- example/CMakeLists.txt | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 7c53bc52..dd1e5b45 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -24,21 +24,29 @@ function(example file target) endif() endfunction() +# Define a test program to detect libstdc++. +# When https://gitlab.kitware.com/cmake/cmake/-/work_items/20851 is complete, +# simply read CMAKE_CXX_STANDARD_LIBRARY variable +include(CheckCXXSourceCompiles) +check_cxx_source_compiles([[ + #include + #ifndef __GLIBCXX__ + #error "not libstdc++" + #endif + int main(){} + ]] + using_glibcxx) + example(cfg/printer printer) example(cfg/runner runner) example(cfg/parallel_runner parallel_runner) +example(cfg/reporter reporter) -if(CMAKE_CXX_STANDARD_LIBRARY STREQUAL libstdc++) - find_package(TBB) - message(STATUS "TBB_FOUND: ${TBB_FOUND}") - if(TBB_FOUND) - target_link_libraries(boost_ut_parallel_runner PRIVATE TBB::tbb) - endif() -else() +if(using_glibcxx) + find_package(TBB REQUIRED) + target_link_libraries(boost_ut_parallel_runner PRIVATE TBB::tbb) endif() -example(cfg/reporter reporter) - if(NOT WIN32) example(abort abort) endif() From f37f9086e51510b0ae429c683be4cd4ff221aeb2 Mon Sep 17 00:00:00 2001 From: Justen Di Ruscio Date: Tue, 6 Oct 2026 14:53:23 -0300 Subject: [PATCH 7/8] disable example/parallel_runner w/o TBB when libstdc++ --- example/CMakeLists.txt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index dd1e5b45..c3dacaa4 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -39,14 +39,24 @@ check_cxx_source_compiles([[ example(cfg/printer printer) example(cfg/runner runner) -example(cfg/parallel_runner parallel_runner) example(cfg/reporter reporter) if(using_glibcxx) - find_package(TBB REQUIRED) - target_link_libraries(boost_ut_parallel_runner PRIVATE TBB::tbb) + # parallel_runner uses , for which libstdc++ requires TBB + find_package(TBB) + if(TBB_FOUND) + example(cfg/parallel_runner parallel_runner) + target_link_libraries(boost_ut_parallel_runner PRIVATE TBB::tbb) + else() + message(AUTHOR_WARNING + "Disabling example/parallel_runner, as it requires TBB when using libstdc++, " + "but TBB could not be found") + endif() +else() + example(cfg/parallel_runner parallel_runner) endif() + if(NOT WIN32) example(abort abort) endif() From 4389d417123ace6ba618bc0290a79d82358b9ab0 Mon Sep 17 00:00:00 2001 From: Justen Di Ruscio Date: Sat, 10 Oct 2026 11:38:19 -0300 Subject: [PATCH 8/8] ut.cppm angled include, perserve boost prefix --- include/boost/ut.cppm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/ut.cppm b/include/boost/ut.cppm index 0625db1d..d3151102 100644 --- a/include/boost/ut.cppm +++ b/include/boost/ut.cppm @@ -9,7 +9,7 @@ export module boost.ut; import std; #define BOOST_UT_CXX_MODULES 1 -#include +#include "boost/ut.hpp" template class boost::ut::reporter_junit; template void boost::ut::reporter_junit::on(boost::ut::events::log);