-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
35 lines (30 loc) · 1.5 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
project(ImageSpaceRefractions C CXX)
# Set this before including framework such that it knows to use the OpenGL4.5 version of GLAD
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/framework")
add_subdirectory("framework") # Create framework library and include CMake scripts (compiler warnings, sanitizers and static analyzers).
else()
add_subdirectory("../../../framework/" "${CMAKE_BINARY_DIR}/framework/") # During development the framework lives in parent folder.
endif()
# Additional source files
add_library(RefractionsLib "")
enable_sanitizers(RefractionsLib)
set_project_warnings(RefractionsLib)
include(${CMAKE_CURRENT_LIST_DIR}/src/CMakeLists.txt)
target_include_directories(RefractionsLib PUBLIC "${CMAKE_CURRENT_LIST_DIR}/src/")
target_compile_features(RefractionsLib PUBLIC cxx_std_20)
target_link_libraries(RefractionsLib PUBLIC CGFramework)
# Find and link OpenMP
find_package(OpenMP REQUIRED)
target_link_libraries(RefractionsLib PUBLIC OpenMP::OpenMP_CXX)
# Main executable config
add_executable(RefractionsExec "src/main.cpp")
enable_sanitizers(RefractionsExec)
set_project_warnings(RefractionsExec)
target_compile_features(RefractionsExec PUBLIC cxx_std_20)
target_link_libraries(RefractionsExec PRIVATE RefractionsLib)
# Preprocessor definitions for paths
target_compile_definitions(RefractionsLib PUBLIC
"-DCACHE_DIR=\"${CMAKE_CURRENT_LIST_DIR}/cache/\""
"-DRESOURCES_DIR=\"${CMAKE_CURRENT_LIST_DIR}/resources/\""
"-DSHADERS_DIR=\"${CMAKE_CURRENT_LIST_DIR}/shaders/\"")