diff --git a/.gitignore b/.gitignore index ac26aaa..fc53291 100644 --- a/.gitignore +++ b/.gitignore @@ -119,4 +119,5 @@ fabric.properties *.cubin *.fatbin -.idea/ \ No newline at end of file +.idea/ +*build*/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 957f3ad..063d631 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,14 +2,20 @@ cmake_minimum_required(VERSION 3.14) project(Geometry VERSION 0.1 LANGUAGES CXX) +include(FetchContent) + if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) set_property(GLOBAL PROPERTY USE_FOLDERS ON) + + include(CTest) +endif () + +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME OR GEOMETRY_BUILD_TESTING) + add_subdirectory(tests) endif () set(CMAKE_CXX_STANDARD 17) -include(FetchContent) - FetchContent_Declare( eigen GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git @@ -17,8 +23,6 @@ FetchContent_Declare( ) FetchContent_MakeAvailable(eigen) -#include_directories(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/Geometry) - add_subdirectory(src) add_subdirectory(apps) \ No newline at end of file diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt index 85887dd..510ff60 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -1,3 +1,3 @@ add_executable(app main.cpp) -target_link_libraries(app PUBLIC Eigen3::Eigen Geometry) +target_link_libraries(app PUBLIC Geometry) diff --git a/apps/main.cpp b/apps/main.cpp index e5c5973..0db4e38 100644 --- a/apps/main.cpp +++ b/apps/main.cpp @@ -1,5 +1,5 @@ -#include "Geometry/dummy.h" -#include "main.h" +#include "Geometry/dummy.hpp" +#include "main.hpp" int main(){ cout<<"Hello World"< #include @@ -12,4 +12,4 @@ using namespace std; int main(); -#endif //GEOMETRY_MAIN_H +#endif //GEOMETRY_MAIN_HPP diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5362656..ae91b74 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -set(HEADER_LIST "${Geometry_SOURCE_DIR}/include/Geometry/dummy.h") +set(HEADER_LIST "${Geometry_SOURCE_DIR}/include/Geometry/dummy.hpp") add_library(Geometry dummy.cpp ${HEADER_LIST}) diff --git a/src/dummy.cpp b/src/dummy.cpp index ff09b57..f77543c 100644 --- a/src/dummy.cpp +++ b/src/dummy.cpp @@ -1,7 +1,7 @@ // // Created by nb on 31.12.23. // -#include "Geometry/dummy.h" +#include "Geometry/dummy.hpp" #include #include diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..4b916f8 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,11 @@ +FetchContent_Declare( + catch + GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v2.13.6) +FetchContent_MakeAvailable(catch) + +add_executable(testlib testgeometry.cpp) + +target_link_libraries(testlib PRIVATE Geometry Catch2::Catch2) + +add_test(NAME testlibtest COMMAND testlib) \ No newline at end of file