-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from neatudarius/apply_beman_standard/cmake_rules
Apply the Beman Standard: cmake related rules
- Loading branch information
Showing
34 changed files
with
342 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
{ | ||
"parse": { | ||
"additional_commands": { | ||
"foo": { | ||
"flags": [ | ||
"BAR", | ||
"BAZ" | ||
], | ||
"kwargs": { | ||
"HEADERS": "*", | ||
"SOURCES": "*", | ||
"DEPENDS": "*" | ||
} | ||
} | ||
}, | ||
"override_spec": {}, | ||
"vartags": [], | ||
"proptags": [] | ||
}, | ||
"format": { | ||
"disable": false, | ||
"line_width": 80, | ||
"tab_size": 2, | ||
"use_tabchars": false, | ||
"fractional_tab_policy": "use-space", | ||
"max_subgroups_hwrap": 2, | ||
"max_pargs_hwrap": 6, | ||
"max_rows_cmdline": 2, | ||
"separate_ctrl_name_with_space": false, | ||
"separate_fn_name_with_space": false, | ||
"dangle_parens": false, | ||
"dangle_align": "prefix", | ||
"min_prefix_chars": 4, | ||
"max_prefix_chars": 10, | ||
"max_lines_hwrap": 2, | ||
"line_ending": "unix", | ||
"command_case": "canonical", | ||
"keyword_case": "unchanged", | ||
"always_wrap": [], | ||
"enable_sort": true, | ||
"autosort": false, | ||
"require_valid_layout": false, | ||
"layout_passes": {} | ||
}, | ||
"markup": { | ||
"bullet_char": "*", | ||
"enum_char": ".", | ||
"first_comment_is_literal": false, | ||
"literal_comment_pattern": null, | ||
"fence_pattern": "^\\s*([`~]{3}[`~]*)(.*)$", | ||
"ruler_pattern": "^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$", | ||
"explicit_trailing_pattern": "#<", | ||
"hashruler_min_length": 10, | ||
"canonicalize_hashrulers": true, | ||
"enable_markup": true | ||
}, | ||
"lint": { | ||
"disabled_codes": [], | ||
"function_pattern": "[0-9a-z_]+", | ||
"macro_pattern": "[0-9A-Z_]+", | ||
"global_var_pattern": "[A-Z][0-9A-Z_]+", | ||
"internal_var_pattern": "_[A-Z][0-9A-Z_]+", | ||
"local_var_pattern": "[a-z][a-z0-9_]+", | ||
"private_var_pattern": "_[0-9a-z_]+", | ||
"public_var_pattern": "[A-Z][0-9A-Z_]+", | ||
"argument_var_pattern": "[a-z][a-z0-9_]+", | ||
"keyword_pattern": "[A-Z][0-9A-Z_]+", | ||
"max_conditionals_custom_parser": 2, | ||
"min_statement_spacing": 1, | ||
"max_statement_spacing": 2, | ||
"max_returns": 6, | ||
"max_branches": 12, | ||
"max_arguments": 5, | ||
"max_localvars": 15, | ||
"max_statements": 50 | ||
}, | ||
"encode": { | ||
"emit_byteorder_mark": false, | ||
"input_encoding": "utf-8", | ||
"output_encoding": "utf-8" | ||
}, | ||
"misc": { | ||
"per_command": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Codeowners for reviews on PRs | ||
# .github/CODEOWNERS | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
# Codeowners for reviews on PRs | ||
* @camio @neatudarius @steve-downey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
[submodule "papers/wg21"] | ||
path = papers/P2988/wg21 | ||
url = https://github.com/mpark/wg21.git | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
cff-version: 1.0.0 | ||
message: "If you use this software, please cite it as below." | ||
title: "Beman.iterator" | ||
title: "beman.iterator_interface" | ||
url: "https://github.com/beman-project/iterator_interface" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,95 @@ | ||
# cmake-format: off | ||
# CMakeLists.txt -*-CMake-*- | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# cmake-format: on | ||
|
||
cmake_minimum_required(VERSION 3.10) | ||
cmake_minimum_required(VERSION 3.27) | ||
|
||
project(beman_iter_interface VERSION 0.0.0 LANGUAGES CXX) | ||
project( | ||
beman.iterator_interface | ||
VERSION 0.0.0 | ||
LANGUAGES CXX) | ||
|
||
# Local helpers: required to include CompilerFeatureTest. | ||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") | ||
|
||
# Includes | ||
include(CTest) | ||
include(FetchContent) | ||
include(CompilerFeatureTest) | ||
|
||
# Prechecks. | ||
beman_iterator_check_deducing_this(COMPILER_SUPPORTS_DEDUCING_THIS) | ||
|
||
set(TARGETS_EXPORT_NAME ${CMAKE_PROJECT_NAME}Targets) | ||
|
||
option(BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS | ||
"Make use of deducing this. Turn this off for non-conforming compilers." | ||
${COMPILER_SUPPORTS_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_ENABLE_TESTING "Build beman.iterator_interface tests" ${PROJECT_IS_TOP_LEVEL}) | ||
option(ITERATOR_INTERFACE_ENABLE_TESTING | ||
"Enable building tests and test infrastructure" ${PROJECT_IS_TOP_LEVEL}) | ||
|
||
if(BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS AND NOT COMPILER_SUPPORTS_DEDUCING_THIS) | ||
message(WARNING "Building with deducing this support despite of the compiler's lack of support for it") | ||
if(BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS | ||
AND NOT COMPILER_SUPPORTS_DEDUCING_THIS) | ||
message( | ||
WARNING | ||
"Building with C++23 \"deducing this\" feature (P0847R7) despite of the compiler's lack of actual support for it." | ||
) | ||
endif() | ||
|
||
configure_file( | ||
"${PROJECT_SOURCE_DIR}/include/beman/iterator_interface/config.hpp.in" | ||
"${PROJECT_BINARY_DIR}/include/beman/iterator_interface/config.hpp" | ||
@ONLY | ||
) | ||
|
||
if(BEMAN_ITERATOR_INTERFACE_ENABLE_TESTING) | ||
enable_testing() | ||
"${PROJECT_BINARY_DIR}/include/beman/iterator_interface/config.hpp" @ONLY) | ||
|
||
# Build the tests if enabled via the option ITERATOR_INTERFACE_ENABLE_TESTING | ||
if(ITERATOR_INTERFACE_ENABLE_TESTING) | ||
# Fetch GoogleTest | ||
FetchContent_Declare( | ||
googletest | ||
EXCLUDE_FROM_ALL | ||
GIT_REPOSITORY https://github.com/google/googletest.git | ||
GIT_TAG e39786088138f2749d64e9e90e0f9902daa77c40 # release-1.15.0 | ||
) | ||
FetchContent_MakeAvailable(googletest) | ||
endif() | ||
|
||
set(TARGETS_EXPORT_NAME ${CMAKE_PROJECT_NAME}Targets) | ||
# Create the library target and named header set for beman.iterator_interface | ||
add_library(beman.iterator_interface STATIC) | ||
add_library(beman::iterator_interface ALIAS beman.iterator_interface) | ||
|
||
target_sources( | ||
beman.iterator_interface | ||
PUBLIC FILE_SET | ||
beman_iterator_interface_headers | ||
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}> | ||
) | ||
|
||
add_subdirectory(extern) | ||
add_subdirectory(src/beman/iterator_interface) | ||
add_subdirectory(examples) | ||
add_subdirectory(include/beman/iterator_interface) | ||
|
||
include(GNUInstallDirs) | ||
|
||
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake) | ||
|
||
install( | ||
EXPORT ${TARGETS_EXPORT_NAME} | ||
NAMESPACE ${CMAKE_PROJECT_NAME} | ||
DESTINATION ${INSTALL_CONFIGDIR} | ||
) | ||
|
||
include(CMakePackageConfigHelpers) | ||
|
||
write_basic_package_version_file( | ||
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake | ||
VERSION ${PROJECT_VERSION} | ||
COMPATIBILITY AnyNewerVersion | ||
) | ||
add_subdirectory(examples) | ||
if(ITERATOR_INTERFACE_ENABLE_TESTING) | ||
add_subdirectory(tests) | ||
endif() | ||
|
||
configure_package_config_file( | ||
"cmake/Config.cmake.in" | ||
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake | ||
INSTALL_DESTINATION ${INSTALL_CONFIGDIR} | ||
) | ||
# Coverage | ||
configure_file("cmake/gcovr.cfg.in" gcovr.cfg @ONLY) | ||
|
||
install(FILES | ||
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake | ||
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake | ||
DESTINATION ${INSTALL_CONFIGDIR} | ||
) | ||
add_custom_target( | ||
process_coverage | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | ||
COMMENT "Running gcovr to process coverage results" | ||
COMMAND mkdir -p coverage | ||
COMMAND gcovr --config gcovr.cfg .) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
# cmake-format: off | ||
# cmake/Config.cmake.in -*-cmake-*- | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# cmake-format: on | ||
|
||
@PACKAGE_INIT@ | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
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-executable = @GCOV_EXECUTABLE@ | ||
gcov-parallel = yes | ||
html-theme = github.dark-blue | ||
html-self-contained = yes | ||
print-summary = yes | ||
filter = .*/beman/iterator_interface/.* | ||
exclude = .*\.t\.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.