diff --git a/CMakeLists.txt b/CMakeLists.txt index 5932a0e..a245e93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,18 @@ -cmake_minimum_required(VERSION 3.6) +cmake_minimum_required (VERSION 3.11) project(Vector3D) -add_subdirectory(unit-tests) add_subdirectory(src) set(CMAKE_CXX_STANDARD 11) -add_compile_options(-fdiagnostics-color=always -Wall -Wextra -Wpedantic) \ No newline at end of file +add_compile_options(-fdiagnostics-color=always -Wall -Wextra -Wpedantic) + +include(FetchContent) + +FetchContent_Declare( + Catch2 + GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v3.8.0 # or a later release +) + +FetchContent_MakeAvailable(Catch2) \ No newline at end of file diff --git a/src/Matrix/CMakeLists.txt b/src/Matrix/CMakeLists.txt index 486f8f9..fbb1299 100644 --- a/src/Matrix/CMakeLists.txt +++ b/src/Matrix/CMakeLists.txt @@ -23,4 +23,13 @@ target_link_libraries(matrix set_target_properties(matrix PROPERTIES LINKER_LANGUAGE CXX +) + +# matrix tests +add_executable(matrix-tests unit-tests/matrix-tests.cpp) + +target_link_libraries(matrix-tests + PRIVATE + matrix-intf + Catch2::Catch2WithMain ) \ No newline at end of file diff --git a/unit-tests/matrix-tests.cpp b/src/Matrix/unit-tests/matrix-tests.cpp similarity index 100% rename from unit-tests/matrix-tests.cpp rename to src/Matrix/unit-tests/matrix-tests.cpp diff --git a/src/Quaternion/CMakeLists.txt b/src/Quaternion/CMakeLists.txt index 79d815a..430d752 100644 --- a/src/Quaternion/CMakeLists.txt +++ b/src/Quaternion/CMakeLists.txt @@ -28,4 +28,13 @@ target_link_libraries(quaternion set_target_properties(quaternion PROPERTIES LINKER_LANGUAGE CXX +) + +# Quaternion tests +add_executable(quaternion-tests unit-tests/quaternion-tests.cpp) + +target_link_libraries(quaternion-tests + PRIVATE + quaternion + Catch2::Catch2WithMain ) \ No newline at end of file diff --git a/unit-tests/quaternion-tests.cpp b/src/Quaternion/unit-tests/quaternion-tests.cpp similarity index 100% rename from unit-tests/quaternion-tests.cpp rename to src/Quaternion/unit-tests/quaternion-tests.cpp diff --git a/src/Vector3D/CMakeLists.txt b/src/Vector3D/CMakeLists.txt index ccd0ae4..04c4fc8 100644 --- a/src/Vector3D/CMakeLists.txt +++ b/src/Vector3D/CMakeLists.txt @@ -18,4 +18,14 @@ target_link_libraries(vector-3d PUBLIC vector-3d-intf PRIVATE +) + +# vector tests +add_executable(vector-tests unit-tests/vector-tests.cpp) + +target_link_libraries(vector-tests + PRIVATE + matrix-intf + vector-3d-intf + Catch2::Catch2WithMain ) \ No newline at end of file diff --git a/unit-tests/vector-tests.cpp b/src/Vector3D/unit-tests/vector-tests.cpp similarity index 100% rename from unit-tests/vector-tests.cpp rename to src/Vector3D/unit-tests/vector-tests.cpp diff --git a/unit-tests/CMakeLists.txt b/unit-tests/CMakeLists.txt deleted file mode 100644 index 9d2afc4..0000000 --- a/unit-tests/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -cmake_minimum_required (VERSION 3.11) - -project ("test_driver") - -include(FetchContent) - -FetchContent_Declare( - Catch2 - GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG v3.8.0 # or a later release -) - -FetchContent_MakeAvailable(Catch2) - -# matrix tests -add_executable(matrix-tests matrix-tests.cpp) - -target_link_libraries(matrix-tests - PRIVATE - matrix-intf - Catch2::Catch2WithMain -) - -# vector tests -add_executable(vector-tests vector-tests.cpp) - -target_link_libraries(vector-tests - PRIVATE - matrix-intf - vector-3d-intf - Catch2::Catch2WithMain -) - -# quaternion tests -add_executable(quaternion-tests quaternion-tests.cpp) - -target_link_libraries(quaternion-tests - PRIVATE - quaternion - Catch2::Catch2WithMain -) \ No newline at end of file