diff --git a/CMakeLists.txt b/CMakeLists.txt index e69de29..7c20685 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.1) + +include(ExternalProject) + +project(DoRayMe) + +set(CMAKE_CXX_STANDARD 11) + + +#Add external projects that directly need to be builded +ExternalProject_Add(googletest + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/googletest" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/external/googletest" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" +) + +# Main app +add_subdirectory(source) +# Unit Tests +add_subdirectory(tests) \ No newline at end of file diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt new file mode 100644 index 0000000..26d9f3b --- /dev/null +++ b/source/CMakeLists.txt @@ -0,0 +1,16 @@ +# To simplify testing, the app is build in two passes, + +# First most is build as a library +add_library(rayonnement STATIC math_helper.cpp) + +set(RAY_HEADERS include/tuples.h include/math_helper.h) +set(RAY_SOURCES tuples.cpp) + +target_include_directories(rayonnement PUBLIC include) +target_sources(rayonnement PRIVATE ${RAY_HEADERS} ${RAY_SOURCES}) + + +# Second we build the main executable +add_executable(dorayme main.cpp) +target_include_directories(rayonnement PUBLIC include) +target_link_libraries(dorayme rayonnement) \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..abdd724 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,12 @@ +project(DoRayTested) + +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) + +set(TESTS_SRC tuples_test.cpp) + +add_executable(testMyRays) +target_include_directories(testMyRays PUBLIC ${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR}) +target_include_directories(testMyRays PUBLIC ../source/include) +target_sources(testMyRays PRIVATE ${TESTS_SRC}) +target_link_libraries(testMyRays gtest gtest_main rayonnement Threads::Threads) \ No newline at end of file