From 66781cd68572a0d7096601529403456d1003f21d Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Wed, 25 Feb 2026 12:41:55 +0100 Subject: [PATCH 01/16] Recover old module impl --- CMakeLists.txt | 28 +++++++++++++++++++----- include/boost/exception/exception.hpp | 2 ++ include/boost/throw_exception.hpp | 22 ++++++++++++++++--- include/boost/throw_exception/macros.hpp | 6 +++++ modules/boost_throw_exception.cppm | 14 ++++++++++++ 5 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 include/boost/throw_exception/macros.hpp create mode 100644 modules/boost_throw_exception.cppm diff --git a/CMakeLists.txt b/CMakeLists.txt index a994885..e67150c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,16 +2,34 @@ # 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 -cmake_minimum_required(VERSION 3.5...3.16) +cmake_minimum_required(VERSION 3.5...3.31) project(boost_throw_exception VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) -add_library(boost_throw_exception INTERFACE) -add_library(Boost::throw_exception ALIAS boost_throw_exception) +if (BOOST_USE_MODULES) + add_library(boost_throw_exception STATIC) + target_sources(boost_throw_exception PUBLIC FILE_SET CXX_MODULES BASE_DIRS modules FILES modules/boost_throw_exception.cppm) + set(__scope PUBLIC) + + # Enable and propagate C++23, import std, and the modules macro + target_compile_features(boost_throw_exception PUBLIC cxx_std_23) + set_target_properties(boost_throw_exception PROPERTIES CXX_MODULE_STD 1) + target_compile_definitions(boost_throw_exception PUBLIC BOOST_USE_MODULES) -target_include_directories(boost_throw_exception INTERFACE include) + # Silence warnings about includes in the purview + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + target_compile_options(boost_throw_exception PRIVATE -Wno-include-angled-in-module-purview) + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + target_compile_options(boost_throw_exception PRIVATE /wd5244) + endif() +else() + add_library(boost_throw_exception INTERFACE) + set(__scope INTERFACE) +endif() +add_library(Boost::throw_exception ALIAS boost_throw_exception) +target_include_directories(boost_throw_exception ${__scope} include) target_link_libraries(boost_throw_exception - INTERFACE + ${__scope} Boost::assert Boost::config ) diff --git a/include/boost/exception/exception.hpp b/include/boost/exception/exception.hpp index e6d340c..85b611c 100644 --- a/include/boost/exception/exception.hpp +++ b/include/boost/exception/exception.hpp @@ -6,9 +6,11 @@ #ifndef BOOST_EXCEPTION_274DA366004E11DCB1DDFE2E56D89593 #define BOOST_EXCEPTION_274DA366004E11DCB1DDFE2E56D89593 +#ifndef BOOST_USE_MODULES #include #include #include +#endif #ifdef BOOST_EXCEPTION_MINI_BOOST #include diff --git a/include/boost/throw_exception.hpp b/include/boost/throw_exception.hpp index 7c7fcbd..e5153dd 100644 --- a/include/boost/throw_exception.hpp +++ b/include/boost/throw_exception.hpp @@ -18,7 +18,8 @@ // // http://www.boost.org/libs/throw_exception -#include + +#ifndef BOOST_USE_MODULES #include #include #include @@ -28,11 +29,21 @@ #if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) #include #endif +#endif + +#include #if !defined( BOOST_EXCEPTION_DISABLE ) && defined( BOOST_BORLANDC ) && BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x593) ) # define BOOST_EXCEPTION_DISABLE #endif +// BOOST_THROW_EXCEPTION_MODULE_EXPORT +#ifdef BOOST_USE_MODULES +# define BOOST_THROW_EXCEPTION_MODULE_EXPORT export +#else +# define BOOST_THROW_EXCEPTION_MODULE_EXPORT +#endif + namespace boost { @@ -68,6 +79,7 @@ template struct wrapexcept_add_base } // namespace detail +BOOST_THROW_EXCEPTION_MODULE_EXPORT template struct BOOST_SYMBOL_VISIBLE wrapexcept: public detail::wrapexcept_add_base::type, public E, @@ -159,12 +171,14 @@ template BOOST_NORETURN void throw_exception( E const & e, boost::sourc #else // defined( BOOST_EXCEPTION_DISABLE ) +BOOST_THROW_EXCEPTION_MODULE_EXPORT template BOOST_NORETURN void throw_exception( E const & e ) { throw_exception_assert_compatibility( e ); throw wrapexcept( e ); } +BOOST_THROW_EXCEPTION_MODULE_EXPORT template BOOST_NORETURN void throw_exception( E const & e, boost::source_location const & loc ) { throw_exception_assert_compatibility( e ); @@ -179,8 +193,6 @@ template BOOST_NORETURN void throw_exception( E const & e, boost::sourc // BOOST_THROW_EXCEPTION -#define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x, BOOST_CURRENT_LOCATION) - namespace boost { @@ -221,6 +233,7 @@ template class BOOST_SYMBOL_VISIBLE with_throw_location: public E, publ #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) +BOOST_THROW_EXCEPTION_MODULE_EXPORT template BOOST_NORETURN void throw_with_location( E && e, boost::source_location const & loc = BOOST_CURRENT_LOCATION ) { throw_exception_assert_compatibility( e ); @@ -248,6 +261,7 @@ template BOOST_NORETURN void throw_with_location( E const & e, boost::s // get_throw_location +BOOST_THROW_EXCEPTION_MODULE_EXPORT template boost::source_location get_throw_location( E const & e ) { #if defined(BOOST_NO_RTTI) @@ -275,4 +289,6 @@ template boost::source_location get_throw_location( E const & e ) } // namespace boost +#include + #endif // #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED diff --git a/include/boost/throw_exception/macros.hpp b/include/boost/throw_exception/macros.hpp new file mode 100644 index 0000000..04b56c7 --- /dev/null +++ b/include/boost/throw_exception/macros.hpp @@ -0,0 +1,6 @@ +#ifndef BOOST_THROW_EXCEPTION_MACROS_HPP_INCLUDED +#define BOOST_THROW_EXCEPTION_MACROS_HPP_INCLUDED + +#define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x, BOOST_CURRENT_LOCATION) + +#endif \ No newline at end of file diff --git a/modules/boost_throw_exception.cppm b/modules/boost_throw_exception.cppm new file mode 100644 index 0000000..26b908e --- /dev/null +++ b/modules/boost_throw_exception.cppm @@ -0,0 +1,14 @@ +module; + +#include +#include +#include + +export module boost.throw_exception; + +import std; +import boost.assert; + +extern "C++" { +#include +} From 58b47d5dcf16ecfc5d8ef2ff310e766fe211cb59 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Wed, 25 Feb 2026 12:43:50 +0100 Subject: [PATCH 02/16] Revert to headers --- CMakeLists.txt | 26 ++++-------------------- include/boost/exception/exception.hpp | 2 -- include/boost/throw_exception.hpp | 22 +++----------------- include/boost/throw_exception/macros.hpp | 6 ------ modules/boost_throw_exception.cppm | 14 ------------- 5 files changed, 7 insertions(+), 63 deletions(-) delete mode 100644 include/boost/throw_exception/macros.hpp delete mode 100644 modules/boost_throw_exception.cppm diff --git a/CMakeLists.txt b/CMakeLists.txt index e67150c..2935df4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,31 +5,13 @@ cmake_minimum_required(VERSION 3.5...3.31) project(boost_throw_exception VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) -if (BOOST_USE_MODULES) - add_library(boost_throw_exception STATIC) - target_sources(boost_throw_exception PUBLIC FILE_SET CXX_MODULES BASE_DIRS modules FILES modules/boost_throw_exception.cppm) - set(__scope PUBLIC) - - # Enable and propagate C++23, import std, and the modules macro - target_compile_features(boost_throw_exception PUBLIC cxx_std_23) - set_target_properties(boost_throw_exception PROPERTIES CXX_MODULE_STD 1) - target_compile_definitions(boost_throw_exception PUBLIC BOOST_USE_MODULES) +add_library(boost_throw_exception INTERFACE) +add_library(Boost::throw_exception ALIAS boost_throw_exception) - # Silence warnings about includes in the purview - if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - target_compile_options(boost_throw_exception PRIVATE -Wno-include-angled-in-module-purview) - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - target_compile_options(boost_throw_exception PRIVATE /wd5244) - endif() -else() - add_library(boost_throw_exception INTERFACE) - set(__scope INTERFACE) -endif() +target_include_directories(boost_throw_exception INTERFACE include) -add_library(Boost::throw_exception ALIAS boost_throw_exception) -target_include_directories(boost_throw_exception ${__scope} include) target_link_libraries(boost_throw_exception - ${__scope} + INTERFACE Boost::assert Boost::config ) diff --git a/include/boost/exception/exception.hpp b/include/boost/exception/exception.hpp index 85b611c..e6d340c 100644 --- a/include/boost/exception/exception.hpp +++ b/include/boost/exception/exception.hpp @@ -6,11 +6,9 @@ #ifndef BOOST_EXCEPTION_274DA366004E11DCB1DDFE2E56D89593 #define BOOST_EXCEPTION_274DA366004E11DCB1DDFE2E56D89593 -#ifndef BOOST_USE_MODULES #include #include #include -#endif #ifdef BOOST_EXCEPTION_MINI_BOOST #include diff --git a/include/boost/throw_exception.hpp b/include/boost/throw_exception.hpp index e5153dd..7c7fcbd 100644 --- a/include/boost/throw_exception.hpp +++ b/include/boost/throw_exception.hpp @@ -18,8 +18,7 @@ // // http://www.boost.org/libs/throw_exception - -#ifndef BOOST_USE_MODULES +#include #include #include #include @@ -29,21 +28,11 @@ #if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) #include #endif -#endif - -#include #if !defined( BOOST_EXCEPTION_DISABLE ) && defined( BOOST_BORLANDC ) && BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x593) ) # define BOOST_EXCEPTION_DISABLE #endif -// BOOST_THROW_EXCEPTION_MODULE_EXPORT -#ifdef BOOST_USE_MODULES -# define BOOST_THROW_EXCEPTION_MODULE_EXPORT export -#else -# define BOOST_THROW_EXCEPTION_MODULE_EXPORT -#endif - namespace boost { @@ -79,7 +68,6 @@ template struct wrapexcept_add_base } // namespace detail -BOOST_THROW_EXCEPTION_MODULE_EXPORT template struct BOOST_SYMBOL_VISIBLE wrapexcept: public detail::wrapexcept_add_base::type, public E, @@ -171,14 +159,12 @@ template BOOST_NORETURN void throw_exception( E const & e, boost::sourc #else // defined( BOOST_EXCEPTION_DISABLE ) -BOOST_THROW_EXCEPTION_MODULE_EXPORT template BOOST_NORETURN void throw_exception( E const & e ) { throw_exception_assert_compatibility( e ); throw wrapexcept( e ); } -BOOST_THROW_EXCEPTION_MODULE_EXPORT template BOOST_NORETURN void throw_exception( E const & e, boost::source_location const & loc ) { throw_exception_assert_compatibility( e ); @@ -193,6 +179,8 @@ template BOOST_NORETURN void throw_exception( E const & e, boost::sourc // BOOST_THROW_EXCEPTION +#define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x, BOOST_CURRENT_LOCATION) + namespace boost { @@ -233,7 +221,6 @@ template class BOOST_SYMBOL_VISIBLE with_throw_location: public E, publ #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) -BOOST_THROW_EXCEPTION_MODULE_EXPORT template BOOST_NORETURN void throw_with_location( E && e, boost::source_location const & loc = BOOST_CURRENT_LOCATION ) { throw_exception_assert_compatibility( e ); @@ -261,7 +248,6 @@ template BOOST_NORETURN void throw_with_location( E const & e, boost::s // get_throw_location -BOOST_THROW_EXCEPTION_MODULE_EXPORT template boost::source_location get_throw_location( E const & e ) { #if defined(BOOST_NO_RTTI) @@ -289,6 +275,4 @@ template boost::source_location get_throw_location( E const & e ) } // namespace boost -#include - #endif // #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED diff --git a/include/boost/throw_exception/macros.hpp b/include/boost/throw_exception/macros.hpp deleted file mode 100644 index 04b56c7..0000000 --- a/include/boost/throw_exception/macros.hpp +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef BOOST_THROW_EXCEPTION_MACROS_HPP_INCLUDED -#define BOOST_THROW_EXCEPTION_MACROS_HPP_INCLUDED - -#define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x, BOOST_CURRENT_LOCATION) - -#endif \ No newline at end of file diff --git a/modules/boost_throw_exception.cppm b/modules/boost_throw_exception.cppm deleted file mode 100644 index 26b908e..0000000 --- a/modules/boost_throw_exception.cppm +++ /dev/null @@ -1,14 +0,0 @@ -module; - -#include -#include -#include - -export module boost.throw_exception; - -import std; -import boost.assert; - -extern "C++" { -#include -} From 80e5f2c0c2a8f56f0a207149f084e76860b2e06f Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Wed, 25 Feb 2026 12:55:39 +0100 Subject: [PATCH 03/16] Support import std --- CMakeLists.txt | 4 ++++ include/boost/exception/exception.hpp | 4 ++-- include/boost/throw_exception.hpp | 8 ++++---- test/CMakeLists.txt | 4 ++++ test/make_exception_ptr_test.cpp | 13 +++++++++++++ test/make_exception_ptr_test2.cpp | 13 +++++++++++++ test/throw_exception_test3.cpp | 13 +++++++++++++ test/throw_exception_test4.cpp | 13 +++++++++++++ test/throw_exception_test5.cpp | 13 +++++++++++++ 9 files changed, 79 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2935df4..1acb3e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,10 @@ target_link_libraries(boost_throw_exception Boost::config ) +if (BOOST_USE_MODULES) + target_compile_definitions(boost_throw_exception INTERFACE BOOST_USE_MODULES) +endif() + if(BUILD_TESTING) add_subdirectory(test) diff --git a/include/boost/exception/exception.hpp b/include/boost/exception/exception.hpp index e6d340c..fb3c08a 100644 --- a/include/boost/exception/exception.hpp +++ b/include/boost/exception/exception.hpp @@ -8,10 +8,10 @@ #include #include -#include +#include #ifdef BOOST_EXCEPTION_MINI_BOOST -#include +#include namespace boost { namespace exception_detail { using std::shared_ptr; } } #else namespace boost { template class shared_ptr; } diff --git a/include/boost/throw_exception.hpp b/include/boost/throw_exception.hpp index 7c7fcbd..cc7bd06 100644 --- a/include/boost/throw_exception.hpp +++ b/include/boost/throw_exception.hpp @@ -22,11 +22,11 @@ #include #include #include -#include -#include -#include +#include +#include +#include #if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) -#include +#include #endif #if !defined( BOOST_EXCEPTION_DISABLE ) && defined( BOOST_BORLANDC ) && BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x593) ) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 486b61f..4f1ed59 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::throw_exception Boost::core Boost::exception) endif() diff --git a/test/make_exception_ptr_test.cpp b/test/make_exception_ptr_test.cpp index f152192..4f889ba 100644 --- a/test/make_exception_ptr_test.cpp +++ b/test/make_exception_ptr_test.cpp @@ -2,6 +2,17 @@ // Distributed under the Boost Software License, Version 1.0. // http://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +#include + +int main() +{ + printf("This test depends on Boost.Exception and can't be run with C++20 modules yet\n"); +} + +#else + #if defined(_MSC_VER) # pragma warning(disable: 4702) // unreachable code #endif @@ -16,3 +27,5 @@ int main() BOOST_TEST_THROWS( boost::rethrow_exception( boost::make_exception_ptr( my_exception() ) ), my_exception ); return boost::report_errors(); } + +#endif diff --git a/test/make_exception_ptr_test2.cpp b/test/make_exception_ptr_test2.cpp index 86cf5a4..d5ee74b 100644 --- a/test/make_exception_ptr_test2.cpp +++ b/test/make_exception_ptr_test2.cpp @@ -2,6 +2,17 @@ // Distributed under the Boost Software License, Version 1.0. // http://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +#include + +int main() +{ + printf("This test depends on Boost.Exception and can't be run with C++20 modules yet\n"); +} + +#else + #if defined(_MSC_VER) # pragma warning(disable: 4702) // unreachable code #endif @@ -18,3 +29,5 @@ int main() BOOST_TEST_THROWS( boost::rethrow_exception( boost::make_exception_ptr( my_exception() ) ), my_exception ); return boost::report_errors(); } + +#endif diff --git a/test/throw_exception_test3.cpp b/test/throw_exception_test3.cpp index 3e80773..e6e17e6 100644 --- a/test/throw_exception_test3.cpp +++ b/test/throw_exception_test3.cpp @@ -5,6 +5,17 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +#include + +int main() +{ + printf("This test depends on Boost.Exception and can't be run with C++20 modules yet\n"); +} + +#else + #if defined(_MSC_VER) # pragma warning(disable: 4702) // unreachable code #endif @@ -109,3 +120,5 @@ int main() return boost::report_errors(); } + +#endif diff --git a/test/throw_exception_test4.cpp b/test/throw_exception_test4.cpp index cc36c2f..cc367f9 100644 --- a/test/throw_exception_test4.cpp +++ b/test/throw_exception_test4.cpp @@ -5,6 +5,17 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +#include + +int main() +{ + printf("This test depends on Boost.Exception and can't be run with C++20 modules yet\n"); +} + +#else + #include #include #include @@ -131,3 +142,5 @@ int main() return boost::report_errors(); } + +#endif diff --git a/test/throw_exception_test5.cpp b/test/throw_exception_test5.cpp index 32970cf..7ce9f21 100644 --- a/test/throw_exception_test5.cpp +++ b/test/throw_exception_test5.cpp @@ -5,6 +5,17 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +#include + +int main() +{ + printf("This test depends on Boost.Exception and can't be run with C++20 modules yet\n"); +} + +#else + #if defined(__clang__) # pragma clang diagnostic ignored "-Wunknown-pragmas" # pragma clang diagnostic ignored "-Wunknown-warning-option" @@ -117,3 +128,5 @@ int main() return boost::report_errors(); } + +#endif From d34172c744332a0569eca37c2b7de7c0b9e93ddf Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Wed, 25 Feb 2026 15:52:58 +0100 Subject: [PATCH 04/16] gcc changes --- test/cmake_install_test/main.cpp | 2 +- test/cmake_subdir_test/main.cpp | 2 +- test/lib1_throw.hpp | 2 +- test/lib2_throw.hpp | 2 +- test/lib3_throw.hpp | 2 +- test/lib4_throw.hpp | 2 +- test/make_exception_ptr_test.cpp | 2 +- test/make_exception_ptr_test2.cpp | 2 +- test/throw_exception_no_both_test.cpp | 2 +- test/throw_exception_no_exceptions_test.cpp | 2 +- test/throw_exception_nx_test.cpp | 2 +- test/throw_exception_nx_test2.cpp | 4 ++-- test/throw_exception_test3.cpp | 2 +- test/throw_exception_test4.cpp | 4 ++-- test/throw_exception_test5.cpp | 2 +- test/throw_with_location_nx_test.cpp | 2 +- 16 files changed, 18 insertions(+), 18 deletions(-) diff --git a/test/cmake_install_test/main.cpp b/test/cmake_install_test/main.cpp index 771931e..5b6b131 100644 --- a/test/cmake_install_test/main.cpp +++ b/test/cmake_install_test/main.cpp @@ -3,7 +3,7 @@ // See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt #include -#include +#include int main() { diff --git a/test/cmake_subdir_test/main.cpp b/test/cmake_subdir_test/main.cpp index 771931e..5b6b131 100644 --- a/test/cmake_subdir_test/main.cpp +++ b/test/cmake_subdir_test/main.cpp @@ -3,7 +3,7 @@ // See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt #include -#include +#include int main() { diff --git a/test/lib1_throw.hpp b/test/lib1_throw.hpp index f3d169b..a5f5edc 100644 --- a/test/lib1_throw.hpp +++ b/test/lib1_throw.hpp @@ -9,7 +9,7 @@ // http://www.boost.org/LICENSE_1_0.txt #include -#include +#include #if defined(LIB1_DYN_LINK) # if defined(LIB1_SOURCE) diff --git a/test/lib2_throw.hpp b/test/lib2_throw.hpp index 59e8dc2..367b3b8 100644 --- a/test/lib2_throw.hpp +++ b/test/lib2_throw.hpp @@ -9,7 +9,7 @@ // http://www.boost.org/LICENSE_1_0.txt #include -#include +#include #if defined(LIB2_DYN_LINK) # if defined(LIB2_SOURCE) diff --git a/test/lib3_throw.hpp b/test/lib3_throw.hpp index da280ab..274b4cb 100644 --- a/test/lib3_throw.hpp +++ b/test/lib3_throw.hpp @@ -9,7 +9,7 @@ // http://www.boost.org/LICENSE_1_0.txt #include -#include +#include #if defined(LIB3_DYN_LINK) # if defined(LIB3_SOURCE) diff --git a/test/lib4_throw.hpp b/test/lib4_throw.hpp index 67bc03f..ea099e1 100644 --- a/test/lib4_throw.hpp +++ b/test/lib4_throw.hpp @@ -9,7 +9,7 @@ // http://www.boost.org/LICENSE_1_0.txt #include -#include +#include #if defined(LIB4_DYN_LINK) # if defined(LIB4_SOURCE) diff --git a/test/make_exception_ptr_test.cpp b/test/make_exception_ptr_test.cpp index 4f889ba..010fee8 100644 --- a/test/make_exception_ptr_test.cpp +++ b/test/make_exception_ptr_test.cpp @@ -4,7 +4,7 @@ #ifdef BOOST_USE_MODULES -#include +import std.compat; int main() { diff --git a/test/make_exception_ptr_test2.cpp b/test/make_exception_ptr_test2.cpp index d5ee74b..ffc6254 100644 --- a/test/make_exception_ptr_test2.cpp +++ b/test/make_exception_ptr_test2.cpp @@ -4,7 +4,7 @@ #ifdef BOOST_USE_MODULES -#include +import std.compat; int main() { diff --git a/test/throw_exception_no_both_test.cpp b/test/throw_exception_no_both_test.cpp index e87695a..e67675c 100644 --- a/test/throw_exception_no_both_test.cpp +++ b/test/throw_exception_no_both_test.cpp @@ -7,7 +7,7 @@ #define BOOST_EXCEPTION_DISABLE #include -#include +#include #if defined(_MSC_VER) # pragma warning(disable: 4702) // unreachable code diff --git a/test/throw_exception_no_exceptions_test.cpp b/test/throw_exception_no_exceptions_test.cpp index 8bfb95e..baa2df4 100644 --- a/test/throw_exception_no_exceptions_test.cpp +++ b/test/throw_exception_no_exceptions_test.cpp @@ -6,7 +6,7 @@ #define BOOST_NO_EXCEPTIONS #include -#include +#include #if defined(_MSC_VER) # pragma warning(disable: 4702) // unreachable code diff --git a/test/throw_exception_nx_test.cpp b/test/throw_exception_nx_test.cpp index 589f7db..8146478 100644 --- a/test/throw_exception_nx_test.cpp +++ b/test/throw_exception_nx_test.cpp @@ -9,7 +9,7 @@ #endif #include -#include +#include class my_exception: public std::exception {}; diff --git a/test/throw_exception_nx_test2.cpp b/test/throw_exception_nx_test2.cpp index 438b2e4..92cd262 100644 --- a/test/throw_exception_nx_test2.cpp +++ b/test/throw_exception_nx_test2.cpp @@ -9,8 +9,8 @@ #endif #include -#include -#include +#include +#include class my_exception: public std::exception {}; diff --git a/test/throw_exception_test3.cpp b/test/throw_exception_test3.cpp index e6e17e6..39adc17 100644 --- a/test/throw_exception_test3.cpp +++ b/test/throw_exception_test3.cpp @@ -7,7 +7,7 @@ #ifdef BOOST_USE_MODULES -#include +import std.compat; int main() { diff --git a/test/throw_exception_test4.cpp b/test/throw_exception_test4.cpp index cc367f9..e34c6bd 100644 --- a/test/throw_exception_test4.cpp +++ b/test/throw_exception_test4.cpp @@ -7,7 +7,7 @@ #ifdef BOOST_USE_MODULES -#include +import std.compat; int main() { @@ -19,7 +19,7 @@ int main() #include #include #include -#include +#include class my_exception: public std::exception { diff --git a/test/throw_exception_test5.cpp b/test/throw_exception_test5.cpp index 7ce9f21..9dafcb5 100644 --- a/test/throw_exception_test5.cpp +++ b/test/throw_exception_test5.cpp @@ -7,7 +7,7 @@ #ifdef BOOST_USE_MODULES -#include +import std.compat; int main() { diff --git a/test/throw_with_location_nx_test.cpp b/test/throw_with_location_nx_test.cpp index e93e600..c436e7c 100644 --- a/test/throw_with_location_nx_test.cpp +++ b/test/throw_with_location_nx_test.cpp @@ -9,7 +9,7 @@ #endif #include -#include +#include class my_exception: public std::exception {}; From c5d4f89ac8a933dea746451a8d35f63919d5b1f1 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 13:58:36 +0100 Subject: [PATCH 05/16] Purview safe header --- include/boost/throw_exception.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/boost/throw_exception.hpp b/include/boost/throw_exception.hpp index cc7bd06..afa4836 100644 --- a/include/boost/throw_exception.hpp +++ b/include/boost/throw_exception.hpp @@ -1,3 +1,8 @@ +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_THROW_EXCEPTION_HPP_INCLUDED) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED #define BOOST_THROW_EXCEPTION_HPP_INCLUDED From e4b9ed5528beb331d8eb9f6b6ff2e0013c408e9e Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 19:20:35 +0100 Subject: [PATCH 06/16] Tests depending on exception --- test/make_exception_ptr_nx_test.cpp | 13 +++++++++++++ test/make_exception_ptr_nx_test2.cpp | 13 +++++++++++++ test/throw_exception_test5.cpp | 2 +- test/throw_from_library_test.cpp | 13 +++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/test/make_exception_ptr_nx_test.cpp b/test/make_exception_ptr_nx_test.cpp index 72d2f7b..c56d478 100644 --- a/test/make_exception_ptr_nx_test.cpp +++ b/test/make_exception_ptr_nx_test.cpp @@ -2,6 +2,17 @@ // Distributed under the Boost Software License, Version 1.0. // http://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +import std.compat; + +int main() +{ + printf("This test depends on Boost.Exception and can't be run with C++20 modules yet\n"); +} + +#else + #if defined(_MSC_VER) # pragma warning(disable: 4702) // unreachable code # pragma warning(disable: 4577) // noexcept used without /EHsc @@ -27,3 +38,5 @@ void throw_exception( std::exception const & ) } } // namespace boost + +#endif diff --git a/test/make_exception_ptr_nx_test2.cpp b/test/make_exception_ptr_nx_test2.cpp index 4ec8626..68ae8c9 100644 --- a/test/make_exception_ptr_nx_test2.cpp +++ b/test/make_exception_ptr_nx_test2.cpp @@ -2,6 +2,17 @@ // Distributed under the Boost Software License, Version 1.0. // http://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +import std.compat; + +int main() +{ + printf("This test depends on Boost.Exception and can't be run with C++20 modules yet\n"); +} + +#else + #if defined(_MSC_VER) # pragma warning(disable: 4702) // unreachable code # pragma warning(disable: 4577) // noexcept used without /EHsc @@ -29,3 +40,5 @@ void throw_exception( std::exception const & ) } } // namespace boost + +#endif diff --git a/test/throw_exception_test5.cpp b/test/throw_exception_test5.cpp index 9dafcb5..47c733c 100644 --- a/test/throw_exception_test5.cpp +++ b/test/throw_exception_test5.cpp @@ -27,7 +27,7 @@ int main() #include #include #include -#include +#include typedef boost::error_info error_code; typedef boost::error_info error_string; diff --git a/test/throw_from_library_test.cpp b/test/throw_from_library_test.cpp index a3dc073..ba9ced6 100644 --- a/test/throw_from_library_test.cpp +++ b/test/throw_from_library_test.cpp @@ -5,6 +5,17 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +import std.compat; + +int main() +{ + printf("This test depends on Boost.Exception and can't be run with C++20 modules yet\n"); +} + +#else + #if defined(_MSC_VER) # pragma warning(disable: 4702) // unreachable code #endif @@ -110,3 +121,5 @@ int main() return boost::report_errors(); } + +#endif From fee946feefa1802632d1300944d00f2ef613f608 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 20:10:45 +0100 Subject: [PATCH 07/16] Explicitly qualified call workaround --- include/boost/throw_exception.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/boost/throw_exception.hpp b/include/boost/throw_exception.hpp index afa4836..1ff9dfd 100644 --- a/include/boost/throw_exception.hpp +++ b/include/boost/throw_exception.hpp @@ -108,10 +108,11 @@ template struct BOOST_SYMBOL_VISIBLE wrapexcept: { copy_from( &e ); - set_info( *this, throw_file( loc.file_name() ) ); - set_info( *this, throw_line( static_cast( loc.line() ) ) ); - set_info( *this, throw_function( loc.function_name() ) ); - set_info( *this, throw_column( static_cast( loc.column() ) ) ); + // RP TODO: gcc fails to find these by ADL when using modules for some reason + exception_detail::set_info( *this, throw_file( loc.file_name() ) ); + exception_detail::set_info( *this, throw_line( static_cast( loc.line() ) ) ); + exception_detail::set_info( *this, throw_function( loc.function_name() ) ); + exception_detail::set_info( *this, throw_column( static_cast( loc.column() ) ) ); } virtual boost::exception_detail::clone_base const * clone() const BOOST_OVERRIDE From 2255eb9b831d43d2cc8611c92ba9f39cac92eebb Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Mar 2026 17:09:20 +0100 Subject: [PATCH 08/16] CI --- .github/workflows/ci.yml | 380 ++++++++++++++++++++++++++++++ tools/install-cmake.sh | 15 ++ tools/setup_boost_with_modules.py | 28 +++ 3 files changed, 423 insertions(+) create mode 100755 tools/install-cmake.sh create mode 100644 tools/setup_boost_with_modules.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c5f664..cfa7ec6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -642,3 +642,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/throw_exception/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/throw_exception/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/throw_exception/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/throw_exception/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/throw_exception/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/throw_exception/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/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..18384a1 --- /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/assert', 'https://github.com/anarthal/assert'), + ('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() From 5af2db6a6606658b776939fda66db2c129f86724 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Mar 2026 17:22:23 +0100 Subject: [PATCH 09/16] Missing checkouts --- .github/workflows/ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cfa7ec6..317ac69 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -240,6 +240,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/throw_exception/tools/setup_boost_with_modules.py # Temporary ./bootstrap.sh ./b2 -d0 headers @@ -295,6 +296,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/throw_exception/tools/setup_boost_with_modules.py # Temporary cmd /c bootstrap b2 -d0 headers @@ -343,6 +345,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/throw_exception/tools/setup_boost_with_modules.py # Temporary - name: Use library with add_subdirectory run: | @@ -391,6 +394,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/throw_exception/tools/setup_boost_with_modules.py # Temporary - name: Configure run: | @@ -449,6 +453,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/throw_exception/tools/setup_boost_with_modules.py # Temporary - name: Configure run: | @@ -497,6 +502,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/throw_exception/tools/setup_boost_with_modules.py # Temporary - name: Use library with add_subdirectory (Debug) shell: cmd @@ -545,6 +551,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/throw_exception/tools/setup_boost_with_modules.py # Temporary - name: Configure shell: cmd @@ -611,6 +618,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/throw_exception/tools/setup_boost_with_modules.py # Temporary - name: Configure shell: cmd From 2905b5707ea7223297cfb583731d14b3c90dd4a0 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 6 Mar 2026 18:22:40 +0100 Subject: [PATCH 10/16] Fix throw_exception test --- test/throw_exception_test4.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/throw_exception_test4.cpp b/test/throw_exception_test4.cpp index e34c6bd..31d2cf6 100644 --- a/test/throw_exception_test4.cpp +++ b/test/throw_exception_test4.cpp @@ -73,7 +73,7 @@ int main() int const * line = boost::get_error_info( x ); BOOST_TEST( line != 0 ); - BOOST_TEST_EQ( *line, 50 ); + BOOST_TEST_EQ( *line, 61 ); } { @@ -101,7 +101,7 @@ int main() int const * line = boost::get_error_info( x ); BOOST_TEST( line != 0 ); - BOOST_TEST_EQ( *line, 78 ); + BOOST_TEST_EQ( *line, 89 ); } { @@ -129,7 +129,7 @@ int main() int const * line = boost::get_error_info( x ); BOOST_TEST( line != 0 ); - BOOST_TEST_EQ( *line, 106 ); + BOOST_TEST_EQ( *line, 117 ); } { From 6dca34732ed3db7733313465eb0e1c2723a7910b Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 6 Mar 2026 18:27:05 +0100 Subject: [PATCH 11/16] CMAKE_CXX_MODULE_STD --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 317ac69..9e4e217 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -713,6 +713,7 @@ jobs: -DBUILD_TESTING=ON \ -DBOOST_INCLUDE_LIBRARIES=$LIBRARY \ -DBOOST_USE_MODULES=ON \ + -DCMAKE_CXX_MODULE_STD=ON \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ ${{ matrix.cmake-args }} \ .. @@ -797,6 +798,7 @@ jobs: -DCMAKE_CXX_STANDARD=23 \ -DCMAKE_INSTALL_PREFIX=~/.local \ -DBOOST_USE_MODULES=ON \ + -DCMAKE_CXX_MODULE_STD=ON \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ ${{ matrix.cmake-args }} \ .. @@ -914,7 +916,7 @@ jobs: 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 -DBOOST_USE_MODULES=1 -DCMAKE_CXX_MODULE_STD=ON -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 @@ -968,7 +970,7 @@ jobs: 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 -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix -DCMAKE_CXX_MODULE_STD=ON -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 From 07b5edd279509214f50802709af77e8a0b939577 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 6 Mar 2026 18:27:52 +0100 Subject: [PATCH 12/16] appveyor --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index e325b0e..0384a4c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -62,6 +62,7 @@ install: - git submodule update --init tools/boostdep - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\throw_exception\ - python tools/boostdep/depinst/depinst.py throw_exception + - python libs/throw_exception/tools/setup_boost_with_modules.py # Temporary - cmd /c bootstrap - b2 -d0 headers From a77245e335835e997363ff00d89c3ebd0614f1c9 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 6 Mar 2026 20:50:28 +0100 Subject: [PATCH 13/16] DCMAKE_CXX_SCAN_FOR_MODULES --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e4e217..5a5959e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -714,6 +714,7 @@ jobs: -DBOOST_INCLUDE_LIBRARIES=$LIBRARY \ -DBOOST_USE_MODULES=ON \ -DCMAKE_CXX_MODULE_STD=ON \ + -DCMAKE_CXX_SCAN_FOR_MODULES=ON \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ ${{ matrix.cmake-args }} \ .. @@ -781,6 +782,7 @@ jobs: -DBOOST_INCLUDE_LIBRARIES=$LIBRARY \ -DCMAKE_INSTALL_PREFIX=~/.local \ -DBOOST_USE_MODULES=ON \ + -DCMAKE_CXX_SCAN_FOR_MODULES=ON \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ ${{ matrix.cmake-args }} \ .. @@ -916,7 +918,7 @@ jobs: 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_MODULE_STD=ON -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja .. + cmake -DBOOST_USE_MODULES=1 -DCMAKE_CXX_MODULE_STD=ON -DCMAKE_CXX_SCAN_FOR_MODULES=ON -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 @@ -970,7 +972,7 @@ jobs: 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_MODULE_STD=ON -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja .. + cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix -DCMAKE_CXX_MODULE_STD=ON -DCMAKE_CXX_SCAN_FOR_MODULES=ON -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 From a8f297044da928078fd81c262d773c23e810be37 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 6 Mar 2026 20:56:21 +0100 Subject: [PATCH 14/16] CI cleanup --- .github/workflows/ci.yml | 43 +++++----------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a5959e..c4c2026 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -652,23 +652,6 @@ jobs: 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 @@ -679,7 +662,7 @@ jobs: 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 }} + apt-get install -y --no-install-recommends wget ninja-build git ca-certificates python3 python-is-python3 g++-15 ./tools/install-cmake.sh - name: Setup Boost @@ -716,28 +699,12 @@ jobs: -DCMAKE_CXX_MODULE_STD=ON \ -DCMAKE_CXX_SCAN_FOR_MODULES=ON \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ - ${{ matrix.cmake-args }} \ + -DCMAKE_CXX_COMPILER=g++-15 \ .. 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 @@ -748,7 +715,7 @@ jobs: 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 }} + apt-get install -y --no-install-recommends wget ninja-build git ca-certificates python3 python-is-python3 g++-15 ./tools/install-cmake.sh - name: Setup Boost @@ -784,7 +751,7 @@ jobs: -DBOOST_USE_MODULES=ON \ -DCMAKE_CXX_SCAN_FOR_MODULES=ON \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ - ${{ matrix.cmake-args }} \ + -DCMAKE_CXX_COMPILER=g++-15 \ .. - name: Install @@ -802,7 +769,7 @@ jobs: -DBOOST_USE_MODULES=ON \ -DCMAKE_CXX_MODULE_STD=ON \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ - ${{ matrix.cmake-args }} \ + -DCMAKE_CXX_COMPILER=g++-15 \ .. cmake --build . ctest --output-on-failure --no-tests=error From c3ecd6fcdd6c48b3ff181dd4d8790531b673e68a Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 7 Mar 2026 13:21:10 +0100 Subject: [PATCH 15/16] Fix cmake install usage --- .github/workflows/ci.yml | 6 +----- CMakeLists.txt | 3 +++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4c2026..18315ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -692,9 +692,6 @@ jobs: mkdir __build__ && cd __build__ cmake \ -G Ninja \ - -DCMAKE_CXX_STANDARD=23 \ - -DBUILD_TESTING=ON \ - -DBOOST_INCLUDE_LIBRARIES=$LIBRARY \ -DBOOST_USE_MODULES=ON \ -DCMAKE_CXX_MODULE_STD=ON \ -DCMAKE_CXX_SCAN_FOR_MODULES=ON \ @@ -745,11 +742,9 @@ jobs: mkdir __build__ && cd __build__ cmake \ -G Ninja \ - -DCMAKE_CXX_STANDARD=23 \ -DBOOST_INCLUDE_LIBRARIES=$LIBRARY \ -DCMAKE_INSTALL_PREFIX=~/.local \ -DBOOST_USE_MODULES=ON \ - -DCMAKE_CXX_SCAN_FOR_MODULES=ON \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ -DCMAKE_CXX_COMPILER=g++-15 \ .. @@ -768,6 +763,7 @@ jobs: -DCMAKE_INSTALL_PREFIX=~/.local \ -DBOOST_USE_MODULES=ON \ -DCMAKE_CXX_MODULE_STD=ON \ + -DCMAKE_CXX_SCAN_FOR_MODULES=ON \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ -DCMAKE_CXX_COMPILER=g++-15 \ .. diff --git a/CMakeLists.txt b/CMakeLists.txt index 1acb3e3..9ccea77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,9 @@ target_link_libraries(boost_throw_exception ) if (BOOST_USE_MODULES) + # This library exports only headers even with BOOST_USE_MODULES, + # but consuming it requires 'import std' and defining BOOST_USE_MODULES + target_compile_features(boost_throw_exception INTERFACE cxx_std_23) target_compile_definitions(boost_throw_exception INTERFACE BOOST_USE_MODULES) endif() From 4c87fed0cf12c9d8d08788fe860a005fbff538fc Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 7 Mar 2026 13:22:33 +0100 Subject: [PATCH 16/16] compatibility with older Pythons --- tools/setup_boost_with_modules.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/setup_boost_with_modules.py b/tools/setup_boost_with_modules.py index 18384a1..b1d1679 100644 --- a/tools/setup_boost_with_modules.py +++ b/tools/setup_boost_with_modules.py @@ -1,10 +1,10 @@ -#!/usr/bin/python3 +#!/usr/bin/env python # 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 +from subprocess import check_call import os def main(): @@ -18,9 +18,9 @@ def main(): 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']) + check_call(['git', 'remote', 'add', 'modules', url]) + check_call(['git', 'fetch', '--depth', '1', 'modules', 'feature/cxx20-modules']) + check_call(['git', 'checkout', 'modules/feature/cxx20-modules']) os.chdir('../..')