-
Notifications
You must be signed in to change notification settings - Fork 31
/
CMakeLists.txt
224 lines (188 loc) · 7.44 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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
cmake_minimum_required(VERSION 3.6)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(USE_MSVC_RUNTIME_LIBRARY_DLL OFF CACHE BOOL "" FORCE)
project(bspguy)
set(SOURCE_FILES
src/main.cpp
src/types.h
# command line
src/cli/CommandLine.h src/cli/CommandLine.cpp
src/cli/ProgressMeter.h src/cli/ProgressMeter.cpp
# BSP and related structures
src/bsp/BspMerger.h src/bsp/BspMerger.cpp
src/bsp/Bsp.h src/bsp/Bsp.cpp
src/bsp/bsplimits.h
src/bsp/bsptypes.h src/bsp/bsptypes.cpp
src/bsp/Entity.h src/bsp/Entity.cpp
src/bsp/Keyvalue.h src/bsp/Keyvalue.cpp
src/bsp/Wad.h src/bsp/Wad.cpp
src/bsp/remap.h src/bsp/remap.cpp
src/bsp/colors.h src/bsp/colors.cpp
# Math and stuff
src/util/util.h src/util/util.cpp
src/util/vectors.h src/util/vectors.cpp
src/util/mat4x4.h src/util/mat4x4.cpp
src/util/Polygon3D.h src/util/Polygon3D.cpp
src/util/Line2D.h src/util/Line2D.cpp
src/globals.h src/globals.cpp
# Navigation meshes
src/nav/NavMesh.h src/nav/NavMesh.cpp
src/nav/NavMeshGenerator.h src/nav/NavMeshGenerator.cpp
src/nav/LeafNavMeshGenerator.h src/nav/LeafNavMeshGenerator.cpp
src/nav/LeafNavMesh.h src/nav/LeafNavMesh.cpp
src/nav/PolyOctree.h src/nav/PolyOctree.cpp
src/nav/LeafOctree.h src/nav/LeafOctree.cpp
# OpenGL rendering
src/gl/shaders.h src/gl/shaders.cpp
src/gl/primitives.h src/gl/primitives.cpp
src/gl/Shader.h src/gl/Shader.cpp
src/gl/ShaderProgram.h src/gl/ShaderProgram.cpp
src/gl/VertexBuffer.h src/gl/VertexBuffer.cpp
src/gl/Texture.h src/gl/Texture.cpp
src/editor/LightmapNode.h src/editor/LightmapNode.cpp
# 3D editor
src/editor/Renderer.h src/editor/Renderer.cpp
src/editor/Gui.h src/editor/Gui.cpp
src/editor/BspRenderer.h src/editor/BspRenderer.cpp
src/editor/PointEntRenderer.h src/editor/PointEntRenderer.cpp
src/editor/Fgd.h src/editor/Fgd.cpp
src/editor/Clipper.h src/editor/Clipper.cpp
src/editor/Command.h src/editor/Command.cpp
src/editor/AppSettings.h src/editor/AppSettings.cpp
# map compiler code
src/qtools/rad.h src/qtools/rad.cpp
src/qtools/vis.h src/qtools/vis.cpp
src/qtools/winding.h src/qtools/winding.cpp
# library files
imgui/imgui.cpp
imgui/imgui_tables.cpp
imgui/imgui_widgets.cpp
imgui/imgui_draw.cpp
imgui/imgui_demo.cpp
imgui/backends/imgui_impl_glfw.cpp
imgui/backends/imgui_impl_opengl3.cpp
src/util/lodepng.h
src/util/lodepng.cpp
src/util/tinyfiledialogs.c
src/util/tinyfiledialogs.h
)
include_directories(src)
include_directories(src/bsp)
include_directories(src/cli)
include_directories(src/data)
include_directories(src/editor)
include_directories(src/gl)
include_directories(src/qtools)
include_directories(src/util)
include_directories(src/nav)
include_directories(imgui)
include_directories(imgui/examples)
include_directories(imgui/backends)
include_directories(glew/include)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} glfw)
add_definitions(-DGLEW_STATIC)
if(MSVC)
# no warnings for release builds
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W0")
# compile using the static runtime
set_property(TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
add_subdirectory(glfw)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT bspguy)
target_link_libraries(${PROJECT_NAME} opengl32 ${CMAKE_CURRENT_SOURCE_DIR}/glew/lib/Release/x64/glew32s.lib)
source_group("Header Files\\bsp" FILES src/bsp/BspMerger.h
src/bsp/Bsp.h
src/bsp/bsplimits.h
src/bsp/bsptypes.h
src/bsp/Entity.h
src/bsp/Keyvalue.h
src/bsp/Wad.h
src/bsp/colors.h
src/bsp/remap.h)
source_group("Source Files\\bsp" FILES src/bsp/BspMerger.cpp
src/bsp/Bsp.cpp
src/bsp/bsptypes.cpp
src/bsp/Entity.cpp
src/bsp/Keyvalue.cpp
src/bsp/Wad.cpp
src/bsp/colors.cpp
src/bsp/remap.cpp)
source_group("Header Files\\cli" FILES src/cli/CommandLine.h
src/cli/ProgressMeter.h)
source_group("Source Files\\cli" FILES src/cli/CommandLine.cpp
src/cli/ProgressMeter.cpp)
source_group("Header Files\\gl" FILES src/gl/Shader.h
src/gl/ShaderProgram.h
src/gl/VertexBuffer.h
src/gl/Texture.h
src/gl/primitives.h
src/gl/shaders.h)
source_group("Source Files\\gl" FILES src/gl/Shader.cpp
src/gl/ShaderProgram.cpp
src/gl/VertexBuffer.cpp
src/gl/Texture.cpp
src/gl/primitives.cpp
src/gl/shaders.cpp)
source_group("Header Files\\editor" FILES src/editor/BspRenderer.h
src/editor/LightmapNode.h
src/editor/Renderer.h
src/editor/Fgd.h
src/editor/Gui.h
src/editor/PointEntRenderer.h
src/editor/Command.h
src/editor/AppSettings.h
src/editor/Clipper.h)
source_group("Source Files\\editor" FILES src/editor/BspRenderer.cpp
src/editor/LightmapNode.cpp
src/editor/Renderer.cpp
src/editor/Fgd.cpp
src/editor/Gui.cpp
src/editor/PointEntRenderer.cpp
src/editor/Command.cpp
src/editor/AppSettings.cpp
src/editor/Clipper.cpp)
source_group("Header Files\\qtools" FILES src/qtools/rad.h
src/qtools/vis.h
src/qtools/winding.h)
source_group("Source Files\\qtools" FILES src/qtools/rad.cpp
src/qtools/vis.cpp
src/qtools/winding.cpp)
source_group("Header Files\\util" FILES src/util/util.h
src/util/vectors.h
src/util/Polygon3D.h
src/util/Line2D.h
src/util/mat4x4.h)
source_group("Source Files\\util" FILES src/util/util.cpp
src/util/vectors.cpp
src/util/Polygon3D.cpp
src/util/Line2D.cpp
src/util/mat4x4.cpp)
source_group("Header Files\\nav" FILES src/nav/NavMesh.h
src/nav/NavMeshGenerator.h
src/nav/LeafNavMeshGenerator.h
src/nav/LeafNavMesh.h
src/nav/PolyOctree.h
src/nav/LeafOctree.h)
source_group("Source Files\\nav" FILES src/nav/NavMesh.cpp
src/nav/NavMeshGenerator.cpp
src/nav/LeafNavMeshGenerator.cpp
src/nav/LeafNavMesh.cpp
src/nav/PolyOctree.cpp
src/nav/LeafOctree.cpp)
source_group("Header Files\\util\\lib" FILES src/util/lodepng.h)
source_group("Source Files\\util\\lib" FILES imgui/imgui.cpp
imgui/imgui_tables.cpp
imgui/imgui_widgets.cpp
imgui/imgui_draw.cpp
imgui/imgui_demo.cpp
imgui/backends/imgui_impl_glfw.cpp
imgui/backends/imgui_impl_opengl3.cpp
src/util/lodepng.cpp)
else()
target_link_libraries(${PROJECT_NAME} GL GLU X11 Xxf86vm Xrandr pthread Xi GLEW stdc++fs ${CMAKE_DL_LIBS})
set(CMAKE_CXX_FLAGS "-Wall -std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set(CMAKE_CXX_FLAGS_RELEASE "-Os -fno-exceptions -w -Wfatal-errors")
endif()