Skip to content

Commit 4f5df62

Browse files
committed
Add all_verify_interface_header_sets to CI builds
1 parent 00a8a3a commit 4f5df62

File tree

3 files changed

+48
-19
lines changed

3 files changed

+48
-19
lines changed

.github/workflows/ci_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ jobs:
9090
- name: Build Release
9191
run: |
9292
cmake --build build --config Release --verbose
93-
# cmake --build build --config Release --target all_verify_interface_header_sets
93+
cmake --build build --config Release --target all_verify_interface_header_sets
9494
cmake --install build --config Release --prefix /tmp/beman.inplace_vector
9595
find /tmp/beman.inplace_vector -type f
9696
- name: Test Release
9797
run: ctest --test-dir build --build-config Release
9898
- name: Build Debug
9999
run: |
100100
cmake --build build --config Debug --verbose
101-
# cmake --build build --config Debug --target all_verify_interface_header_sets
101+
cmake --build build --config Debug --target all_verify_interface_header_sets
102102
cmake --install build --config Debug --prefix /tmp/beman.inplace_vector
103103
find /tmp/beman.inplace_vector -type f
104104
- name: Test Debug

CMakeLists.txt

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
# cmake-format: on
55

6-
cmake_minimum_required(VERSION 3.23)
6+
set(CMAKE_SKIP_TEST_ALL_DEPENDENCY FALSE)
7+
8+
cmake_minimum_required(VERSION 3.25...3.31)
79

810
project(
911
beman.inplace_vector
@@ -13,6 +15,10 @@ project(
1315
LANGUAGES CXX
1416
)
1517

18+
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
19+
message(FATAL_ERROR "In-source builds are not allowed!")
20+
endif()
21+
1622
# [CMAKE.SKIP_EXAMPLES]
1723
option(
1824
BEMAN_EXEMPLAR_BUILD_EXAMPLES
@@ -27,41 +33,64 @@ option(
2733
${PROJECT_IS_TOP_LEVEL}
2834
)
2935

36+
set(CPACK_GENERATOR TGZ)
37+
38+
# includes
3039
include(GNUInstallDirs)
40+
include(CPack)
3141

3242
add_library(beman.inplace_vector INTERFACE)
3343
# [CMAKE.LIBRARY_ALIAS]
3444
add_library(beman::inplace_vector ALIAS beman.inplace_vector)
3545

36-
target_include_directories(
46+
target_sources(
47+
beman.inplace_vector
48+
PUBLIC
49+
FILE_SET inplace_vector_public_headers
50+
TYPE HEADERS
51+
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
52+
FILES
53+
"${CMAKE_CURRENT_SOURCE_DIR}/include/beman/inplace_vector/inplace_vector.hpp"
54+
)
55+
set_target_properties(
56+
beman.inplace_vector
57+
PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON
58+
)
59+
target_compile_features(
3760
beman.inplace_vector
3861
INTERFACE
39-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
40-
$<INSTALL_INTERFACE:include>
62+
"$<$<COMPILE_FEATURES:cxx_std_23>:cxx_std_23>"
63+
"$<$<NOT:$<COMPILE_FEATURES:cxx_std_23>>:cxx_std_20>"
4164
)
4265

66+
set(TARGET_PACKAGE_NAME ${PROJECT_NAME}-config)
67+
set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-targets)
68+
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
69+
4370
# Install the InplaceVector library to the appropriate destination
4471
install(
4572
TARGETS beman.inplace_vector
4673
EXPORT ${TARGETS_EXPORT_NAME}
47-
DESTINATION
48-
${CMAKE_INSTALL_LIBDIR}
49-
)
50-
51-
# Install the header files to the appropriate destination
52-
install(
53-
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
54-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}
55-
FILES_MATCHING
56-
PATTERN
57-
"${CMAKE_CURRENT_SOURCE_DIR}/include/beman/inplace_vector/inplace_vector.hpp"
74+
FILE_SET inplace_vector_public_headers
5875
)
5976

6077
if(BEMAN_INPLACE_VECTOR_BUILD_TESTS)
61-
include(CTest)
78+
enable_testing()
6279
add_subdirectory(tests/beman/inplace_vector)
6380
endif()
6481

6582
if(BEMAN_EXEMPLAR_BUILD_EXAMPLES)
6683
add_subdirectory(examples)
6784
endif()
85+
86+
# Coverage
87+
configure_file(cmake/gcovr.cfg.in gcovr.cfg @ONLY)
88+
89+
add_custom_target(
90+
process_coverage
91+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
92+
DEPENDS test
93+
COMMENT "Running gcovr to process coverage results"
94+
COMMAND mkdir -p coverage
95+
COMMAND gcovr --config gcovr.cfg .
96+
)

include/beman/inplace_vector/inplace_vector.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ struct inplace_vector_destruct_base {
7474
inplace_vector_destruct_base(
7575
const inplace_vector_destruct_base
7676
&&other) noexcept(std::is_nothrow_move_constructible_v<T>)
77-
: elems(), size_(other.size()) {}
77+
: elems(), size_(other.size_) {}
7878

7979
inplace_vector_destruct_base &
8080
operator=(const inplace_vector_destruct_base &other) noexcept(

0 commit comments

Comments
 (0)