-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
66 lines (54 loc) · 1.87 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
cmake_minimum_required(VERSION 3.15)
########################################
# Project setup
########################################
project(raytracer)
########################################
# Set up the compiler flags
########################################
set(CMAKE_CXX_STANDARD 17)
########################################
# Define output paths
########################################
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
########################################
# Define basic flags
########################################
option(BUILD_TESTS "Build raytracer with tests" ON)
set(SRC_FILES
# API
${CMAKE_CURRENT_LIST_DIR}/src/image.cpp
${CMAKE_CURRENT_LIST_DIR}/src/render.cpp
# IMPLEMENTATION
${CMAKE_CURRENT_LIST_DIR}/src/tokenizer.cpp
${CMAKE_CURRENT_LIST_DIR}/src/builder.cpp
${CMAKE_CURRENT_LIST_DIR}/src/datatypes.cpp
${CMAKE_CURRENT_LIST_DIR}/src/geometry.cpp
${CMAKE_CURRENT_LIST_DIR}/src/parser.cpp
)
set(Raytracer_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include/")
add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
# Set public API
target_include_directories(${PROJECT_NAME}
PUBLIC ${Raytracer_INCLUDE_DIR}
PRIVATE "${PROJECT_SOURCE_DIR}/src")
# Add dependencies
find_package(PNG REQUIRED)
find_package(JPEG REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE ${PNG_LIBRARY} ${JPEG_LIBRARIES})
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
target_link_libraries(${PROJECT_NAME} PRIVATE OpenMP::OpenMP_CXX)
endif()
########################################
# Add thirdparty
########################################
add_subdirectory(thirdparty)
# Tests
if (BUILD_TESTS)
add_subdirectory(tests)
endif(BUILD_TESTS)
# Tool
add_executable(raytracer-tool main.cpp)
target_link_libraries(raytracer-tool ${PROJECT_NAME})