diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99859e6a..19f845ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: fail-fast: false matrix: include: - - toolset: gcc-14 + - toolset: gcc-14 # Do not remove! It is the only toolset that tests CMake tests down below cxxstd: "11,14,17,2a" os: ubuntu-24.04 # UBSAN complains on vtables and fails. No ',undefined -fno-sanitize-recover=undefined' flags! @@ -92,6 +92,18 @@ jobs: ./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=dll -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e5b2ed7..0a717471 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,12 +10,9 @@ project(boost_dll VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) option(BOOST_DLL_USE_STD_FS "Use std::filesystem instead of Boost.Filesystem" OFF) -add_library(boost_dll INTERFACE) -add_library(Boost::dll ALIAS boost_dll) - -target_include_directories(boost_dll INTERFACE include) - -target_link_libraries(boost_dll +add_library(boost_dll_base INTERFACE) +target_include_directories(boost_dll_base INTERFACE include) +target_link_libraries(boost_dll_base INTERFACE Boost::assert Boost::config @@ -28,13 +25,32 @@ target_link_libraries(boost_dll ${CMAKE_DL_LIBS} ) + +add_library(boost_dll_std_fs INTERFACE) +target_link_libraries(boost_dll_std_fs + INTERFACE + boost_dll_base +) +target_compile_definitions(boost_dll_std_fs INTERFACE BOOST_DLL_USE_STD_FS) +target_compile_features(boost_dll_std_fs INTERFACE cxx_std_17) + +add_library(boost_dll_boost_fs INTERFACE) +target_link_libraries(boost_dll_boost_fs + INTERFACE + boost_dll_base + Boost::filesystem +) + + +add_library(boost_dll INTERFACE) if(BOOST_DLL_USE_STD_FS) - target_compile_definitions(boost_dll INTERFACE BOOST_DLL_USE_STD_FS) - target_compile_features(boost_dll INTERFACE cxx_std_17) + target_link_libraries(boost_dll INTERFACE boost_dll_std_fs) else() - target_link_libraries(boost_dll INTERFACE Boost::filesystem) + target_link_libraries(boost_dll INTERFACE boost_dll_boost_fs) endif() +add_library(Boost::dll ALIAS boost_dll) + if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt") add_subdirectory(test) diff --git a/README.md b/README.md index de5b9c0a..98ac6049 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ Boost.DLL is a part of the [Boost C++ Libraries](https://github.com/boostorg). I Branches | Build | Tests coverage | More info ----------------|-------------- | -------------- |----------- -Develop: | [![CI](https://github.com/apolukhin/Boost.DLL/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/apolukhin/Boost.DLL/actions/workflows/ci.yml) [![Build status](https://ci.appveyor.com/api/projects/status/t6q6yhcabtk5b99l/branch/develop?svg=true)](https://ci.appveyor.com/project/apolukhin/boost-dll/branch/develop) | [![Coverage Status](https://coveralls.io/repos/apolukhin/Boost.DLL/badge.png?branch=develop)](https://coveralls.io/r/apolukhin/Boost.DLL?branch=develop) | [details...](https://www.boost.org/development/tests/develop/developer/dll.html) -Master: | [![CI](https://github.com/apolukhin/Boost.DLL/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/apolukhin/Boost.DLL/actions/workflows/ci.yml) [![Build status](https://ci.appveyor.com/api/projects/status/t6q6yhcabtk5b99l/branch/master?svg=true)](https://ci.appveyor.com/project/apolukhin/boost-dll/branch/master) | [![Coverage Status](https://coveralls.io/repos/apolukhin/Boost.DLL/badge.png?branch=master)](https://coveralls.io/r/apolukhin/Boost.DLL?branch=master) | [details...](https://www.boost.org/development/tests/master/developer/dll.html) +Develop: | [![CI](https://github.com/apolukhin/Boost.DLL/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/apolukhin/Boost.DLL/actions/workflows/ci.yml) [![Build status](https://ci.appveyor.com/api/projects/status/t6q6yhcabtk5b99l/branch/develop?svg=true)](https://ci.appveyor.com/project/apolukhin/boost-dll/branch/develop) | [![Coverage Status](https://coveralls.io/repos/apolukhin/Boost.DLL/badge.png?branch=develop)](https://coveralls.io/r/apolukhin/Boost.DLL?branch=develop) | [details...](https://regression.boost.io/develop/developer/dll.html) +Master: | [![CI](https://github.com/apolukhin/Boost.DLL/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/apolukhin/Boost.DLL/actions/workflows/ci.yml) [![Build status](https://ci.appveyor.com/api/projects/status/t6q6yhcabtk5b99l/branch/master?svg=true)](https://ci.appveyor.com/project/apolukhin/boost-dll/branch/master) | [![Coverage Status](https://coveralls.io/repos/apolukhin/Boost.DLL/badge.png?branch=master)](https://coveralls.io/r/apolukhin/Boost.DLL?branch=master) | [details...](https://regression.boost.io/master/developer/dll.html) [Latest developer documentation](https://www.boost.org/doc/libs/develop/doc/html/boost_dll.html) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000..bfb195be --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,13 @@ +# 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 + +if(NOT TARGET tests) + add_custom_target(tests) +endif() + +add_executable(dll_tests_cpp_mangling "cpp_mangling.cpp") +target_link_libraries(dll_tests_cpp_mangling Boost::dll) +add_test(NAME dll_tests_cpp_mangling COMMAND dll_tests_cpp_mangling) +add_dependencies(tests dll_tests_cpp_mangling) +