From b7632bebb0316566f850a1459334e0d7faf93b76 Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Mon, 6 Oct 2025 20:51:38 +0300 Subject: [PATCH 1/5] Drop dependency on Boost.SmartPtr as it is not used by the library for some time --- CMakeLists.txt | 1 - build.jam | 1 - test/Jamfile.v2 | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dfde0f6a..731bac9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,5 @@ target_link_libraries( boost_conversion INTERFACE Boost::assert Boost::config - Boost::smart_ptr Boost::throw_exception ) diff --git a/build.jam b/build.jam index a266ab2c..6c21796a 100644 --- a/build.jam +++ b/build.jam @@ -8,7 +8,6 @@ require-b2 5.2 ; constant boost_dependencies : /boost/assert//boost_assert /boost/config//boost_config - /boost/smart_ptr//boost_smart_ptr /boost/throw_exception//boost_throw_exception ; project /boost/conversion diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 3dd61b02..15c2ab88 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -26,6 +26,6 @@ test-suite conversion : [ run implicit_cast.cpp ] [ compile-fail implicit_cast_fail.cpp ] [ run cast_test.cpp ] - [ run polymorphic_cast_test.cpp ] + [ run polymorphic_cast_test.cpp : : : /boost/smart_ptr//boost_smart_ptr ] [ compile-fail implicit_cast_fail2.cpp ] ; From aa7fd82315afc542a561b7caa46605f8b4550252 Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Tue, 7 Oct 2025 13:24:46 +0300 Subject: [PATCH 2/5] Harden the CI and add CMake tests --- .github/workflows/ci.yml | 38 +++++++++++++++++++++++++++++++++----- CMakeLists.txt | 6 +++++- test/CMakeLists.txt | 17 +++++++++++++++++ 3 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 test/CMakeLists.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da44d53c..0dc8923f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,9 @@ jobs: fail-fast: false matrix: include: + - 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 - toolset: gcc-12 cxxstd: "03,11,14,17,2a" os: ubuntu-22.04 @@ -59,9 +62,20 @@ jobs: cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY python tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools --git_args "--depth 10 --jobs 3" $LIBRARY ./bootstrap.sh - ./b2 -d0 headers ./b2 -j4 variant=debug tools/inspect + - name: Run CMake tests + if: ${{matrix.toolset == 'gcc-14'}} + run: | + cd ../boost-root/ + mkdir __build + cd __build + cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=conversion -DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_C_COMPILER=gcc-14 .. + cmake --build . --target tests + ctest --output-on-failure --no-tests=error + cd .. + rm -rf __build + - name: Run tests run: | cd ../boost-root @@ -101,14 +115,14 @@ jobs: fail-fast: false matrix: include: - - toolset: msvc-14.2 + - toolset: msvc-14.3 cxxstd: "14,17,latest" addrmd: 32,64 - os: windows-2019 + os: windows-2025 - toolset: gcc cxxstd: "03,11,14,17,2a" addrmd: 64 - os: windows-2019 + os: windows-2025 runs-on: ${{matrix.os}} @@ -135,7 +149,21 @@ jobs: git submodule update --init tools/boostdep python tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools --git_args "--jobs 3" %LIBRARY% cmd /c bootstrap - b2 -d0 headers + + - name: Run CMake tests + if: ${{matrix.toolset == 'msvc-14.3'}} + shell: cmd + run: | + choco install --no-progress ninja + call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64 + cd ../boost-root/ + mkdir __build + cd __build + cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=conversion .. + cmake --build . --target tests --config Debug + ctest --output-on-failure --no-tests=error -C Debug + cd .. + rm -rf __build - name: Run tests shell: cmd diff --git a/CMakeLists.txt b/CMakeLists.txt index 731bac9d..d8da837f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt -cmake_minimum_required( VERSION 3.5...3.20 ) +cmake_minimum_required( VERSION 3.5...4.20 ) project( boost_conversion VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX ) add_library( boost_conversion INTERFACE ) @@ -16,3 +16,7 @@ target_link_libraries( boost_conversion Boost::config Boost::throw_exception ) + +if(BUILD_TESTING) + add_subdirectory(test) +endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000..0f09f8b2 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,17 @@ +# Copyright (c) 2016-2025 Antony Polukhin +# 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 + +include(BoostTest OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) + +if(NOT HAVE_BOOST_TEST) + return() +endif() + +set(BOOST_TEST_LINK_LIBRARIES Boost::conversion) + +boost_test(TYPE run SOURCES cast_test.cpp) +boost_test(TYPE run SOURCES implicit_cast.cpp) +boost_test(TYPE compile-fail SOURCES implicit_cast_fail.cpp) +boost_test(TYPE compile-fail SOURCES implicit_cast_fail2.cpp) +boost_test(TYPE run SOURCES polymorphic_cast_test.cpp LINK_LIBRARIES Boost::smart_ptr) From 1026bcca6df0a1d112f33f32bf57e9eb66e0f31a Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Tue, 7 Oct 2025 14:07:49 +0300 Subject: [PATCH 3/5] Fixes --- test/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0f09f8b2..487755e2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -10,8 +10,8 @@ endif() set(BOOST_TEST_LINK_LIBRARIES Boost::conversion) -boost_test(TYPE run SOURCES cast_test.cpp) +boost_test(TYPE run SOURCES cast_test.cpp LINK_LIBRARIES Boost::core) boost_test(TYPE run SOURCES implicit_cast.cpp) boost_test(TYPE compile-fail SOURCES implicit_cast_fail.cpp) boost_test(TYPE compile-fail SOURCES implicit_cast_fail2.cpp) -boost_test(TYPE run SOURCES polymorphic_cast_test.cpp LINK_LIBRARIES Boost::smart_ptr) +boost_test(TYPE run SOURCES polymorphic_cast_test.cpp LINK_LIBRARIES Boost::core Boost::smart_ptr) From a266110fa1dff94e508cc95dd341f3aa91419ee5 Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Tue, 7 Oct 2025 14:24:57 +0300 Subject: [PATCH 4/5] fix --- test/implicit_cast.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/implicit_cast.cpp b/test/implicit_cast.cpp index cf4cb940..92f21607 100644 --- a/test/implicit_cast.cpp +++ b/test/implicit_cast.cpp @@ -4,8 +4,9 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include +#include #include + using boost::implicit_cast; using boost::type; From 58c787a5301ba421f8050a5fdc80a5e9bda8ccac Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Tue, 7 Oct 2025 15:01:47 +0300 Subject: [PATCH 5/5] fix --- test/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 487755e2..7391415c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,10 +8,10 @@ if(NOT HAVE_BOOST_TEST) return() endif() -set(BOOST_TEST_LINK_LIBRARIES Boost::conversion) +set(BOOST_TEST_LINK_LIBRARIES Boost::conversion Boost::core) -boost_test(TYPE run SOURCES cast_test.cpp LINK_LIBRARIES Boost::core) +boost_test(TYPE run SOURCES cast_test.cpp) boost_test(TYPE run SOURCES implicit_cast.cpp) boost_test(TYPE compile-fail SOURCES implicit_cast_fail.cpp) boost_test(TYPE compile-fail SOURCES implicit_cast_fail2.cpp) -boost_test(TYPE run SOURCES polymorphic_cast_test.cpp LINK_LIBRARIES Boost::core Boost::smart_ptr) +boost_test(TYPE run SOURCES polymorphic_cast_test.cpp LINK_LIBRARIES Boost::smart_ptr)