diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..beb37de --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,66 @@ +cmake_minimum_required(VERSION 3.14) + +project(Raychel LANGUAGES CXX) + +include(cmake/find_dependencies.cmake) + +set(RAYCHEL_INCLUDE_DIR + "include/Raychel" +) + +add_library(Raychel SHARED + "${RAYCHEL_INCLUDE_DIR}/Core/Types.h" + "${RAYCHEL_INCLUDE_DIR}/Core/SDFContainer.h" + "${RAYCHEL_INCLUDE_DIR}/Core/Raymarch.h" + "${RAYCHEL_INCLUDE_DIR}/Core/ZigguratNormal.h" + "${RAYCHEL_INCLUDE_DIR}/Core/Scene.h" + "${RAYCHEL_INCLUDE_DIR}/Core/Serialize.h" + "${RAYCHEL_INCLUDE_DIR}/Core/Deserialize.h" + "${RAYCHEL_INCLUDE_DIR}/Core/SDFPrimitives.h" + "${RAYCHEL_INCLUDE_DIR}/Core/SDFTransforms.h" + "${RAYCHEL_INCLUDE_DIR}/Core/SDFBooleans.h" + "${RAYCHEL_INCLUDE_DIR}/Core/SDFModifiers.h" + + "${RAYCHEL_INCLUDE_DIR}/Render/MaterialContainer.h" + "${RAYCHEL_INCLUDE_DIR}/Render/Framebuffer.h" + "${RAYCHEL_INCLUDE_DIR}/Render/Renderer.h" + "${RAYCHEL_INCLUDE_DIR}/Render/RenderUtils.h" + "${RAYCHEL_INCLUDE_DIR}/Render/Camera.h" + "${RAYCHEL_INCLUDE_DIR}/Render/RayHistogram.h" + "${RAYCHEL_INCLUDE_DIR}/Render/FatPixel.h" + "${RAYCHEL_INCLUDE_DIR}/Render/Denoise.h" + "${RAYCHEL_INCLUDE_DIR}/Render/Materials.h" + + "src/Core/Scene.cpp" + "src/Core/ZigguratNormal.cpp" + "src/Render/Renderer.cpp" + "src/Render/RenderUtils.cpp" + "src/Render/Denoise.cpp" + "src/Core/Serialize.cpp" + "src/Core/Deserialize.cpp" + "src/Core/SDFPrimitives.cpp" + "src/Core/Raymarch.cpp" +) + +target_include_directories(Raychel PUBLIC + "include" +) + +target_compile_features(Raychel PUBLIC cxx_std_20) +target_compile_options(Raychel PUBLIC + -Wall + -Wextra + -Wshadow + -Wpedantic + -Wconversion + -Werror +) + +target_link_libraries(Raychel PUBLIC + RaychelLogger + RaychelCore + RaychelMath + tbb +) + +add_subdirectory(test) diff --git a/cmake/find_dependencies.cmake b/cmake/find_dependencies.cmake new file mode 100644 index 0000000..a8b3861 --- /dev/null +++ b/cmake/find_dependencies.cmake @@ -0,0 +1,69 @@ +include(FetchContent) + +find_package(RaychelLogger QUIET) + +if(NOT RaychelLogger_FOUND) + + message(STATUS "Could not find a local installation of RaychelLogger, using version off GitHub...") + + FetchContent_Declare(RAYCHEL_LOGGER + GIT_REPOSITORY "https://github.com/Weckyy702/RaychelLogger" + GIT_TAG "main" + ) + + FetchContent_MakeAvailable(RAYCHEL_LOGGER) + + set(RAYCHEL_LOGGER_EXTERNAL true) + +endif() + +find_package(RaychelCore QUIET) + +if(NOT RaychelCore_FOUND) + + message(STATUS "Could not find a local installation of RaychelCore, using version off GitHub...") + FetchContent_Declare(RAYCHEL_CORE + GIT_REPOSITORY "https://github.com/Weckyy702/RaychelCore" + GIT_TAG "main" + ) + + FetchContent_MakeAvailable(RAYCHEL_CORE) + + set(RAYCHEL_CORE_EXTERNAL true) + +endif() + +find_package(RaychelMath QUIET) + +if(NOT RaychelMath_FOUND) + + message(STATUS "Could not find a local installation of RaychelMath, using version off GitHub...") + FetchContent_Declare(RAYCHEL_MATH + GIT_REPOSITORY "https://github.com/Weckyy702/RaychelMath" + GIT_TAG "main" + ) + + FetchContent_MakeAvailable(RAYCHEL_MATH) + + set(RAYCHEL_MATH_EXTERNAL true) + +endif() + +if(RAYCHEL_BUILD_TESTS) + + find_package(Catch2 QUIET) + + if(NOT Catch2_FOUND) + message(STATUS "Could not find a local installation of Catch2, using version off GitHub...") + endif() + + FetchContent_Declare(CATCH_2 + GIT_REPOSITORY "https://github.com/catchorg/Catch2" + GIT_TAG "v2.13.8" + ) + + FetchContent_MakeAvailable(CATCH_2) + + set(CATCH_2_EXTERNAL true) + +endif()