-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
171 lines (146 loc) · 4.68 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
cmake_minimum_required(VERSION 2.6)
project(chroma-ray-tracer)
# Set the output folder where your program will be created
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_CONFIGURATION_TYPES Debug Release)
# The following folder will be included
include_directories(src)
#include glfw
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF)
option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF)
option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF)
add_subdirectory(src/thirdparty/glfw-3.3)
#include spdlog
add_subdirectory(src/thirdparty/spdlog-1.3.1)
set (thirdparty_sources
src/thirdparty/tinyexr/tinyexr.h
src/thirdparty/tinyexr/tinyexr.cc
src/thirdparty/tinyxml2/tinyxml2.h
src/thirdparty/tinyxml2/tinyxml2.cpp
src/thirdparty/glad/include/glad/glad.h
src/thirdparty/glad/include/KHR/khrplatform.h
src/thirdparty/glad/src/glad.c
src/thirdparty/imgui/imconfig.h
src/thirdparty/imgui/imgui.cpp
src/thirdparty/imgui/imgui.h
src/thirdparty/imgui/imgui_impl_opengl3.h
src/thirdparty/imgui/imgui_impl_opengl3.cpp
src/thirdparty/imgui/imgui_impl_glfw.h
src/thirdparty/imgui/imgui_impl_glfw.cpp
src/thirdparty/imgui/imgui_demo.cpp
src/thirdparty/imgui/imgui_draw.cpp
src/thirdparty/imgui/imgui_internal.h
src/thirdparty/imgui/imgui_widgets.cpp
src/thirdparty/stb_image/stb_image.h
src/thirdparty/stb_image/stb_image_write.h
src/thirdparty/OBJ_loader/OBJ_Loader.h
src/thirdparty/hapPLy/happly.h
)
source_group ("thirdparty\\" FILES
${thirdparty_sources}
)
set (main_sources
src/ray-tracer/main/BRDF.h
src/ray-tracer/main/Camera.h
src/ray-tracer/main/Camera.cpp
src/ray-tracer/main/EntryPoint.cpp
src/ray-tracer/main/Shape.h
src/ray-tracer/main/Geometry.h
src/ray-tracer/main/Geometry.cpp
src/ray-tracer/main/Material.h
src/ray-tracer/main/Light.h
src/ray-tracer/main/Image.h
src/ray-tracer/main/Image.cpp
src/ray-tracer/main/ProceduralTextureMap.h
src/ray-tracer/main/ProceduralTextureMap.cpp
src/ray-tracer/main/Ray.h
src/ray-tracer/main/RayTracer.h
src/ray-tracer/main/RayTracer.cpp
src/ray-tracer/main/Utilities.h
src/ray-tracer/main/Scene.h
src/ray-tracer/main/Scene.cpp
src/ray-tracer/main/Texture.h
src/ray-tracer/main/Texture.cpp
src/ray-tracer/main/TextureMap.h
src/ray-tracer/main/ImageTextureMap.h
src/ray-tracer/main/ImageTextureMap.cpp
src/ray-tracer/main/NoiseTextureMap.h
src/ray-tracer/main/NoiseTextureMap.cpp
src/ray-tracer/main/ObjectLight.h
src/ray-tracer/main/SceneObject.h
src/ray-tracer/main/SceneObject.cpp
src/ray-tracer/main/Window.h
src/ray-tracer/main/Window.cpp
)
source_group ("main\\" FILES
${main_sources}
)
set (acc_sources
src/ray-tracer/accelerationStructures/AccelerationStructure.h
src/ray-tracer/accelerationStructures/BVH.h
src/ray-tracer/accelerationStructures/BVH.cpp
src/ray-tracer/accelerationStructures/Memory.h
src/ray-tracer/accelerationStructures/Memory.cpp
)
source_group ("accelerationStructures\\" FILES
${acc_sources}
)
set (editor_sources
src/ray-tracer/editor/AssetImporter.h
src/ray-tracer/editor/AssetImporter.cpp
src/ray-tracer/editor/Buffer.h
src/ray-tracer/editor/Editor.h
src/ray-tracer/editor/Editor.cpp
src/ray-tracer/editor/ImGuiDrawable.h
src/ray-tracer/editor/Logger.h
src/ray-tracer/editor/Logger.cpp
src/ray-tracer/editor/Observer.h
src/ray-tracer/editor/Settings.h
src/ray-tracer/editor/Settings.cpp
src/ray-tracer/editor/Shader.h
src/ray-tracer/editor/Shader.cpp
)
source_group ("editor\\" FILES
${editor_sources}
)
set (opengl_sources
src/ray-tracer/openGL/openGLBuffer.h
src/ray-tracer/openGL/openGLBuffer.cpp
src/ray-tracer/openGL/openGLVertexArrayObject.h
src/ray-tracer/openGL/openGLVertexArrayObject.cpp
)
source_group ("opengl\\" FILES
${opengl_sources}
)
add_executable (chroma-ray-tracer
${editor_sources}
${main_sources}
${acc_sources}
${opengl_sources}
${thirdparty_sources}
)
# Find and link to OpenGL
include(FindOpenGL)
target_link_libraries(chroma-ray-tracer ${OPENGL_gl_LIBRARY})
# Link to glfw
target_link_libraries(chroma-ray-tracer glfw)
#Link spdlog
target_link_libraries(chroma-ray-tracer spdlog)
#Windows
add_definitions(-DNOC_FILE_DIALOG_IMPLEMENTATION)
add_definitions(-DNOC_FILE_DIALOG_WIN32)
#Tinyexr
add_definitions(-DTINYEXR_USE_THREAD)
#glm
add_definitions(-DGLM_FORCE_RADIANS)
set_target_properties(
chroma-ray-tracer
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
set_target_properties(
chroma-ray-tracer
PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/$(Configuration)")
# Create logs directory
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/logs")