Skip to content

Commit 5cffcdb

Browse files
authored
Merge pull request bemanproject#75 from steve-downey/verify_headers
Verify headers
2 parents ebf043c + af29583 commit 5cffcdb

File tree

12 files changed

+109
-58
lines changed

12 files changed

+109
-58
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,27 @@ jobs:
8383
echo ${{ matrix.config.cmake_args }}
8484
echo ${{ matrix.config.toolchain }}
8585
rm -rf .build
86-
cmake ${{ matrix.config.cmake_args }} -DCMAKE_TOOLCHAIN_FILE="etc/${{ matrix.config.toolchain }}-toolchain.cmake" -B .build -S .
87-
- name: CMake Build
86+
cmake ${{ matrix.config.cmake_args }} -DCMAKE_INSTALL_PREFIX=.install -DCMAKE_TOOLCHAIN_FILE="etc/${{ matrix.config.toolchain }}-toolchain.cmake" -B .build -S .
87+
- name: CMake ASAN Build
8888
run: |
8989
set -x
90+
cmake --build .build --config Asan --target all_verify_interface_header_sets -- -k 0
9091
cmake --build .build --config Asan --target all -- -k 0
91-
- name: CMake Test
92+
- name: CMake ASAN Test
9293
run: |
9394
set -x
9495
[[ ! -z "${{ matrix.config.asan_options }}" ]] && export ASAN_OPTIONS="${{ matrix.config.asan_options }}"
9596
ctest --build-config Asan --output-on-failure --test-dir .build
97+
- name: CMake RWDI Build
98+
run: |
99+
set -x
100+
cmake --build .build --config RelWithDebInfo --target all_verify_interface_header_sets -- -k 0
101+
cmake --build .build --config RelWithDebInfo --target all -- -k 0
102+
- name: CMake RWDI Test
103+
run: |
104+
set -x
105+
ctest --build-config RelWithDebInfo --output-on-failure --test-dir .build
106+
- name: Install
107+
run: |
108+
set -x
109+
cmake --install .build --config RelWithDebInfo --component beman_optional26_development --verbose

CMakeLists.txt

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ if(OPTIONAL26_ENABLE_TESTING)
3131
FetchContent_MakeAvailable(googletest)
3232
endif()
3333

34+
set(CMAKE_VERIFY_INTERFACE_HEADER_SETS ON)
35+
3436
# Create the library target and named header set for beman_optional26
35-
add_library(beman_optional26 STATIC)
37+
add_library(beman_optional26 INTERFACE)
3638
target_sources(
3739
beman_optional26
38-
PUBLIC FILE_SET beman_optional26_headers TYPE HEADERS BASE_DIRS src include
40+
PUBLIC FILE_SET beman_optional26_headers TYPE HEADERS BASE_DIRS include
3941
)
4042

4143
if(OPTIONAL26_ENABLE_TESTING)
@@ -49,13 +51,33 @@ if(OPTIONAL26_ENABLE_TESTING)
4951
TYPE HEADERS
5052
BASE_DIRS src
5153
)
54+
55+
add_subdirectory(src/beman/optional26/tests)
5256
endif()
5357

54-
add_subdirectory(src/beman/optional26)
5558
add_subdirectory(include/beman/optional26)
5659

5760
add_subdirectory(examples)
5861

62+
include(CMakePackageConfigHelpers)
63+
64+
# This will be used to replace @PACKAGE_cmakeModulesDir@
65+
set(cmakeModulesDir cmake/beman)
66+
configure_package_config_file(
67+
cmake/Config.cmake.in
68+
BemanOptional26Config.cmake
69+
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/beman/optional26/
70+
PATH_VARS cmakeModulesDir
71+
NO_SET_AND_CHECK_MACRO
72+
NO_CHECK_REQUIRED_COMPONENTS_MACRO
73+
)
74+
75+
install(
76+
FILES ${CMAKE_CURRENT_BINARY_DIR}/BemanOptional26Config.cmake
77+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/beman/optional26/
78+
COMPONENT beman_optional26_development
79+
)
80+
5981
# Coverage
6082
configure_file("cmake/gcovr.cfg.in" gcovr.cfg @ONLY)
6183

CMakePresets.json

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,38 @@
8585
{
8686
"name": "common",
8787
"hidden": true,
88-
"configuration": "Asan"
88+
"configuration": "Asan",
89+
"targets": [
90+
"all_verify_interface_header_sets",
91+
"all"
92+
]
8993
},
9094
{
9195
"name": "system",
9296
"inherits": "common",
93-
"configurePreset": "system"
97+
"configurePreset": "system",
98+
"targets": [
99+
"all_verify_interface_header_sets",
100+
"all"
101+
]
94102
},
95103
{
96104
"name": "gcc-14",
97105
"inherits": "common",
98-
"configurePreset": "gcc-14"
106+
"configurePreset": "gcc-14",
107+
"targets": [
108+
"all_verify_interface_header_sets",
109+
"all"
110+
]
99111
},
100112
{
101113
"name": "gcc-13",
102114
"inherits": "common",
103-
"configurePreset": "gcc-13"
115+
"configurePreset": "gcc-13",
116+
"targets": [
117+
"all_verify_interface_header_sets",
118+
"all"
119+
]
104120
},
105121
{
106122
"name": "gcc-12",
@@ -115,22 +131,38 @@
115131
{
116132
"name": "clang-19",
117133
"inherits": "common",
118-
"configurePreset": "clang-19"
134+
"configurePreset": "clang-19",
135+
"targets": [
136+
"all_verify_interface_header_sets",
137+
"all"
138+
]
119139
},
120140
{
121141
"name": "clang-18",
122142
"inherits": "common",
123-
"configurePreset": "clang-18"
143+
"configurePreset": "clang-18",
144+
"targets": [
145+
"all_verify_interface_header_sets",
146+
"all"
147+
]
124148
},
125149
{
126150
"name": "clang-17",
127151
"inherits": "common",
128-
"configurePreset": "clang-17"
152+
"configurePreset": "clang-17",
153+
"targets": [
154+
"all_verify_interface_header_sets",
155+
"all"
156+
]
129157
},
130158
{
131159
"name": "clang-16",
132160
"inherits": "common",
133161
"configurePreset": "clang-16"
162+
"targets": [
163+
"all_verify_interface_header_sets",
164+
"all"
165+
]
134166
}
135167
],
136168
"testPresets": [

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ $(_build_path)/CMakeCache.txt: | $(_build_path) .gitmodules
6161

6262
TARGET:=all
6363
compile: $(_build_path)/CMakeCache.txt ## Compile the project
64+
cmake --build $(_build_path) --config $(CONFIG) --target all_verify_interface_header_sets -- -k 0
6465
cmake --build $(_build_path) --config $(CONFIG) --target all -- -k 0
6566

6667
install: $(_build_path)/CMakeCache.txt compile ## Install the project

cmake/Config.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# cmake/Config.cmake.in -*-makefile-*-
1+
# cmake/Config.cmake.in -*-cmake-*-
22
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

44
@PACKAGE_INIT@

include/beman/optional26/CMakeLists.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,29 @@ target_sources(
1313
detail/stl_interfaces/fwd.hpp
1414
detail/stl_interfaces/iterator_interface.hpp
1515
)
16+
17+
install(
18+
TARGETS beman_optional26
19+
FILE_SET beman_optional26_headers
20+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
21+
COMPONENT beman_optional26_development
22+
)
23+
24+
install(
25+
TARGETS beman_optional26
26+
EXPORT beman_optional26_export
27+
DESTINATION
28+
${CMAKE_INSTALL_LIBDIR}
29+
FILE_SET beman_optional26_headers
30+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
31+
COMPONENT beman_optional26_development
32+
)
33+
34+
install(
35+
EXPORT beman_optional26_export
36+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/beman/optional26/
37+
NAMESPACE Beman::Optional26::
38+
FILE beman_optional26.cmake
39+
EXPORT_LINK_INTERFACE_LIBRARIES
40+
COMPONENT beman_optional26_development
41+
)

src/beman/optional26/CMakeLists.txt

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

src/beman/optional26/detail/iterator.cpp

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

src/beman/optional26/optional.cpp

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

src/beman/optional26/tests/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ target_sources(
1717
optional_range_support.t.cpp
1818
optional_ref.t.cpp
1919
optional_ref_monadic.t.cpp
20-
test_types.cpp
21-
test_utilities.cpp
2220
)
2321

2422
target_sources(

0 commit comments

Comments
 (0)