-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
192 lines (143 loc) · 3.31 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
cmake_minimum_required(VERSION 3.12)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_VERBOSE_MAKEFILE OFF)
project(raytracer
VERSION 1.0
DESCRIPTION "Photorealistic Rendering in C++"
LANGUAGES CXX
)
enable_testing()
# MY LIBRARIES DECLARATIONS:
add_library(trace
src/hdrimage.cpp
src/transformation.cpp
src/shapes.cpp
src/materials.cpp
src/catch_amalgamated.cpp
src/scene.cpp
)
# PATH TO MY LIBRARIES:
target_include_directories(trace PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
# OTHER LIBRARIES:
include(FindPkgConfig)
pkg_check_modules(GDLIB REQUIRED gdlib)
# EXECUTABLE:
add_executable(raytracer
src/raytracer.cpp
)
target_include_directories(trace PUBLIC ${GDLIB_INCLUDE_DIRS})
target_link_directories(trace PUBLIC ${GDLIB_LIBRARY_DIRS})
target_compile_options(trace PUBLIC ${GDLIB_CFLAGS})
target_link_libraries(trace PUBLIC ${GDLIB_LIBRARIES})
target_link_libraries(raytracer PUBLIC trace)
# TESTS:
# colortest
add_executable(colortest
test/colors.cpp
)
target_link_libraries(colortest PUBLIC trace)
add_test(NAME colortest
COMMAND colortest
)
# hdrimagetest
add_executable(hdrimagetest
test/hdrimage.cpp
)
target_link_libraries(hdrimagetest PUBLIC trace)
add_test(NAME hdrimagetest
COMMAND hdrimagetest
)
# geometrytest
add_executable(geometrytest
test/geometry.cpp
)
target_link_libraries(geometrytest PUBLIC trace)
add_test(NAME geometrytest
COMMAND geometrytest
)
# transformationtest
add_executable(transformationtest
test/transformation.cpp
)
target_link_libraries(transformationtest PUBLIC trace)
add_test(NAME transformationtest
COMMAND transformationtest
)
# raytest
add_executable(raytest
test/ray.cpp
)
target_link_libraries(raytest PUBLIC trace)
add_test(NAME raytest
COMMAND raytest
)
# cameratest
add_executable(cameratest
test/camera.cpp
)
target_link_libraries(cameratest PUBLIC trace)
add_test(NAME cameratest
COMMAND cameratest
)
# imagetracertest
add_executable(imagetracertest
test/imagetracer.cpp
)
target_link_libraries(imagetracertest PUBLIC trace)
add_test(NAME imagetracertest
COMMAND imagetracertest
)
# shapetest
add_executable(shapetest
test/shapes.cpp
)
target_link_libraries(shapetest PUBLIC trace)
add_test(NAME shapetest
COMMAND shapetest
)
# worldtest
add_executable(worldtest
test/world.cpp
)
target_link_libraries(worldtest PUBLIC trace)
add_test(NAME worldtest
COMMAND worldtest
)
# materialtest
add_executable(materialtest
test/materials.cpp
)
target_link_libraries(materialtest PUBLIC trace)
add_test(NAME materialtest
COMMAND materialtest
)
# pcgtest
add_executable(pcgtest
test/pcg.cpp
)
target_link_libraries(pcgtest PUBLIC trace)
add_test(NAME pcgtest
COMMAND pcgtest
)
# rendertest
add_executable(rendertest
test/render.cpp
)
target_link_libraries(rendertest PUBLIC trace)
add_test(NAME rendertest
COMMAND rendertest
)
# scenetest
add_executable(scenetest
test/scene.cpp
)
target_link_libraries(scenetest PUBLIC trace)
add_test(NAME scenetest
COMMAND scenetest
)
# COMPILER FEAUTURES:
target_compile_features(raytracer PUBLIC cxx_std_17)