diff --git a/.cmake-format.json b/.cmake-format.json new file mode 100644 index 0000000..f5120cc --- /dev/null +++ b/.cmake-format.json @@ -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": {} + } +} diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 14ca6b3..17d8d5e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78528df..0fb1f6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,6 @@ +# .github/workflows/ci.yml -*-yaml-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + name: CI Tests on: workflow_dispatch: diff --git a/.gitmodules b/.gitmodules index b44d8c0..8b13789 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1 @@ -[submodule "papers/wg21"] - path = papers/P2988/wg21 - url = https://github.com/mpark/wg21.git + diff --git a/CITATION.cff b/CITATION.cff index b33ad02..53bbef1 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -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" diff --git a/CMakeLists.txt b/CMakeLists.txt index 93a3491..0b5a3f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 + $ + $ + $ +) -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 .) diff --git a/README.md b/README.md index fdedb01..af99b07 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# beman.iterator\_interface: iterator creation mechanisms - +# beman.iterator\_interface: iterator creation mechanisms + ![CI Tests](https://github.com/beman-project/iterator_interface/actions/workflows/ci.yml/badge.svg) **Implements**: diff --git a/cmake/CompilerFeatureTest.cmake b/cmake/CompilerFeatureTest.cmake index 68d7a00..df9b294 100644 --- a/cmake/CompilerFeatureTest.cmake +++ b/cmake/CompilerFeatureTest.cmake @@ -1,3 +1,8 @@ +# cmake-format: off +# cmake/CompilerFeatureTest.cmake -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + # Functions that determine compiler capabilities include(CheckCXXSourceCompiles) diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in index 38bbde7..783e878 100644 --- a/cmake/Config.cmake.in +++ b/cmake/Config.cmake.in @@ -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}/@TARGETS_EXPORT_NAME@.cmake") diff --git a/cmake/gcovr.cfg.in b/cmake/gcovr.cfg.in new file mode 100644 index 0000000..9112efb --- /dev/null +++ b/cmake/gcovr.cfg.in @@ -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 diff --git a/etc/ci-clang-toolchain.cmake b/etc/ci-clang-toolchain.cmake index 75531ee..6a6669b 100755 --- a/etc/ci-clang-toolchain.cmake +++ b/etc/ci-clang-toolchain.cmake @@ -1,3 +1,8 @@ +# cmake-format: off +# etc/ci-clang-toolchain.cmake -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + include_guard(GLOBAL) set(CMAKE_C_COMPILER clang) diff --git a/etc/clang-16-toolchain.cmake b/etc/clang-16-toolchain.cmake index 7f26880..9fe8f80 100755 --- a/etc/clang-16-toolchain.cmake +++ b/etc/clang-16-toolchain.cmake @@ -1,3 +1,8 @@ +# cmake-format: off +# etc/clang-16-toolchain.cmake -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + include_guard(GLOBAL) set(CMAKE_C_COMPILER clang-16) diff --git a/etc/clang-17-toolchain.cmake b/etc/clang-17-toolchain.cmake index 5e266b6..528ed9e 100755 --- a/etc/clang-17-toolchain.cmake +++ b/etc/clang-17-toolchain.cmake @@ -1,3 +1,8 @@ +# cmake-format: off +# etc/clang-17-toolchain.cmake -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + include_guard(GLOBAL) set(CMAKE_C_COMPILER clang-17) diff --git a/etc/clang-18-toolchain.cmake b/etc/clang-18-toolchain.cmake index 7aabede..d49019d 100755 --- a/etc/clang-18-toolchain.cmake +++ b/etc/clang-18-toolchain.cmake @@ -1,3 +1,8 @@ +# cmake-format: off +# etc/clang-18-toolchain.cmake -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + include_guard(GLOBAL) set(CMAKE_C_COMPILER clang-18) diff --git a/etc/clang-19-toolchain.cmake b/etc/clang-19-toolchain.cmake index 48f6e07..64a26e0 100755 --- a/etc/clang-19-toolchain.cmake +++ b/etc/clang-19-toolchain.cmake @@ -1,3 +1,8 @@ +# cmake-format: off +# etc/clang-19-toolchain.cmake -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + include_guard(GLOBAL) set(CMAKE_C_COMPILER clang-19) diff --git a/etc/clang-flags.cmake b/etc/clang-flags.cmake index fdb64dc..ac796a7 100644 --- a/etc/clang-flags.cmake +++ b/etc/clang-flags.cmake @@ -1,3 +1,8 @@ +# cmake-format: off +# etc/clang-flags.cmake -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + include_guard(GLOBAL) set(CMAKE_CXX_STANDARD 23) diff --git a/etc/gcc-11-toolchain.cmake b/etc/gcc-11-toolchain.cmake index d45db1e..c34c816 100755 --- a/etc/gcc-11-toolchain.cmake +++ b/etc/gcc-11-toolchain.cmake @@ -1,3 +1,8 @@ +# cmake-format: off +# etc/gcc-11-toolchain.cmake -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + include_guard(GLOBAL) include("${CMAKE_CURRENT_LIST_DIR}/gcc-flags.cmake") diff --git a/etc/gcc-12-toolchain.cmake b/etc/gcc-12-toolchain.cmake index 5e33221..e36eca7 100755 --- a/etc/gcc-12-toolchain.cmake +++ b/etc/gcc-12-toolchain.cmake @@ -1,3 +1,8 @@ +# cmake-format: off +# etc/gcc-12-toolchain.cmake -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + include_guard(GLOBAL) include("${CMAKE_CURRENT_LIST_DIR}/gcc-flags.cmake") diff --git a/etc/gcc-13-toolchain.cmake b/etc/gcc-13-toolchain.cmake index 4d17470..54ecd60 100755 --- a/etc/gcc-13-toolchain.cmake +++ b/etc/gcc-13-toolchain.cmake @@ -1,3 +1,8 @@ +# cmake-format: off +# etc/gcc-13-toolchain.cmake -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + include_guard(GLOBAL) include("${CMAKE_CURRENT_LIST_DIR}/gcc-flags.cmake") diff --git a/etc/gcc-14-toolchain.cmake b/etc/gcc-14-toolchain.cmake index f969286..f665810 100755 --- a/etc/gcc-14-toolchain.cmake +++ b/etc/gcc-14-toolchain.cmake @@ -1,3 +1,8 @@ +# cmake-format: off +# etc/gcc-14-toolchain.cmake -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + include_guard(GLOBAL) include("${CMAKE_CURRENT_LIST_DIR}/gcc-flags.cmake") diff --git a/etc/gcc-flags.cmake b/etc/gcc-flags.cmake index 3ada976..1d7bad5 100644 --- a/etc/gcc-flags.cmake +++ b/etc/gcc-flags.cmake @@ -1,3 +1,8 @@ +# cmake-format: off +# etc/gcc-flags.cmake -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + include_guard(GLOBAL) set(CMAKE_CXX_STANDARD 23) diff --git a/etc/gcc-toolchain.cmake b/etc/gcc-toolchain.cmake index ab7ec45..19f0850 100755 --- a/etc/gcc-toolchain.cmake +++ b/etc/gcc-toolchain.cmake @@ -1,3 +1,8 @@ +# cmake-format: off +# etc/gcc-toolchain.cmake -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + include_guard(GLOBAL) set(CMAKE_C_COMPILER gcc) diff --git a/etc/llvm-16-toolchain.cmake b/etc/llvm-16-toolchain.cmake index ce7beeb..1651049 100755 --- a/etc/llvm-16-toolchain.cmake +++ b/etc/llvm-16-toolchain.cmake @@ -1,3 +1,8 @@ +# cmake-format: off +# etc/llvm-16-toolchain.cmake -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + include_guard(GLOBAL) set(CMAKE_C_COMPILER clang-16) diff --git a/etc/llvm-master-toolchain.cmake b/etc/llvm-master-toolchain.cmake index cc09e50..b7a521c 100644 --- a/etc/llvm-master-toolchain.cmake +++ b/etc/llvm-master-toolchain.cmake @@ -1,3 +1,8 @@ +# cmake-format: off +# etc/llvm-master-toolchain.cmake -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + set(LLVM_ROOT "$ENV{LLVM_ROOT}" CACHE PATH "Path to LLVM installation") set(CMAKE_C_COMPILER ${LLVM_ROOT}/bin/clang) diff --git a/etc/llvm-toolchain.cmake b/etc/llvm-toolchain.cmake index 5bd9225..743d509 100755 --- a/etc/llvm-toolchain.cmake +++ b/etc/llvm-toolchain.cmake @@ -1,3 +1,8 @@ +# cmake-format: off +# etc/llvm-toolchain.cmake -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + include_guard(GLOBAL) set(CMAKE_C_COMPILER clang-14) diff --git a/etc/toolchain.cmake b/etc/toolchain.cmake index 046d332..b0a47c2 100644 --- a/etc/toolchain.cmake +++ b/etc/toolchain.cmake @@ -1,3 +1,8 @@ +# cmake-format: off +# etc/toolchain.cmake -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + include_guard(GLOBAL) include("${CMAKE_CURRENT_LIST_DIR}/gcc-flags.cmake") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 0cb5c05..560a407 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,32 +1,26 @@ -# examples/CMakeLists.txt -*-CMake-*- -# +# cmake-format: off +# examples/CMakeLists.txt -*-cmake-*- # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -include(GNUInstallDirs) +# cmake-format: on # List of all buildable examples. -set(EXAMPLES - sample -) +set(EXAMPLES sample) -foreach(EXAMPLE ${EXAMPLES}) +foreach(example ${EXAMPLES}) # Add example executable. - add_executable(${EXAMPLE} "") + add_executable(beman.iterator_interface.examples.${example} "") # Add example source file. - target_sources( - ${EXAMPLE} - PRIVATE - ${EXAMPLE}.cpp - ) + target_sources(beman.iterator_interface.examples.${example} + PRIVATE ${example}.cpp) # Link example with the library. - target_link_libraries(${EXAMPLE} beman.iterator_interface) + target_link_libraries(beman.iterator_interface.examples.${example} + beman::iterator_interface) - # Install . + # Install. install( - TARGETS ${EXAMPLE} - EXPORT ${TARGETS_EXPORT_NAME} - DESTINATION ${CMAKE_INSTALL_BINDIR} - ) + TARGETS beman.iterator_interface.examples.${example} + COMPONENT beman.iterator_interface.examples + DESTINATION ${CMAKE_INSTALL_BINDIR}) endforeach() diff --git a/examples/README.md b/examples/README.md index d1de55e..dde22f4 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,14 +1,16 @@ -# Beman.iterator Examples - -List of usage examples for `Beman.iterator`. +# beman.iterator_interfaces: Examples + +List of usage examples for `beman.iterator_interfaces`. ## Sample -Check [sample](sample.cpp) for basic `Beman.iterator` library usage. +TODO: update examples. + +Check [sample](sample.cpp) for basic `beman.iterator_interfaces` library usage. Build and run instructions: ```shell diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt deleted file mode 100644 index 04fddb0..0000000 --- a/extern/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -if(BEMAN_ITERATOR_INTERFACE_ENABLE_TESTING) - # Fetch GoogleTest - FetchContent_Declare( - googletest - GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG - f8d7d77c06936315286eb55f8de22cd23c188571 # release-1.14.0 - EXCLUDE_FROM_ALL - ) - block() - set(INSTALL_GTEST OFF) # Disable GoogleTest installation - set(BUILD_TESTING OFF) # Disable GoogleTest tests - FetchContent_MakeAvailable(googletest) - endblock() -endif() diff --git a/include/beman/iterator_interface/CMakeLists.txt b/include/beman/iterator_interface/CMakeLists.txt new file mode 100644 index 0000000..749ac46 --- /dev/null +++ b/include/beman/iterator_interface/CMakeLists.txt @@ -0,0 +1,17 @@ +# cmake-format: off +# include/beman/iterator_interface/CMakeLists.txt -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + +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) diff --git a/papers/.clang-format b/papers/.clang-format deleted file mode 100644 index 5020462..0000000 --- a/papers/.clang-format +++ /dev/null @@ -1,119 +0,0 @@ -AccessModifierOffset: -2 -AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: true -AlignConsecutiveDeclarations: true -AlignEscapedNewlines: Left -AlignOperands: true -AlignTrailingComments: true -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortBlocksOnASingleLine: false -AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: All -AllowShortIfStatementsOnASingleLine: false -AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: Yes -BinPackArguments: false -BinPackParameters: false -BraceWrapping: - AfterClass: false - AfterControlStatement: false - AfterEnum: false - AfterFunction: false - AfterNamespace: false - AfterObjCDeclaration: false - AfterStruct: false - AfterUnion: false - AfterExternBlock: false - BeforeCatch: false - BeforeElse: false - IndentBraces: false - SplitEmptyFunction: true - SplitEmptyRecord: true - SplitEmptyNamespace: true -BreakBeforeBinaryOperators: None -BreakBeforeBraces: Custom -BreakBeforeInheritanceComma: false -BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false -BreakConstructorInitializers: BeforeColon -BreakAfterJavaFieldAnnotations: false -BreakStringLiterals: true -ColumnLimit: 79 -CommentPragmas: '^ IWYU pragma:' -CompactNamespaces: false -ConstructorInitializerAllOnOneLineOrOnePerLine: true -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 -Cpp11BracedListStyle: true -DerivePointerAlignment: false -DisableFormat: false -ExperimentalAutoDetectBinPacking: false -FixNamespaceComments: true -ForEachMacros: - - foreach - - Q_FOREACH - - BOOST_FOREACH -IncludeBlocks: Preserve -IncludeCategories: - - Regex: '^"(llvm|llvm-c|clang|clang-c)/' - Priority: 2 - - Regex: '^(<|"(gtest|isl|json)/)' - Priority: 3 - - Regex: '.*' - Priority: 1 -IncludeIsMainRegex: '$' -IndentCaseLabels: false -IndentPPDirectives: None -IndentWidth: 4 -IndentWrappedFunctionNames: false -JavaScriptQuotes: Leave -JavaScriptWrapImports: true -KeepEmptyLinesAtTheStartOfBlocks: true -MacroBlockBegin: '' -MacroBlockEnd: '' -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: None -ObjCBinPackProtocolList: Auto -ObjCBlockIndentWidth: 4 -ObjCSpaceAfterProperty: false -ObjCSpaceBeforeProtocolList: true -PenaltyBreakAssignment: 2 -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 1000 -PenaltyBreakTemplateDeclaration: 10 -PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 60 -PointerAlignment: Left -ReflowComments: true -SortIncludes: false -SortUsingDeclarations: true -SpaceAfterCStyleCast: false -SpaceAfterTemplateKeyword: true -SpaceBeforeAssignmentOperators: true -SpaceBeforeCtorInitializerColon: true -SpaceBeforeInheritanceColon: true -SpaceBeforeParens: ControlStatements -SpaceBeforeRangeBasedForLoopColon: true -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 1 -SpacesInAngles: false -SpacesInContainerLiterals: true -SpacesInCStyleCastParentheses: false -SpacesInParentheses: false -SpacesInSquareBrackets: false -Standard: Auto -TabWidth: 8 -UseTab: Never - ---- -Language: Cpp - ---- -Language: ObjC - -... diff --git a/src/beman/iterator_interface/CMakeLists.txt b/src/beman/iterator_interface/CMakeLists.txt index bcea9a3..53ab904 100644 --- a/src/beman/iterator_interface/CMakeLists.txt +++ b/src/beman/iterator_interface/CMakeLists.txt @@ -1,55 +1,19 @@ -# src/beman/iterator_interface/CMakeLists.txt -*-CMake-*- -# +# cmake-format: off +# src/beman/iterator_interface/CMakeLists.txt -*-cmake-*- # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on -add_library(beman.iterator_interface) -add_library(beman::iterator_interface ALIAS beman.iterator_interface) - -target_sources( - beman.iterator_interface - PRIVATE - iterator_interface.cpp -) - -include(GNUInstallDirs) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - -target_include_directories(beman.iterator_interface PUBLIC - $ - $ - $ # /include/scratch -) +# Ensure that iterator_interface gets compiled at least once. +target_sources(beman.iterator_interface PUBLIC iterator_interface.cpp) +# The library is empty -- exclude it install( TARGETS beman.iterator_interface - EXPORT ${TARGETS_EXPORT_NAME}1 - DESTINATION ${CMAKE_INSTALL_LIBDIR} -) - -string(TOLOWER ${CMAKE_PROJECT_NAME} CMAKE_LOWER_PROJECT_NAME) + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT beman.iterator_interface.library + EXCLUDE_FROM_ALL) install( - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_LOWER_PROJECT_NAME} - FILES_MATCHING PATTERN "*.hpp" -) - -target_link_libraries(beman.iterator_interface) - -## Tests -if(BEMAN_ITERATOR_INTERFACE_ENABLE_TESTING) - add_executable(iterator_interface_test "") - - target_sources( - iterator_interface_test - PRIVATE - iterator_interface.t.cpp - ) - - target_link_libraries(iterator_interface_test beman.iterator_interface) - target_link_libraries(iterator_interface_test GTest::gtest) - target_link_libraries(iterator_interface_test GTest::gtest_main) - - include(GoogleTest) - gtest_discover_tests(iterator_interface_test) -endif() + TARGETS beman.iterator_interface FILE_SET beman_iterator_interface_headers + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + COMPONENT beman_iterator_interface_development) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..4feb4e7 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,26 @@ +# cmake-format: off +# tests/CMakeLists.txt -*-cmake-*- +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# cmake-format: on + +include(GoogleTest) + +add_executable(beman.iterator_interface.tests) + +target_sources(beman.iterator_interface.tests + PRIVATE iterator_interface.test.cpp) + +target_sources( + beman.iterator_interface.tests + PRIVATE FILE_SET beman_iterator_interface_tests_headers TYPE HEADERS) + +target_link_libraries( + beman.iterator_interface.tests PRIVATE beman::iterator_interface GTest::gtest + GTest::gtest_main) + +# [Issue #18](https://github.com/beman-project/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. +# Change also applied for CI flows. +gtest_add_tests(TARGET beman.iterator_interface.tests "" AUTO) diff --git a/src/beman/iterator_interface/iterator_interface.t.cpp b/tests/iterator_interface.test.cpp similarity index 98% rename from src/beman/iterator_interface/iterator_interface.t.cpp rename to tests/iterator_interface.test.cpp index cc30017..5697ac3 100644 --- a/src/beman/iterator_interface/iterator_interface.t.cpp +++ b/tests/iterator_interface.test.cpp @@ -1,4 +1,4 @@ -// src/beman/iterator_interface/iterator_interface.y.cpp -*-C++-*- +// tests/iterator_interfaces.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include