2
0
mirror of https://github.com/boostorg/dll.git synced 2026-01-19 04:12:08 +00:00

Test CMake in CI and add initial CMakeLists.txt for tests (#100)

This commit is contained in:
Antony Polukhin
2025-06-27 20:39:11 +03:00
committed by GitHub
parent 67ded46a03
commit 4105c3a8f8
4 changed files with 53 additions and 12 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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)

13
test/CMakeLists.txt Normal file
View File

@@ -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)