Skip to content

Commit 5ed337e

Browse files
committed
CI: adopt boost-cli GHA
1 parent 44475ab commit 5ed337e

File tree

11 files changed

+863
-148
lines changed

11 files changed

+863
-148
lines changed

.github/workflows/ci.yml

Lines changed: 455 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/main.yml

Lines changed: 0 additions & 113 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,68 @@
1-
# Copyright (c) 2018-2025 Jean-Louis Leroy
1+
# Generated by `boostdep --cmake openmethod`
2+
# Copyright 2020, 2021 Peter Dimov
23
# Distributed under the Boost Software License, Version 1.0.
3-
# See accompanying file LICENSE_1_0.txt
4-
# or copy at http://www.boost.org/LICENSE_1_0.txt)
4+
# https://www.boost.org/LICENSE_1_0.txt
55

6-
cmake_minimum_required(VERSION 3.10)
6+
cmake_minimum_required(VERSION 3.5...3.20)
77

8-
if(POLICY CMP0167)
9-
cmake_policy(SET CMP0074 NEW)
8+
project(boost_openmethod VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
9+
10+
set(BOOST_OPENMETHOD_IS_ROOT OFF)
11+
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
12+
set(BOOST_OPENMETHOD_IS_ROOT ON)
1013
endif()
1114

12-
if(POLICY CMP0167)
13-
cmake_policy(SET CMP0167 NEW)
15+
if(BOOST_OPENMETHOD_IS_ROOT)
16+
include(CTest)
17+
endif()
18+
if(NOT BOOST_SUPERPROJECT_VERSION)
19+
option(BOOST_OPENMETHOD_INSTALL "Install boost::openmethod files" ON)
20+
option(BOOST_OPENMETHOD_BUILD_TESTS "Build boost::openmethod tests" ${BUILD_TESTING})
21+
option(BOOST_OPENMETHOD_BUILD_EXAMPLES "Build boost::openmethod examples" ${BOOST_OPENMETHOD_IS_ROOT})
22+
else()
23+
set(BOOST_OPENMETHOD_BUILD_TESTS ${BUILD_TESTING})
1424
endif()
1525

16-
project(boost_openmethod VERSION 1.87.0 LANGUAGES CXX)
26+
if(BOOST_OPENMETHOD_IS_ROOT)
27+
#
28+
# Building inside Boost tree, but as a separate project e.g. on Travis or
29+
# other CI, or when producing Visual Studio Solution and Projects.
1730

18-
if(NOT CMAKE_CXX_STANDARD)
19-
set(CMAKE_CXX_STANDARD 17)
31+
set(BOOST_INCLUDE_LIBRARIES openmethod)
32+
set(BOOST_EXCLUDE_LIBRARIES openmethod)
33+
list(APPEND BOOST_INCLUDE_LIBRARIES test)
34+
if(BOOST_OPENMETHOD_BUILD_EXAMPLES)
35+
# list(APPEND BOOST_INCLUDE_LIBRARIES optional)
36+
endif()
37+
38+
set(CMAKE_FOLDER _deps)
39+
add_subdirectory(../.. _deps/boost EXCLUDE_FROM_ALL)
40+
unset(CMAKE_FOLDER)
2041
endif()
21-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2242

2343
add_library(boost_openmethod INTERFACE)
2444
add_library(Boost::openmethod ALIAS boost_openmethod)
2545

26-
target_include_directories(boost_openmethod INTERFACE include)
27-
28-
find_package(Boost COMPONENTS)
29-
target_link_libraries(boost_openmethod INTERFACE Boost::boost)
46+
target_compile_features(boost_openmethod INTERFACE cxx_std_17)
3047

31-
if(MSVC)
32-
add_compile_options(/EHsc /FAs /bigobj)
33-
endif()
48+
target_include_directories(boost_openmethod INTERFACE include)
3449

35-
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
36-
message(STATUS "Enabling sanitizers")
37-
add_compile_options(
38-
-fPIC -Wno-deprecated-declarations -Wall -Wextra -Werror
39-
-fsanitize=undefined -fsanitize=address -fsanitize=leak)
40-
add_link_options(-fsanitize=undefined -fsanitize=address -fsanitize=leak)
41-
endif()
50+
target_link_libraries(
51+
boost_openmethod
52+
INTERFACE
53+
Boost::assert
54+
Boost::config
55+
Boost::core
56+
Boost::dynamic_bitset
57+
Boost::mp11
58+
Boost::preprocessor
59+
)
4260

43-
if(BUILD_TESTING)
44-
message(STATUS "Building tests")
45-
include(CTest)
61+
if(BOOST_OPENMETHOD_BUILD_TESTS)
4662
enable_testing()
4763
add_subdirectory(test)
4864
endif()
4965

50-
if(BUILD_EXAMPLES)
51-
message(STATUS "Building examples")
66+
if(BOOST_OPENMETHOD_BUILD_EXAMPLES)
5267
add_subdirectory(example)
5368
endif()

meta/libraries.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"key": "openmethod",
3+
"name": "OpenMethod",
4+
"authors": [
5+
"Jean-Louis Leroy"
6+
],
7+
"maintainers": [
8+
"Jean-Louis Leroy"
9+
],
10+
"description": "Open methods for C++17 and above.",
11+
"category": [
12+
"Programming"
13+
],
14+
"cxxstd": "17"
15+
}

test/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@
33
# See accompanying file LICENSE_1_0.txt
44
# or copy at http://www.boost.org/LICENSE_1_0.txt)
55

6+
if(NOT TARGET tests)
7+
add_custom_target(tests ${EXCLUDE_TESTS_FROM_ALL})
8+
set_property(TARGET tests PROPERTY FOLDER _deps)
9+
endif()
10+
611
file(GLOB test_cpp_files "test_*.cpp")
12+
713
foreach(test_cpp ${test_cpp_files})
814
cmake_path(REMOVE_EXTENSION test_cpp LAST_ONLY OUTPUT_VARIABLE test)
915
string(REGEX REPLACE ".*/" "" test ${test})
1016
add_executable(${test} ${test_cpp})
11-
target_link_libraries(${test} Boost::openmethod)
17+
target_link_libraries(${test} Boost::openmethod Boost::unit_test_framework)
1218
add_test(NAME ${test} COMMAND ${test})
19+
add_dependencies(tests ${test})
1320
endforeach()

test/Jamfile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,21 @@ project
2525
# <toolset>clang:<warnings-as-errors>on
2626
;
2727

28-
# list
28+
alias unit_test_framework
29+
: # sources
30+
/boost/test//boost_unit_test_framework
31+
;
32+
2933
for local src in [ glob test_*.cpp ]
3034
{
31-
run $(src) ;
35+
run $(src) unit_test_framework ;
36+
}
37+
38+
for local src in [ glob compile_fail_*.cpp ]
39+
{
40+
compile-fail $(src) ;
3241
}
3342

3443
# quick (for CI)
35-
alias quick : test_blackbox ;
44+
alias quick : test_dispatch ;
3645
explicit quick ;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2018, 2019, 2021 Peter Dimov
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
4+
5+
cmake_minimum_required(VERSION 3.5...3.20)
6+
7+
project(cmake_install_test LANGUAGES CXX)
8+
9+
find_package(boost_openmethod REQUIRED)
10+
11+
add_executable(main main.cpp)
12+
target_link_libraries(main Boost::openmethod)
13+
14+
enable_testing()
15+
add_test(main main)
16+
17+
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

0 commit comments

Comments
 (0)