diff --git a/.github/workflows/cookiecutter_test.yml b/.github/workflows/cookiecutter_test.yml deleted file mode 100644 index 91de713..0000000 --- a/.github/workflows/cookiecutter_test.yml +++ /dev/null @@ -1,19 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -name: Cookiecutter Test -on: - push: - branches: - - main - pull_request: - -jobs: - cookiecutter-test: - runs-on: ubuntu-latest - name: "Check cookiecutter for consistency" - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: beman cookiecutter consistency check - run: | - ./cookiecutter/check_cookiecutter.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index f3f00f4..50c42c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,16 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.25) +cmake_minimum_required(VERSION 3.28...4.2) project( - beman.take_before # CMake Project Name, which is also the name of the top-level - # targets (e.g., library, executable, etc.). - DESCRIPTION "A Beman Library for take_before" + beman.take_before + DESCRIPTION "take_before_view" LANGUAGES CXX - VERSION 2.2.1 + VERSION 0.0.1 ) +# gersemi: off + # [CMAKE.SKIP_TESTS] option( BEMAN_TAKE_BEFORE_BUILD_TESTS @@ -24,12 +25,28 @@ option( ${PROJECT_IS_TOP_LEVEL} ) -include(CTest) -add_subdirectory(src/beman/take_before) +add_library(beman.take_before INTERFACE) +target_sources( + beman.take_before + INTERFACE + FILE_SET HEADERS + BASE_DIRS include + FILES include/beman/take_before/take_before.hpp + ) + +add_library(beman::take_before ALIAS beman.take_before) +set_target_properties(beman.take_before PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON) + +set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/infra/cmake) + + +find_package(beman-install-library REQUIRED) +beman_install_library(beman.take_before) if(BEMAN_TAKE_BEFORE_BUILD_TESTS) - add_subdirectory(tests/beman/take_before) + enable_testing() + add_subdirectory(tests/beman/take_before) endif() if(BEMAN_TAKE_BEFORE_BUILD_EXAMPLES) diff --git a/src/beman/take_before/beman.take_before-config.cmake.in b/beman.take_before-config.cmake.in similarity index 100% rename from src/beman/take_before/beman.take_before-config.cmake.in rename to beman.take_before-config.cmake.in diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 8eb8869..3b36960 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,27 +1,16 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -set(ALL_EXAMPLES take_before_direct_usage) - -# Example `take_before_as_default_projection` need ranges support: -include(CheckCXXSymbolExists) -check_cxx_symbol_exists(__cpp_lib_ranges "ranges" HAS_RANGES) +# gersemi: off -if(HAS_RANGES) - list(APPEND ALL_EXAMPLES take_before_as_default_projection) -else() - message( - WARNING - "Missing range support! Skip: take_before_as_default_projection" - ) -endif() +set(ALL_EXAMPLES take_before_direct_usage) message("Examples to be built: ${ALL_EXAMPLES}") foreach(example ${ALL_EXAMPLES}) - add_executable(beman.take_before.examples.${example}) - target_sources(beman.take_before.examples.${example} PRIVATE ${example}.cpp) + add_executable(${example}) + target_sources(${example} PRIVATE ${example}.cpp) target_link_libraries( - beman.take_before.examples.${example} + ${example} PRIVATE beman::take_before ) endforeach() diff --git a/examples/take_before_direct_usage.cpp b/examples/take_before_direct_usage.cpp index 9362c94..83027b8 100644 --- a/examples/take_before_direct_usage.cpp +++ b/examples/take_before_direct_usage.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + #include #include diff --git a/include/beman/take_before/take_before.hpp b/include/beman/take_before/take_before.hpp index 6cc0d26..1f505fa 100644 --- a/include/beman/take_before/take_before.hpp +++ b/include/beman/take_before/take_before.hpp @@ -11,6 +11,12 @@ #include #include +// clang-format off +#if __cpp_concepts > 202002L + #error "C++20 concepts is required" +#endif +// clang-format on + namespace beman::take_before { // ============================================================================ diff --git a/src/beman/take_before/CMakeLists.txt b/src/beman/take_before/CMakeLists.txt deleted file mode 100644 index 54abd9e..0000000 --- a/src/beman/take_before/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -add_library(beman.take_before) -add_library(beman::take_before ALIAS beman.take_before) - -target_sources(beman.take_before PRIVATE take_before.cpp) - -target_sources( - beman.take_before - PUBLIC - FILE_SET HEADERS - BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../../include" - FILES - "${CMAKE_CURRENT_SOURCE_DIR}/../../../include/beman/take_before/take_before.hpp" -) - -set_target_properties( - beman.take_before - PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON -) - -find_package(beman-install-library REQUIRED) -beman_install_library(beman.take_before) diff --git a/src/beman/take_before/take_before.cpp b/src/beman/take_before/take_before.cpp deleted file mode 100644 index c729776..0000000 --- a/src/beman/take_before/take_before.cpp +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/tests/beman/take_before/CMakeLists.txt b/tests/beman/take_before/CMakeLists.txt index dd8d39c..efeb7ad 100644 --- a/tests/beman/take_before/CMakeLists.txt +++ b/tests/beman/take_before/CMakeLists.txt @@ -1,13 +1,13 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -find_package(GTest REQUIRED) +find_package(GTest QUIET) -add_executable(beman.take_before.tests.take_before) -target_sources(beman.take_before.tests.take_before PRIVATE take_before.test.cpp) +add_executable(beman_take_before.test) +target_sources(beman_take_before.test PRIVATE take_before.test.cpp) target_link_libraries( - beman.take_before.tests.take_before + beman_take_before.test PRIVATE beman::take_before GTest::gtest GTest::gtest_main ) include(GoogleTest) -gtest_discover_tests(beman.take_before.tests.take_before) +gtest_discover_tests(beman_take_before.test) diff --git a/tests/beman/take_before/take_before.test.cpp b/tests/beman/take_before/take_before.test.cpp index 4b79ffd..4d23b42 100644 --- a/tests/beman/take_before/take_before.test.cpp +++ b/tests/beman/take_before/take_before.test.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + #include #include