Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup the cmake files #34

Merged
merged 3 commits into from
Jan 10, 2025
Merged
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
31 changes: 13 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# cmake-format: on

cmake_minimum_required(VERSION 3.27)
cmake_minimum_required(VERSION 3.27...3.31)

project(
beman.iterator_interface
Expand All @@ -23,15 +23,19 @@ beman_iterator_check_deducing_this(COMPILER_SUPPORTS_DEDUCING_THIS)

set(TARGETS_EXPORT_NAME ${CMAKE_PROJECT_NAME}Targets)

option(BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS
option(
BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS
"Make use of C++23 \"deducing this\" feature (P0847R7). Turn this off for non-conforming compilers."
${COMPILER_SUPPORTS_DEDUCING_THIS})

option(BEMAN_ITERATOR_INTERFACE_BUILD_TESTS
"Enable building tests and test infrastructure. Default: ON. Values: {ON, OFF}." ${PROJECT_IS_TOP_LEVEL})
option(
BEMAN_ITERATOR_INTERFACE_BUILD_TESTS
"Enable building tests and test infrastructure. Default: ON. Values: {ON, OFF}."
${PROJECT_IS_TOP_LEVEL})

option(BEMAN_ITERATOR_INTERFACE_BUILD_EXAMPLES
"Enable building examples. Default: ON. Values: {ON, OFF}." ${PROJECT_IS_TOP_LEVEL})
"Enable building examples. Default: ON. Values: {ON, OFF}."
${PROJECT_IS_TOP_LEVEL})

if(BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS
AND NOT COMPILER_SUPPORTS_DEDUCING_THIS)
Expand Down Expand Up @@ -67,16 +71,10 @@ target_sources(
TYPE
HEADERS
BASE_DIRS
src
include)

target_include_directories(
beman.iterator_interface
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_LOWER_PROJECT_NAME}>
)
${PROJECT_BINARY_DIR}/include
${PROJECT_SOURCE_DIR}/include
FILES
${PROJECT_BINARY_DIR}/include/beman/iterator_interface/config.hpp)

add_subdirectory(src/beman/iterator_interface)
add_subdirectory(include/beman/iterator_interface)
Expand All @@ -99,6 +97,3 @@ add_custom_target(
COMMENT "Running gcovr to process coverage results"
COMMAND mkdir -p coverage
COMMAND gcovr --config gcovr.cfg .)

install(FILES ${PROJECT_BINARY_DIR}/include/beman/iterator_interface/config.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/beman/iterator_interface)
6 changes: 2 additions & 4 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@
"name": "_debug-base",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_FLAGS": "-fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=leak -fsanitize=undefined"
"CMAKE_BUILD_TYPE": "Debug"
Copy link
Member

Choose a reason for hiding this comment

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

Is there a target that runs a sanitized build in the presets?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, but this preset does not work on APPLE!

Copy link
Member

Choose a reason for hiding this comment

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

And attaching the sanitizer to the Debug build misses many of the things it is supposed to catch, in any case. And, in addition, specializing for the toolchain is what toolchain files are for, not the Presets.

OK. I wish it were otherwise, but I understand why the change is being requested.

}
},
{
"name": "_release-base",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_CXX_FLAGS": "-O3"
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
Expand Down
Empty file modified Makefile
100755 → 100644
Empty file.
24 changes: 14 additions & 10 deletions include/beman/iterator_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@

target_sources(
beman.iterator_interface
PUBLIC FILE_SET
beman_iterator_interface_headers
TYPE
HEADERS
FILES
iterator_interface.hpp
iterator_interface_access.hpp
detail/stl_interfaces/config.hpp
detail/stl_interfaces/fwd.hpp
detail/stl_interfaces/iterator_interface.hpp)
PUBLIC
FILE_SET
beman_iterator_interface_headers
TYPE
HEADERS
BASE_DIRS
${PROJECT_BINARY_DIR}/include
${PROJECT_SOURCE_DIR}/include
FILES
iterator_interface.hpp
iterator_interface_access.hpp
detail/stl_interfaces/config.hpp
detail/stl_interfaces/fwd.hpp
detail/stl_interfaces/iterator_interface.hpp)
3 changes: 2 additions & 1 deletion tests/beman/iterator_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ target_link_libraries(
beman.iterator_interface.tests PRIVATE beman::iterator_interface GTest::gtest
GTest::gtest_main)

# [Issue #18](https://github.com/bemanproject/iterator_interface/issues/18): Re-enable ASAN run CI/clang-19.
# [Issue #18](https://github.com/bemanproject/iterator_interface/issues/18):
# Re-enable ASAN run CI/clang-19.
#
# Note: clang-19 + gtest_discover_tests + Asan setup causes errors on some
# platforms. Temporary switch to gtest_add_tests and skip some Asan checks.
Expand Down