Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 33 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -68,9 +71,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=any -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 modules tests wihtout 'import std;'
if: ${{matrix.toolset == 'clang-19'}}
run: |
Expand Down Expand Up @@ -135,14 +149,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
- toolset: msvc-14.3
cxxstd: "14,17,20,latest"
addrmd: 32,64
Expand Down Expand Up @@ -173,7 +187,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=any ..
cmake --build . --target tests --config Debug
ctest --output-on-failure --no-tests=error -C Debug
cd ..
rm -rf __build

- name: Run modules tests
if: ${{matrix.toolset == 'msvc-14.3'}}
Expand Down
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ target_link_libraries( boost_any

add_library( Boost::any ALIAS boost_any )

enable_testing()
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")

add_subdirectory(test)

if(BUILD_TESTING)
add_subdirectory(test)
endif()
49 changes: 49 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# 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::any Boost::core)

boost_test(TYPE run SOURCES any_test.cpp)
boost_test(TYPE run SOURCES any_test.cpp COMPILE_OPTIONS "-fno-rtti" NAME any_test_no_rtti )

boost_test(TYPE run SOURCES any_test_rv.cpp)
boost_test(TYPE run SOURCES any_test_rv.cpp COMPILE_OPTIONS "-fno-rtti" NAME any_test_rv_no_rtti)
boost_test(TYPE run SOURCES any_test_mplif.cpp)
boost_test(TYPE compile-fail SOURCES any_cast_cv_failed.cpp)
boost_test(TYPE compile-fail SOURCES any_test_temporary_to_ref_failed.cpp)
boost_test(TYPE compile-fail SOURCES any_test_cv_to_rv_failed.cpp)
boost_test(TYPE run SOURCES basic_any_test.cpp)
boost_test(TYPE run SOURCES basic_any_test.cpp COMPILE_OPTIONS "-fno-rtti" NAME basic_any_test_no_rtti)
boost_test(TYPE run SOURCES basic_any_test_rv.cpp)
boost_test(TYPE run SOURCES basic_any_test_rv.cpp COMPILE_OPTIONS "-fno-rtti" NAME basic_any_test_rv_no_rtti)
boost_test(TYPE run SOURCES basic_any_test_mplif.cpp)
boost_test(TYPE run SOURCES basic_any_test_large_object.cpp)
boost_test(TYPE run SOURCES basic_any_test_small_object.cpp)
boost_test(TYPE compile-fail SOURCES basic_any_cast_cv_failed.cpp)
boost_test(TYPE compile-fail SOURCES basic_any_test_alignment_power_of_two_failed.cpp)
boost_test(TYPE compile-fail SOURCES basic_any_test_cv_to_rv_failed.cpp)
boost_test(TYPE compile-fail SOURCES basic_any_test_multiply_size_failed.cpp)
boost_test(TYPE compile-fail SOURCES basic_any_test_size_alignment_zero_failed.cpp)
boost_test(TYPE compile-fail SOURCES basic_any_test_size_less_alignment_failed.cpp)
boost_test(TYPE compile-fail SOURCES basic_any_test_temporary_to_ref_failed.cpp)

boost_test(TYPE compile-fail SOURCES any_from_basic_any.cpp)
boost_test(TYPE compile-fail SOURCES any_to_basic_any.cpp)
boost_test(TYPE compile-fail SOURCES basic_any_from_any.cpp)
boost_test(TYPE compile-fail SOURCES basic_any_to_any.cpp)
boost_test(TYPE compile-fail SOURCES any_from_basic_any_rv.cpp)
boost_test(TYPE compile-fail SOURCES any_to_basic_any_rv.cpp)
boost_test(TYPE compile-fail SOURCES basic_any_from_any_rv.cpp)
boost_test(TYPE compile-fail SOURCES basic_any_to_any_rv.cpp)

boost_test(TYPE compile-fail SOURCES basic_any_from_basic_any.cpp)
boost_test(TYPE compile-fail SOURCES basic_any_to_basic_any.cpp)
boost_test(TYPE compile-fail SOURCES basic_any_from_basic_any_rv.cpp)
boost_test(TYPE compile-fail SOURCES basic_any_to_basic_any_rv.cpp)