diff --git a/.gitmodules b/.gitmodules index 9c4e455..b44d8c0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "papers/wg21"] path = papers/P2988/wg21 url = https://github.com/mpark/wg21.git -[submodule "extern/googletest"] - path = extern/googletest - url = https://github.com/google/googletest.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 40226f8..3a80cd9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,12 +2,14 @@ cmake_minimum_required(VERSION 3.10) project(beman_iter_interface VERSION 0.0.0 LANGUAGES CXX) +include(FetchContent) + enable_testing() set(TARGETS_EXPORT_NAME ${CMAKE_PROJECT_NAME}Targets) add_subdirectory(extern) -add_subdirectory(src) +add_subdirectory(src/beman/iterator_interface26) add_subdirectory(examples) include(GNUInstallDirs) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 1e874f5..ab4cca1 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,5 +1,3 @@ -set(BEMAN_ITERATOR_LIBRARY "beman_iterator") - include(GNUInstallDirs) # List of all buildable examples. @@ -19,7 +17,7 @@ foreach(EXAMPLE ${EXAMPLES}) ) # Link example with the library. - target_link_libraries(${EXAMPLE} "${BEMAN_ITERATOR_LIBRARY}") + target_link_libraries(${EXAMPLE} beman.iterator_interface26) # Install . install( diff --git a/examples/sample.cpp b/examples/sample.cpp index 1025a0b..49a5b65 100644 --- a/examples/sample.cpp +++ b/examples/sample.cpp @@ -1,4 +1,4 @@ -#include +#include #include int main() { diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index a2177fb..a88327d 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -1 +1,15 @@ -add_subdirectory(googletest EXCLUDE_FROM_ALL) +if(BUILD_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/extern/googletest b/extern/googletest deleted file mode 160000 index 1d17ea1..0000000 --- a/extern/googletest +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1d17ea141d2c11b8917d2c7d029f1c4e2b9769b2 diff --git a/src/Beman/iterator/iterator_interface.hpp b/include/beman/iterator_interface26/iterator_interface.hpp similarity index 99% rename from src/Beman/iterator/iterator_interface.hpp rename to include/beman/iterator_interface26/iterator_interface.hpp index 1ed84ef..0e2570e 100644 --- a/src/Beman/iterator/iterator_interface.hpp +++ b/include/beman/iterator_interface26/iterator_interface.hpp @@ -6,8 +6,8 @@ #include #include -namespace Beman { -namespace iterator { +namespace beman { +namespace iterator_interface26 { using std::conditional_t; using std::convertible_to; diff --git a/src/Beman/CMakeLists.txt b/src/Beman/CMakeLists.txt deleted file mode 100644 index 4d76ab9..0000000 --- a/src/Beman/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(iterator) diff --git a/src/Beman/iterator/CMakeLists.txt b/src/Beman/iterator/CMakeLists.txt deleted file mode 100644 index 0be2c6c..0000000 --- a/src/Beman/iterator/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -set(TARGET_LIBRARY "beman_iterator") - -add_library("${TARGET_LIBRARY}" STATIC "") - -target_sources( - "${TARGET_LIBRARY}" - PRIVATE - iterator_interface.cpp -) - -include(GNUInstallDirs) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - -target_include_directories("${TARGET_LIBRARY}" PUBLIC - $ - $ # /include/scratch -) - -install( - TARGETS "${TARGET_LIBRARY}" - EXPORT ${TARGETS_EXPORT_NAME}1 - DESTINATION ${CMAKE_INSTALL_LIBDIR} -) - -string(TOLOWER ${CMAKE_PROJECT_NAME} CMAKE_LOWER_PROJECT_NAME) - -install( - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_LOWER_PROJECT_NAME} - FILES_MATCHING PATTERN "*.hpp" -) - -target_link_libraries("${TARGET_LIBRARY}") - -## Tests -add_executable(iterator_interface_test "") - -target_sources( - iterator_interface_test - PRIVATE - iterator_interface.t.cpp -) - -target_link_libraries(iterator_interface_test "${TARGET_LIBRARY}") -target_link_libraries(iterator_interface_test gtest) -target_link_libraries(iterator_interface_test gtest_main) - -include(GoogleTest) -gtest_discover_tests(iterator_interface_test) diff --git a/src/Beman/iterator/iterator_interface.cpp b/src/Beman/iterator/iterator_interface.cpp deleted file mode 100644 index dc2b52f..0000000 --- a/src/Beman/iterator/iterator_interface.cpp +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index 3a085d5..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(Beman) diff --git a/src/beman/iterator_interface26/CMakeLists.txt b/src/beman/iterator_interface26/CMakeLists.txt new file mode 100644 index 0000000..e6d32b0 --- /dev/null +++ b/src/beman/iterator_interface26/CMakeLists.txt @@ -0,0 +1,50 @@ +add_library(beman.iterator_interface26) +add_library(beman::iterator_interface26 ALIAS beman.iterator_interface26) + +target_sources( + beman.iterator_interface26 + PRIVATE + iterator_interface.cpp +) + +include(GNUInstallDirs) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +target_include_directories(beman.iterator_interface26 PUBLIC + $ + $ # /include/scratch +) + +install( + TARGETS beman.iterator_interface26 + EXPORT ${TARGETS_EXPORT_NAME}1 + DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +string(TOLOWER ${CMAKE_PROJECT_NAME} CMAKE_LOWER_PROJECT_NAME) + +install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_LOWER_PROJECT_NAME} + FILES_MATCHING PATTERN "*.hpp" +) + +target_link_libraries(beman.iterator_interface26) + +## Tests +if(BUILD_TESTING) + add_executable(iterator_interface_test "") + + target_sources( + iterator_interface_test + PRIVATE + iterator_interface.t.cpp + ) + + target_link_libraries(iterator_interface_test beman.iterator_interface26) + 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() diff --git a/src/beman/iterator_interface26/iterator_interface.cpp b/src/beman/iterator_interface26/iterator_interface.cpp new file mode 100644 index 0000000..2356e2c --- /dev/null +++ b/src/beman/iterator_interface26/iterator_interface.cpp @@ -0,0 +1 @@ +#include diff --git a/src/Beman/iterator/iterator_interface.t.cpp b/src/beman/iterator_interface26/iterator_interface.t.cpp similarity index 94% rename from src/Beman/iterator/iterator_interface.t.cpp rename to src/beman/iterator_interface26/iterator_interface.t.cpp index 411e1f5..3b47dc6 100644 --- a/src/Beman/iterator/iterator_interface.t.cpp +++ b/src/beman/iterator_interface26/iterator_interface.t.cpp @@ -1,13 +1,13 @@ // iterator_interface.t.cpp -*-C++-*- -#include -#include +#include +#include #include #include -namespace Beman { -namespace iterator { +namespace beman { +namespace iterator_interface26 { namespace {} // namespace