diff options
| -rw-r--r-- | source/CMakeLists.txt | 80 | ||||
| -rw-r--r-- | source/examples/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | source/lib/CMakeLists.txt | 21 | ||||
| -rw-r--r-- | source/lib/include/newtype/derivable.hpp (renamed from source/include/newtype/derivable.hpp) | 0 | ||||
| -rw-r--r-- | source/lib/include/newtype/derivation_clause.hpp (renamed from source/include/newtype/derivation_clause.hpp) | 0 | ||||
| -rw-r--r-- | source/lib/include/newtype/deriving.hpp (renamed from source/include/newtype/deriving.hpp) | 0 | ||||
| -rw-r--r-- | source/lib/include/newtype/impl/new_type_iterator_types.hpp (renamed from source/include/newtype/impl/new_type_iterator_types.hpp) | 0 | ||||
| -rw-r--r-- | source/lib/include/newtype/impl/new_type_storage.hpp (renamed from source/include/newtype/impl/new_type_storage.hpp) | 0 | ||||
| -rw-r--r-- | source/lib/include/newtype/impl/type_traits_extensions.hpp (renamed from source/include/newtype/impl/type_traits_extensions.hpp) | 0 | ||||
| -rw-r--r-- | source/lib/include/newtype/newtype.hpp (renamed from source/include/newtype/newtype.hpp) | 0 | ||||
| -rw-r--r-- | source/lib/include/newtype/version.hpp (renamed from source/include/newtype/version.hpp) | 0 | ||||
| -rw-r--r-- | source/tests/CMakeLists.txt | 34 | ||||
| -rw-r--r-- | source/tests/src/arithmetic.cpp (renamed from source/test/src/arithmetic.cpp) | 0 | ||||
| -rw-r--r-- | source/tests/src/conversion_suite.cpp (renamed from source/test/src/conversion_suite.cpp) | 0 | ||||
| -rw-r--r-- | source/tests/src/derivation_clause_suite.cpp (renamed from source/test/src/derivation_clause_suite.cpp) | 0 | ||||
| -rw-r--r-- | source/tests/src/equality_comparison_suite.cpp (renamed from source/test/src/equality_comparison_suite.cpp) | 0 | ||||
| -rw-r--r-- | source/tests/src/hash_suite.cpp (renamed from source/test/src/hash_suite.cpp) | 0 | ||||
| -rw-r--r-- | source/tests/src/io_operators_suite.cpp (renamed from source/test/src/io_operators_suite.cpp) | 0 | ||||
| -rw-r--r-- | source/tests/src/iterable_suite.cpp (renamed from source/test/src/iterable_suite.cpp) | 0 | ||||
| -rw-r--r-- | source/tests/src/new_type_constructor_suite.cpp (renamed from source/test/src/new_type_constructor_suite.cpp) | 0 | ||||
| -rw-r--r-- | source/tests/src/relational_operators_suite.cpp (renamed from source/test/src/relational_operators_suite.cpp) | 0 |
21 files changed, 69 insertions, 76 deletions
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 0bd0876..c84eda9 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -5,84 +5,12 @@ project("newtype" DESCRIPTION "A library of types and functions to create strong type aliases" ) -enable_testing() - -# Project dependencies - -find_package("Catch2" "3.1" - COMPONENTS "Catch2WithMain" - REQUIRED -) - -include("Catch") - # Project Options option(BUILD_EXAMPLES "Build the library examples" OFF) -# 'newtype' library - -add_library("${PROJECT_NAME}" INTERFACE) - -target_include_directories("${PROJECT_NAME}" INTERFACE - $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> - $<INSTALL_INTERFACE:include> -) - -target_compile_features("${PROJECT_NAME}" INTERFACE - "cxx_std_20" -) - -install(TARGETS "${PROJECT_NAME}" - EXPORT "${PROJECT_NAME}Targets" - PUBLIC_HEADER DESTINATION "include" -) - -install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" - DESTINATION "include" -) - -add_library("${PROJECT_NAME}::${PROJECT_NAME}" ALIAS "${PROJECT_NAME}") - -# 'newtype' tests - -add_executable("${PROJECT_NAME}_tests" - "test/src/arithmetic.cpp" - # "test/src/conversion_suite.cpp" - # "test/src/derivation_clause_suite.cpp" - # "test/src/equality_comparison_suite.cpp" - # "test/src/hash_suite.cpp" - # "test/src/io_operators_suite.cpp" - # "test/src/iterable_suite.cpp" - # "test/src/new_type_constructor_suite.cpp" - # "test/src/relational_operators_suite.cpp" -) - -target_link_libraries("${PROJECT_NAME}_tests" - "${PROJECT_NAME}::${PROJECT_NAME}" - "Catch2::Catch2WithMain" -) - -target_compile_options("${PROJECT_NAME}_tests" PRIVATE - "$<$<CXX_COMPILER_ID:GNU,Clang>:-Wall>" - "$<$<CXX_COMPILER_ID:GNU,Clang>:-Wextra>" - "$<$<CXX_COMPILER_ID:GNU,Clang>:-Werror>" - "$<$<CXX_COMPILER_ID:GNU,Clang>:-pedantic-errors>" -) - -catch_discover_tests("${PROJECT_NAME}_tests") - -# 'newtype' examples - -if(BUILD_EXAMPLES) - function(add_example NAME) - add_executable("ex_${NAME}" - "examples/src/${NAME}.cpp" - ) - target_link_libraries("ex_${NAME}" "${PROJECT_NAME}") - endfunction() +# Project Components - add_example("basic_usage") - add_example("basic_usage_with_show") - add_example("basic_usage_with_read") -endif() +add_subdirectory("lib") +add_subdirectory("tests") +add_subdirectory("examples") diff --git a/source/examples/CMakeLists.txt b/source/examples/CMakeLists.txt new file mode 100644 index 0000000..5b6ddd8 --- /dev/null +++ b/source/examples/CMakeLists.txt @@ -0,0 +1,10 @@ +if(BUILD_EXAMPLES) + function(add_example NAME) + add_executable("ex_${NAME}" "src/${NAME}.cpp") + target_link_libraries("ex_${NAME}" "${PROJECT_NAME}") + endfunction() + + add_example("basic_usage") + add_example("basic_usage_with_show") + add_example("basic_usage_with_read") +endif() diff --git a/source/lib/CMakeLists.txt b/source/lib/CMakeLists.txt new file mode 100644 index 0000000..a1ed36e --- /dev/null +++ b/source/lib/CMakeLists.txt @@ -0,0 +1,21 @@ +add_library("${PROJECT_NAME}" INTERFACE) + +target_include_directories("${PROJECT_NAME}" INTERFACE + "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" + "$<INSTALL_INTERFACE:include>" +) + +target_compile_features("${PROJECT_NAME}" INTERFACE + "cxx_std_20" +) + +install(TARGETS "${PROJECT_NAME}" + EXPORT "${PROJECT_NAME}Targets" + PUBLIC_HEADER DESTINATION "include" +) + +install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" + DESTINATION "include" +) + +add_library("${PROJECT_NAME}::${PROJECT_NAME}" ALIAS "${PROJECT_NAME}") diff --git a/source/include/newtype/derivable.hpp b/source/lib/include/newtype/derivable.hpp index c798c59..c798c59 100644 --- a/source/include/newtype/derivable.hpp +++ b/source/lib/include/newtype/derivable.hpp diff --git a/source/include/newtype/derivation_clause.hpp b/source/lib/include/newtype/derivation_clause.hpp index 6de70e1..6de70e1 100644 --- a/source/include/newtype/derivation_clause.hpp +++ b/source/lib/include/newtype/derivation_clause.hpp diff --git a/source/include/newtype/deriving.hpp b/source/lib/include/newtype/deriving.hpp index ae10bab..ae10bab 100644 --- a/source/include/newtype/deriving.hpp +++ b/source/lib/include/newtype/deriving.hpp diff --git a/source/include/newtype/impl/new_type_iterator_types.hpp b/source/lib/include/newtype/impl/new_type_iterator_types.hpp index 2ea8274..2ea8274 100644 --- a/source/include/newtype/impl/new_type_iterator_types.hpp +++ b/source/lib/include/newtype/impl/new_type_iterator_types.hpp diff --git a/source/include/newtype/impl/new_type_storage.hpp b/source/lib/include/newtype/impl/new_type_storage.hpp index f7842af..f7842af 100644 --- a/source/include/newtype/impl/new_type_storage.hpp +++ b/source/lib/include/newtype/impl/new_type_storage.hpp diff --git a/source/include/newtype/impl/type_traits_extensions.hpp b/source/lib/include/newtype/impl/type_traits_extensions.hpp index dc41649..dc41649 100644 --- a/source/include/newtype/impl/type_traits_extensions.hpp +++ b/source/lib/include/newtype/impl/type_traits_extensions.hpp diff --git a/source/include/newtype/newtype.hpp b/source/lib/include/newtype/newtype.hpp index e2704f3..e2704f3 100644 --- a/source/include/newtype/newtype.hpp +++ b/source/lib/include/newtype/newtype.hpp diff --git a/source/include/newtype/version.hpp b/source/lib/include/newtype/version.hpp index 8678514..8678514 100644 --- a/source/include/newtype/version.hpp +++ b/source/lib/include/newtype/version.hpp diff --git a/source/tests/CMakeLists.txt b/source/tests/CMakeLists.txt new file mode 100644 index 0000000..fe405db --- /dev/null +++ b/source/tests/CMakeLists.txt @@ -0,0 +1,34 @@ +enable_testing() + +find_package("Catch2" "3.1" + COMPONENTS "Catch2WithMain" + REQUIRED +) + +include("Catch") + +add_executable("${PROJECT_NAME}_tests" + "src/arithmetic.cpp" + # "src/conversion_suite.cpp" + # "src/derivation_clause_suite.cpp" + # "src/equality_comparison_suite.cpp" + # "src/hash_suite.cpp" + # "src/io_operators_suite.cpp" + # "src/iterable_suite.cpp" + # "src/new_type_constructor_suite.cpp" + # "src/relational_operators_suite.cpp" +) + +target_link_libraries("${PROJECT_NAME}_tests" + "${PROJECT_NAME}::${PROJECT_NAME}" + "Catch2::Catch2WithMain" +) + +target_compile_options("${PROJECT_NAME}_tests" PRIVATE + "$<$<CXX_COMPILER_ID:GNU,Clang>:-Wall>" + "$<$<CXX_COMPILER_ID:GNU,Clang>:-Wextra>" + "$<$<CXX_COMPILER_ID:GNU,Clang>:-Werror>" + "$<$<CXX_COMPILER_ID:GNU,Clang>:-pedantic-errors>" +) + +catch_discover_tests("${PROJECT_NAME}_tests") diff --git a/source/test/src/arithmetic.cpp b/source/tests/src/arithmetic.cpp index 5048393..5048393 100644 --- a/source/test/src/arithmetic.cpp +++ b/source/tests/src/arithmetic.cpp diff --git a/source/test/src/conversion_suite.cpp b/source/tests/src/conversion_suite.cpp index cbe2463..cbe2463 100644 --- a/source/test/src/conversion_suite.cpp +++ b/source/tests/src/conversion_suite.cpp diff --git a/source/test/src/derivation_clause_suite.cpp b/source/tests/src/derivation_clause_suite.cpp index 86a34ab..86a34ab 100644 --- a/source/test/src/derivation_clause_suite.cpp +++ b/source/tests/src/derivation_clause_suite.cpp diff --git a/source/test/src/equality_comparison_suite.cpp b/source/tests/src/equality_comparison_suite.cpp index 4e484f4..4e484f4 100644 --- a/source/test/src/equality_comparison_suite.cpp +++ b/source/tests/src/equality_comparison_suite.cpp diff --git a/source/test/src/hash_suite.cpp b/source/tests/src/hash_suite.cpp index b482414..b482414 100644 --- a/source/test/src/hash_suite.cpp +++ b/source/tests/src/hash_suite.cpp diff --git a/source/test/src/io_operators_suite.cpp b/source/tests/src/io_operators_suite.cpp index 4e146a7..4e146a7 100644 --- a/source/test/src/io_operators_suite.cpp +++ b/source/tests/src/io_operators_suite.cpp diff --git a/source/test/src/iterable_suite.cpp b/source/tests/src/iterable_suite.cpp index add4696..add4696 100644 --- a/source/test/src/iterable_suite.cpp +++ b/source/tests/src/iterable_suite.cpp diff --git a/source/test/src/new_type_constructor_suite.cpp b/source/tests/src/new_type_constructor_suite.cpp index fc3e9f6..fc3e9f6 100644 --- a/source/test/src/new_type_constructor_suite.cpp +++ b/source/tests/src/new_type_constructor_suite.cpp diff --git a/source/test/src/relational_operators_suite.cpp b/source/tests/src/relational_operators_suite.cpp index 64fcba0..64fcba0 100644 --- a/source/test/src/relational_operators_suite.cpp +++ b/source/tests/src/relational_operators_suite.cpp |
