forked from UnrealKaraulov/newbspguy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
257 lines (217 loc) · 9.23 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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
cmake_minimum_required (VERSION 3.28)
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 LANGUAGES C CXX)
set(SOURCE_FILES
src/main.cpp
# command line
src/cli/CommandLine.h src/cli/CommandLine.cpp
src/cli/ProgressMeter.h src/cli/ProgressMeter.cpp
# BSP and related structures
src/bsp/forcecrc32.h src/bsp/forcecrc32.cpp
src/bsp/BspMerger.h src/bsp/BspMerger.cpp
src/bsp/Bsp.h src/bsp/Bsp.cpp
src/bsp/bsplimits.h src/bsp/bsplimits.cpp
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/Sprite.h src/bsp/Sprite.cpp
src/bsp/remap.h src/bsp/remap.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
# 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/Settings.h src/editor/Settings.cpp
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
# 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/backends/imgui_impl_glfw.cpp
imgui/backends/imgui_impl_opengl3.cpp
imgui/misc/cpp/imgui_stdlib.cpp
# utils
src/util/lodepng.h src/util/lodepng.cpp
src/util/quantizer.h src/util/quantizer.cpp
src/util/ini.h
src/util/lang_defs.h
src/util/lang.h src/util/lang.cpp
src/util/quantizer.h src/util/quantizer.cpp
# 3D model viewer
src/mdl/mdl_studio.h src/mdl/mdl_studio.cpp
# OPENFILEDIALOG
src/filedialog/stb_image.h
src/filedialog/ImFileDialog.h src/filedialog/ImFileDialog.cpp
)
include_directories(src)
include_directories(src/bsp)
include_directories(src/cli)
include_directories(src/data)
include_directories(src/editor)
include_directories(src/filedialog)
include_directories(src/gl)
include_directories(src/qtools)
include_directories(src/util)
include_directories(src/mdl)
include_directories(imgui)
include_directories(imgui/examples)
include_directories(imgui/misc/cpp)
include_directories(imgui/backends)
include_directories(glew/include)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
add_subdirectory(fmt)
add_subdirectory(glfw)
set(CMAKE_CXX_STANDARD_REQUIRED True)
if(MSVC)
# compile using the static runtime
add_definitions(-DGLEW_STATIC)
add_definitions(-DNDEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++latest")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD /wd4244 /wd4018")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /wd4244 /wd4018 /W0")
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT bspguy)
target_link_libraries(${PROJECT_NAME} fmt::fmt glfw)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
target_link_libraries(${PROJECT_NAME} opengl32 ${CMAKE_CURRENT_SOURCE_DIR}/glew/lib/Release/x64/glew32s.lib)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
target_link_libraries(${PROJECT_NAME} opengl32 ${CMAKE_CURRENT_SOURCE_DIR}/glew/lib/Release/Win32/glew32s.lib)
endif()
source_group("Header Files\\bsp" FILES src/bsp/forcecrc32.h
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/remap.h)
source_group("Source Files\\bsp" FILES src/bsp/forcecrc32.cpp
src/bsp/BspMerger.cpp
src/bsp/Bsp.cpp
src/bsp/bsplimits.cpp
src/bsp/bsptypes.cpp
src/bsp/Entity.cpp
src/bsp/Keyvalue.cpp
src/bsp/Wad.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/Settings.h
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/Clipper.h)
source_group("Source Files\\editor" FILES src/editor/Settings.cpp
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/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/mat4x4.h)
source_group("Source Files\\util" FILES src/util/util.cpp
src/util/vectors.cpp
src/util/mat4x4.cpp)
source_group("Header Files\\util\\lib" FILES src/util/quantizer.h
src/util/ini.h
src/util/INIReader.h
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/backends/imgui_impl_glfw.cpp
imgui/backends/imgui_impl_opengl3.cpp
imgui/misc/cpp/imgui_stdlib.cpp
src/util/lodepng.cpp
src/util/quantizer.cpp
src/util/ini.c
src/util/INIReader.cpp)
source_group("Header Files\\mdl" FILES
src/mdl/mdl_studio.h)
source_group("Source Files\\mdl" FILES
src/mdl/mdl_studio.cpp)
source_group("Header Files\\filedialog" FILES
src/filedialog/stb_image.h
src/filedialog/ImFileDialog.h)
source_group("Source Files\\filedialog" FILES src/filedialog/ImFileDialog.c)
add_definitions(-DNOMINMAX)
else()
add_definitions(-DNDEBUG)
if(WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
target_link_libraries(${PROJECT_NAME} fmt::fmt glfw ${CMAKE_CURRENT_SOURCE_DIR}/glew/lib/Release/x64/glew32.lib opengl32)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
target_link_libraries(${PROJECT_NAME} fmt::fmt glfw ${CMAKE_CURRENT_SOURCE_DIR}/glew/lib/Release/Win32/glew32.lib opengl32)
endif()
add_definitions(-DWIN32)
add_definitions(-DMINGW)
else()
target_link_libraries(${PROJECT_NAME} GL GLU fmt::fmt glfw Xxf86vm Xrandr pthread Xi GLEW stdc++fs )
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(PICO_ENABLE_CXX_EXCEPTIONS 1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++2a -g0 -O3 -fno-stack-protector -w -Wfatal-errors\
-fcf-protection=none -ffunction-sections -fdata-sections -mtune=generic -fpermissive -fno-sized-deallocation\
-Wno-delete-non-virtual-dtor -Wno-invalid-offsetof -Wno-unused-variable -Wno-unused-value -Wno-unused-result\
-Wno-unused-function -Wno-write-strings -Wno-switch -Wno-enum-compare -Wno-sign-compare -Wno-format\
-Wno-ignored-attributes -Wno-strict-aliasing -fno-plt -fno-devirtualize -Wno-unused-local-typedefs\
-Wno-unused-but-set-variable -Wno-stringop-truncation -Wno-format-truncation -Wno-class-memaccess")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -fno-stack-protector -Wfatal-errors -ffunction-sections\
-fdata-sections -mtune=generic -fpermissive -fno-sized-deallocation -Wno-unused-variable -Wno-unused-value\
-Wno-unused-result -Wno-unused-function -Wno-write-strings -Wno-switch -Wno-enum-compare -Wno-sign-compare\
-Wno-format -Wno-ignored-attributes -Wno-strict-aliasing -fno-plt -fno-devirtualize -Wno-unused-local-typedefs\
-Wno-unused-but-set-variable -Wno-stringop-truncation -Wno-format-truncation -Wno-class-memaccess")
endif()