-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
191 lines (162 loc) · 5.38 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
cmake_minimum_required(VERSION 3.8)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(Assignment3)
#-------------------------------------------------------------------------------
# Build options
#-------------------------------------------------------------------------------
option(BUILD_DEBUG "Build with debug settings" OFF)
option(BUILD_DOCS "Build documentation" OFF)
set(BUILD_DEBUG ${BUILD_DEBUG} CACHE BOOL "Build debug" FORCE)
if (BUILD_DEBUG)
set(CMAKE_BUILD_TYPE Debug)
endif()
#-------------------------------------------------------------------------------
# Set target
#-------------------------------------------------------------------------------
set(APPLICATION_3_1_SOURCE
# Scene Object & Structure
src/scene/sphere.cpp
src/scene/triangle.cpp
src/scene/light.cpp
src/scene/bvh.cpp
src/scene/bbox.cpp
# Pathtracer
src/pathtracer/camera.cpp
src/pathtracer/bsdf.cpp
src/pathtracer/pathtracer.cpp
# Imgui
src/imgui/imgui.cpp
src/imgui/imgui_widgets.cpp
src/imgui/imgui_draw.cpp
src/imgui/imgui_tables.cpp
src/imgui/backends/imgui_impl_glfw.cpp
src/imgui/backends/imgui_impl_opengl2.cpp
src/application/pathtracer_launcher_gui.cpp
)
set(APPLICATION_3_2_SOURCE
src/scene/object.cpp
# Collada Parser
src/scene/collada/collada.cpp
src/scene/collada/camera_info.cpp
src/scene/collada/light_info.cpp
src/scene/collada/sphere_info.cpp
src/scene/collada/polymesh_info.cpp
src/scene/collada/material_info.cpp
# Dynamic Scene
src/scene/gl_scene/mesh.cpp
src/scene/gl_scene/scene.cpp
src/scene/gl_scene/sphere.cpp
# MeshEdit
src/util/halfEdgeMesh.cpp
src/application/meshEdit.cpp
src/pathtracer/sampler.cpp
src/pathtracer/advanced_bsdf.cpp
src/scene/environment_light.cpp
src/pathtracer/camera_lens.cpp
src/pathtracer/raytraced_renderer.cpp
# misc
src/util/sphere_drawing.cpp
src/util/lodepng.cpp
# Application
src/application/application.cpp
src/application/main.cpp
src/application/visual_debugger.cpp
src/imgui/imgui.cpp
src/imgui/imgui_widgets.cpp
src/imgui/imgui_draw.cpp
src/imgui/imgui_tables.cpp
src/imgui/backends/imgui_impl_glfw.cpp
src/imgui/backends/imgui_impl_opengl2.cpp
)
set(APPLICATION_HEADERS
# Collada Parser
src/scene/collada/camera_info.h
src/scene/collada/collada_info.h
src/scene/collada/collada.h
src/scene/collada/light_info.h
src/scene/collada/material_info.h
src/scene/collada/polymesh_info.h
src/scene/collada/sphere_info.h
# Dynamic Scene
src/scene/gl_scene/ambient_light.h
src/scene/gl_scene/area_light.h
src/scene/gl_scene/directional_light.h
src/scene/gl_scene/draw_style.h
src/scene/gl_scene/environment_light.h
src/scene/gl_scene/material.h
src/scene/gl_scene/mesh_view.h
src/scene/gl_scene/mesh.h
src/scene/gl_scene/point_light.h
src/scene/gl_scene/scene.h
src/scene/gl_scene/sphere.h
src/scene/gl_scene/spot_light.h
# Scene Object & Structure
src/scene/aggregate.h
src/scene/bbox.h
src/scene/bvh.h
src/scene/environment_light.h
src/scene/light.h
src/scene/object.h
src/scene/primitive.h
src/scene/scene.h
src/scene/sphere.h
src/scene/triangle.h
# MeshEdit
src/util/halfEdgeMesh.h
src/util/image.h
src/util/mutablePriorityQueue.h
src/util/random_util.h
src/util/work_queue.h
# Pathtracer
src/pathtracer/bsdf.h
src/pathtracer/camera.h
src/pathtracer/intersection.h
src/pathtracer/pathtracer.h
src/pathtracer/ray.h
src/pathtracer/raytraced_renderer.h
src/pathtracer/sampler.h
# misc
src/util/sphere_drawing.h
src/util/lodepng.h
# Application
src/application/application.h
src/application/meshEdit.h
src/application/renderer.h
)
if (WIN32)
list(APPEND APPLICATION_3_1_SOURCE src/util/win32/getopt.c)
endif()
if (WIN32 OR APPLE)
add_library(pt31 STATIC ${APPLICATION_3_1_SOURCE} ${APPLICATION_HEADERS})
else()
add_library(pt31 SHARED ${APPLICATION_3_1_SOURCE} ${APPLICATION_HEADERS})
endif()
target_include_directories(pt31 PUBLIC src)
add_executable(pathtracer ${APPLICATION_3_2_SOURCE} ${APPLICATION_HEADERS})
target_include_directories(pathtracer PUBLIC src)
target_link_libraries(pt31 PUBLIC CGL)
target_link_libraries(pathtracer PUBLIC pt31)
set(CGL_INCLUDE_DIRS CGL/include CGL/deps/glew/include CGL/deps/glfw/include ./src/imgui ./src/imgui/backends)
#-------------------------------------------------------------------------------
# Find dependencies
#-------------------------------------------------------------------------------
add_subdirectory(CGL)
target_include_directories(pt31 PUBLIC ${CGL_INCLUDE_DIRS})
target_include_directories(pathtracer PUBLIC ${CGL_INCLUDE_DIRS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CGL_CXX_FLAGS}")
set(OpenGL_GL_PREFERENCE LEGACY)
find_package(OpenGL REQUIRED)
target_link_libraries(pt31 PUBLIC OpenGL::GL)
target_link_libraries(pt31 PUBLIC OpenGL::GLU)
#-------------------------------------------------------------------------------
# Add subdirectories
#-------------------------------------------------------------------------------
# build documentation
if(BUILD_DOCS)
find_package(DOXYGEN)
if(DOXYGEN_FOUND AND BUILD_DOCS)
add_subdirectory(docs)
endif()
endif()
# Install settings
set(CMAKE_INSTALL_PREFIX "${Assignment1_SOURCE_DIR}/")