forked from dfranx/SHADERed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
219 lines (187 loc) · 6.82 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
cmake_minimum_required(VERSION 3.1)
set(CMAKE_CXX_STANDARD 17)
project(SHADERed)
# ShaderDebugger
add_subdirectory(libs/ShaderDebugger)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
# source code
set(SOURCES
main.cpp
src/SHADERed/UI/UIHelper.cpp
# connectors
src/SHADERed/EditorEngine.cpp
src/SHADERed/GUIManager.cpp
src/SHADERed/InterfaceManager.cpp
# objects:
src/SHADERed/Objects/PluginAPI/PluginManager.cpp
src/SHADERed/Objects/Export/ExportCPP.cpp
src/SHADERed/Objects/ArcBallCamera.cpp
src/SHADERed/Objects/AudioAnalyzer.cpp
src/SHADERed/Objects/AudioShaderStream.cpp
src/SHADERed/Objects/CameraSnapshots.cpp
src/SHADERed/Objects/DefaultState.cpp
src/SHADERed/Objects/DebugInformation.cpp
src/SHADERed/Objects/FirstPersonCamera.cpp
src/SHADERed/Objects/FunctionVariableManager.cpp
src/SHADERed/Objects/GizmoObject.cpp
src/SHADERed/Objects/ShaderTranscompiler.cpp
src/SHADERed/Objects/KeyboardShortcuts.cpp
src/SHADERed/Objects/Logger.cpp
src/SHADERed/Objects/InputLayout.cpp
src/SHADERed/Objects/MessageStack.cpp
src/SHADERed/Objects/Names.cpp
src/SHADERed/Objects/ObjectManager.cpp
src/SHADERed/Objects/PipelineManager.cpp
src/SHADERed/Objects/ProjectParser.cpp
src/SHADERed/Objects/RenderEngine.cpp
src/SHADERed/Objects/Settings.cpp
src/SHADERed/Objects/ShaderVariableContainer.cpp
src/SHADERed/Objects/SystemVariableManager.cpp
src/SHADERed/Objects/ThemeContainer.cpp
src/SHADERed/Objects/UpdateChecker.cpp
# UI Tools
src/SHADERed/UI/Tools/CubemapPreview.cpp
src/SHADERed/UI/Tools/Magnifier.cpp
# UI Debug
src/SHADERed/UI/Debug/BreakpointListUI.cpp
src/SHADERed/UI/Debug/FunctionStackUI.cpp
src/SHADERed/UI/Debug/ImmediateUI.cpp
src/SHADERed/UI/Debug/ValuesUI.cpp
src/SHADERed/UI/Debug/WatchUI.cpp
# UI
src/SHADERed/UI/CodeEditorUI.cpp
src/SHADERed/UI/CreateItemUI.cpp
src/SHADERed/UI/MessageOutputUI.cpp
src/SHADERed/UI/ObjectListUI.cpp
src/SHADERed/UI/ObjectPreviewUI.cpp
src/SHADERed/UI/OptionsUI.cpp
src/SHADERed/UI/PinnedUI.cpp
src/SHADERed/UI/PipelineUI.cpp
src/SHADERed/UI/PixelInspectUI.cpp
src/SHADERed/UI/PreviewUI.cpp
src/SHADERed/UI/PropertyUI.cpp
src/SHADERed/UI/VariableValueEdit.cpp
# engine:
src/SHADERed/Engine/Timer.cpp
src/SHADERed/Engine/Model.cpp
src/SHADERed/Engine/GLUtils.cpp
src/SHADERed/Engine/GeometryFactory.cpp
src/SHADERed/Engine/Ray.cpp
# libraries:
libs/ImGuiColorTextEdit/TextEditor.cpp
libs/imgui/imgui_draw.cpp
libs/imgui/imgui_widgets.cpp
libs/imgui/imgui_demo.cpp
libs/imgui/imgui.cpp
libs/imgui/examples/imgui_impl_opengl3.cpp
libs/imgui/examples/imgui_impl_sdl.cpp
libs/SPIRVCross/spirv_cfg.cpp
libs/SPIRVCross/spirv_cross.cpp
libs/SPIRVCross/spirv_cross_util.cpp
libs/SPIRVCross/spirv_cross_parsed_ir.cpp
libs/SPIRVCross/spirv_glsl.cpp
libs/SPIRVCross/spirv_parser.cpp
libs/nativefiledialog/nfd_common.c
libs/pugixml/src/pugixml.cpp
)
if(WIN32)
set(SOURCES
"${SOURCES}"
libs/nativefiledialog/nfd_win.cpp
resource.rc
)
elseif(APPLE)
set(SOURCES
"${SOURCES}"
libs/nativefiledialog/nfd_cocoa.m
)
else()
set(SOURCES
"${SOURCES}"
libs/nativefiledialog/nfd_gtk.c
)
# link gtk on linux
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED gtk+-3.0)
link_directories(${GTK_LIBRARY_DIRS})
add_definitions(${GTK_CFLAGS})
endif()
# cmake toolchain
if(CMAKE_TOOLCHAIN_FILE)
include(${CMAKE_TOOLCHAIN_FILE})
endif(CMAKE_TOOLCHAIN_FILE)
# sdl2
if(WIN32 OR APPLE OR NOT ${USE_PKG_CHECK_SDL})
find_package(SDL2 REQUIRED)
else()
# find sdl2 on linux
pkg_check_modules(SDL2 REQUIRED sdl2)
endif()
# opengl
find_package(OpenGL REQUIRED)
# glew
find_package(GLEW REQUIRED)
# glm
find_package(GLM REQUIRED)
# ASSIMP
find_package(ASSIMP REQUIRED)
# sfml audio
find_package(SFML COMPONENTS system audio network)
# glslang
set(ENABLE_GLSLANG_BINARIES OFF)
set(ENABLE_SPVREMAPPER OFF)
add_subdirectory(libs/glslang)
# Native macOS frameworks
if (APPLE)
# Link Homebrew library path for Mojave and up
# See: https://stackoverflow.com/questions/54068035/linking-not-working-in-homebrews-cmake-since-mojave
link_directories(/usr/local/lib)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework AppKit -framework AudioToolbox -framework AudioUnit -framework Carbon -framework Cocoa -framework CoreAudio -framework CoreVideo -framework ForceFeedback -framework IOKit -framework OpenGL -framework CoreServices -framework Security")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -framework AppKit -framework AudioToolbox -framework AudioUnit -framework Carbon -framework Cocoa -framework CoreAudio -framework CoreVideo -framework ForceFeedback -framework IOKit -framework OpenGL -framework CoreServices -framework Security")
endif()
# create executable
add_executable(SHADERed ${SOURCES})
# properties
set_target_properties(SHADERed PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
)
# include directories
target_include_directories(SHADERed PRIVATE ${SDL2_INCLUDE_DIRS} ${GLM_INCLUDE_DIRS} ${GLEW_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIRS} ${ASSIMP_INCLUDE_DIR} ${SFML_INCLUDE_DIR})
target_include_directories(SHADERed PRIVATE src libs libs/glslang libs/ShaderDebugger/inc)
if (NOT WIN32)
target_include_directories(SHADERed PRIVATE ${GTK_INCLUDE_DIRS})
endif()
# link libraries
target_link_libraries(SHADERed ${OPENGL_LIBRARIES} ${GLM_LIBRARY_DIRS} ${ASSIMP_LIBRARIES} glslang SPIRV ShaderDebugger)
# link sfml
if(${USE_FINDSFML})
target_link_libraries(SHADERed ${SFML_LIBRARIES})
else()
target_link_libraries(SHADERed sfml-audio sfml-system sfml-network)
endif()
if(WIN32)
# link specific win32 libraries
target_link_libraries(SHADERed GLEW::GLEW SDL2::SDL2 SDL2::SDL2main)
elseif(UNIX AND NOT APPLE)
# link linux libraries
target_link_libraries(SHADERed ${GLEW_LIBRARIES} ${SDL2_LIBRARIES} ${GTK_LIBRARIES} ${CMAKE_DL_LIBS})
elseif(APPLE)
target_link_libraries(SHADERed GLEW::GLEW ${SDL2_LIBRARIES} ${GTK_LIBRARIES} ${CMAKE_DL_LIBS})
endif()
if (NOT MSVC)
target_compile_options(SHADERed PRIVATE -Wno-narrowing)
endif()
set(BINARY_INST_DESTINATION "bin")
set(RESOURCE_INST_DESTINATION "share/shadered")
install(PROGRAMS bin/SHADERed DESTINATION "${BINARY_INST_DESTINATION}" RENAME shadered)
install(DIRECTORY bin/data bin/templates bin/themes bin/plugins DESTINATION "${RESOURCE_INST_DESTINATION}")
if (UNIX AND NOT APPLE)
# install XDG desktop file and icon on Linux/BSD
install(FILES Misc/Linux/org.shadered.SHADERed.desktop DESTINATION "share/applications" RENAME shadered.desktop)
install(FILES bin/icon_32x32.png DESTINATION "share/icons/hicolor/32x32/apps" RENAME shadered.png)
install(FILES bin/icon_64x64.png DESTINATION "share/icons/hicolor/64x64/apps" RENAME shadered.png)
install(FILES bin/icon_128x128.png DESTINATION "share/icons/hicolor/128x128/apps" RENAME shadered.png)
install(FILES bin/icon_256x256.png DESTINATION "share/icons/hicolor/256x256/apps" RENAME shadered.png)
endif()