Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ jobs:
- name: Build Release
run: |
cmake --build build --config Release --verbose
# TODO: cmake --build build --config Release --target all_verify_interface_header_sets
cmake --build build --config Release --target all_verify_interface_header_sets
cmake --install build --config Release --prefix /tmp/beman.inplace_vector
find /tmp/beman.inplace_vector -type f
- name: Test Release
run: ctest --test-dir build --build-config Release
- name: Build Debug
run: |
cmake --build build --config Debug --verbose
# TODO: cmake --build build --config Debug --target all_verify_interface_header_sets
cmake --build build --config Debug --target all_verify_interface_header_sets
cmake --install build --config Debug --prefix /tmp/beman.inplace_vector
find /tmp/beman.inplace_vector -type f
- name: Test Debug
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/build
/out
CMakeUserPresets.json
CMakeCache.txt
CMakeFiles/
57 changes: 40 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# cmake-format: on

cmake_minimum_required(VERSION 3.23)
set(CMAKE_SKIP_TEST_ALL_DEPENDENCY FALSE)

cmake_minimum_required(VERSION 3.25...3.31)
Comment on lines -6 to +8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please exclude changes unrelated to adding gcov target

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


project(
beman.inplace_vector
Expand All @@ -13,6 +15,10 @@ project(
LANGUAGES CXX
)

if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds are not allowed!")
endif()
Comment on lines +18 to +20
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please exclude changes unrelated to adding gcov target...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not done. Please exclude.


# [CMAKE.SKIP_EXAMPLES]
option(
BEMAN_EXEMPLAR_BUILD_EXAMPLES
Expand All @@ -27,41 +33,58 @@ option(
${PROJECT_IS_TOP_LEVEL}
)

set(CPACK_GENERATOR TGZ)

include(GNUInstallDirs)
include(CPack)

add_library(beman.inplace_vector INTERFACE)
# [CMAKE.LIBRARY_ALIAS]
add_library(beman::inplace_vector ALIAS beman.inplace_vector)

target_include_directories(
target_sources(
beman.inplace_vector
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PUBLIC
FILE_SET inplace_vector_public_headers
TYPE HEADERS
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/include/beman/inplace_vector/inplace_vector.hpp"
)
set_target_properties(
beman.inplace_vector
PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON
)
target_compile_features(beman.inplace_vector INTERFACE cxx_std_23)

set(TARGET_PACKAGE_NAME ${PROJECT_NAME}-config)
set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-targets)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})

# Install the InplaceVector library to the appropriate destination
install(
TARGETS beman.inplace_vector
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION
${CMAKE_INSTALL_LIBDIR}
)

# Install the header files to the appropriate destination
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}
FILES_MATCHING
PATTERN
"${CMAKE_CURRENT_SOURCE_DIR}/include/beman/inplace_vector/inplace_vector.hpp"
FILE_SET inplace_vector_public_headers
Comment on lines -47 to +68
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please exclude changes unrelated to adding gcov target

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please exclude

)

if(BEMAN_INPLACE_VECTOR_BUILD_TESTS)
include(CTest)
enable_testing()
add_subdirectory(tests/beman/inplace_vector)
endif()

if(BEMAN_EXEMPLAR_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()

# Coverage
configure_file(cmake/gcovr.cfg.in gcovr.cfg @ONLY)

add_custom_target(
process_coverage
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we test this in CI? Its fine if this doesn't have like a nice reporting interface, but can you add a CI target to ensure this cmake target doesn't fail?

Also can you update README regarding this target?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a CI job to test this.

WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS test
COMMENT "Running gcovr to process coverage results"
COMMAND mkdir -p coverage
COMMAND gcovr --config gcovr.cfg .
)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ TODO: tested platforms.

```text
# Configure build
$ cmake -S . -B build -DCMAKE_CXX_STANDARD=20
$ cmake -S . -B build -DCMAKE_CXX_STANDARD=23
-- The CXX compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
Expand Down
12 changes: 12 additions & 0 deletions cmake/gcovr.cfg.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception.

root = @CMAKE_SOURCE_DIR@
cobertura = @CMAKE_BINARY_DIR@/coverage/cobertura.xml
sonarqube = @CMAKE_BINARY_DIR@/coverage/sonarqube.xml
html-details = @CMAKE_BINARY_DIR@/coverage/coverage.html
gcov-parallel = yes
html-theme = blue
html-self-contained = yes
print-summary = yes
filter = .*/beman/inplace_vector/.*
exclude = .*\.t\.cpp
Loading