-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
318 lines (249 loc) · 13.8 KB
/
CMakeLists.txt
File metadata and controls
318 lines (249 loc) · 13.8 KB
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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
cmake_minimum_required(VERSION 3.10)
set(BUILD_TYPE "Debug and Release" CACHE STRING "Choose Build type")
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CONFIGURATION_TYPES Debug Release)
# set the project name
project(VisualNodeSystem LANGUAGES CXX)
option(VISUAL_NODE_SYSTEM_USE_EXTERNAL_IMGUI "Use an external ImGui library instead of compiling our own" OFF)
option(VISUAL_NODE_SYSTEM_BUILD_SHARED_LIBS "Build VisualNodeSystem as a shared library" OFF)
option(VISUAL_NODE_SYSTEM_USE_STATIC_RUNTIME "Use static runtime (/MT) instead of dynamic (/MD) for VisualNodeSystem" ON)
option(VISUAL_NODE_SYSTEM_BUILD_STANDARD_NODES "Build the Visual Node System with standard nodes module" OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(MSVC)
if(VISUAL_NODE_SYSTEM_USE_STATIC_RUNTIME)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
else()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
endif()
# Always add /MP for multi-processor compilation
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
# Turn on the ability to create folders to organize projects (.vcproj)
# It creates "CMakePredefinedTargets" folder by default and adds CMake
# defined projects like INSTALL.vcproj and ZERO_CHECK.vcproj
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
file(GLOB VisualNodeArea_SRC
"SubSystems/VisualNodeArea/VisualNodeArea.cpp"
"SubSystems/VisualNodeArea/VisualNodeArea.h"
"SubSystems/VisualNodeArea/VisualNodeAreaLogic.cpp"
"SubSystems/VisualNodeArea/VisualNodeAreaInput.cpp"
"SubSystems/VisualNodeArea/VisualNodeAreaRendering.cpp"
)
file(GLOB VisualNodeSystem_SRC
"VisualNodeSystem.cpp"
"VisualNodeSystem.h"
"GroupComment.cpp"
"GroupComment.h"
"VisualNodeFactory.cpp"
"VisualNodeFactory.h"
"VisualNode.cpp"
"VisualNode.h"
"VisualNodeSocket.cpp"
"VisualNodeSocket.h"
"VisualNodeCore.cpp"
"VisualNodeCore.h"
"VisualNodeSystemAPI.h"
)
# *************** THIRD_PARTY ***************
file(GLOB jsoncpp_SRC
"ThirdParty/jsoncpp/json_reader.cpp"
"ThirdParty/jsoncpp/json_tool.h"
"ThirdParty/jsoncpp/json_value.cpp"
"ThirdParty/jsoncpp/json_valueiterator.inl"
"ThirdParty/jsoncpp/json_writer.cpp"
)
# *************** THIRD_PARTY END ***************
set(BaseExecutionFlowNodes_SOURCE_FILES)
set(LogicalOperatorNodes_SOURCE_FILES)
set(ComparisonOperatorNodes_SOURCE_FILES)
set(ArithmeticOperatorNodes_SOURCE_FILES)
set(LiteralsNodes_SOURCE_FILES)
set(VariablesNodes_SOURCE_FILES)
set(ControlFlowNodes_SOURCE_FILES)
if(VISUAL_NODE_SYSTEM_BUILD_STANDARD_NODES)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DVISUAL_NODE_SYSTEM_BUILD_STANDARD_NODES")
# *************** STANDARD_NODES ***************
list(APPEND BaseExecutionFlowNodes_SOURCE_FILES
"StandardNodes/ExecutionFlowNodes/BaseExecutionFlowNode.h"
"StandardNodes/ExecutionFlowNodes/BaseExecutionFlowNode.cpp"
)
list(APPEND LogicalOperatorNodes_SOURCE_FILES
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Logical/BaseLogicalOperatorNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Logical/BaseLogicalOperatorNode.cpp"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Logical/LogicalANDOperatorNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Logical/LogicalANDOperatorNode.cpp"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Logical/LogicalOROperatorNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Logical/LogicalOROperatorNode.cpp"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Logical/LogicalXOROperatorNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Logical/LogicalXOROperatorNode.cpp"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Logical/LogicalNOTOperatorNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Logical/LogicalNOTOperatorNode.cpp"
)
list(APPEND ComparisonOperatorNodes_SOURCE_FILES
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Comparison/BaseComparisonOperatorNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Comparison/BaseComparisonOperatorNode.cpp"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Comparison/EqualNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Comparison/EqualNode.cpp"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Comparison/NotEqualNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Comparison/NotEqualNode.cpp"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Comparison/LessThanOrEqualNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Comparison/LessThanOrEqualNode.cpp"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Comparison/GreaterThanOrEqualNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Comparison/GreaterThanOrEqualNode.cpp"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Comparison/GreaterThanNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Comparison/GreaterThanNode.cpp"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Comparison/LessThanNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Comparison/LessThanNode.cpp"
)
list(APPEND ArithmeticOperatorNodes_SOURCE_FILES
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Arithmetic/BaseArithmeticOperatorNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Arithmetic/BaseArithmeticOperatorNode.cpp"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Arithmetic/ArithmeticAddNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Arithmetic/ArithmeticAddNode.cpp"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Arithmetic/ArithmeticSubtractNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Arithmetic/ArithmeticSubtractNode.cpp"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Arithmetic/ArithmeticMultiplyNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Arithmetic/ArithmeticMultiplyNode.cpp"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Arithmetic/ArithmeticDivideNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Arithmetic/ArithmeticDivideNode.cpp"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Arithmetic/ArithmeticModulusNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Arithmetic/ArithmeticModulusNode.cpp"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Arithmetic/ArithmeticPowerNode.h"
"StandardNodes/ExecutionFlowNodes/OperatorNodes/Arithmetic/ArithmeticPowerNode.cpp"
)
list(APPEND LiteralsNodes_SOURCE_FILES
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/BoolLiteralNode.h"
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/BoolLiteralNode.cpp"
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/IntegerLiteralNode.h"
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/IntegerLiteralNode.cpp"
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/FloatLiteralNode.h"
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/FloatLiteralNode.cpp"
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/Vec2LiteralNode.h"
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/Vec2LiteralNode.cpp"
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/BoolVec2LiteralNode.h"
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/BoolVec2LiteralNode.cpp"
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/Vec3LiteralNode.h"
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/Vec3LiteralNode.cpp"
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/BoolVec3LiteralNode.h"
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/BoolVec3LiteralNode.cpp"
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/Vec4LiteralNode.h"
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/Vec4LiteralNode.cpp"
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/BoolVec4LiteralNode.h"
"StandardNodes/ExecutionFlowNodes/LiteralsNodes/BoolVec4LiteralNode.cpp"
)
list(APPEND VariablesNodes_SOURCE_FILES
"StandardNodes/ExecutionFlowNodes/VariablesNodes/BoolVariableNode.h"
"StandardNodes/ExecutionFlowNodes/VariablesNodes/BoolVariableNode.cpp"
"StandardNodes/ExecutionFlowNodes/VariablesNodes/IntegerVariableNode.h"
"StandardNodes/ExecutionFlowNodes/VariablesNodes/IntegerVariableNode.cpp"
"StandardNodes/ExecutionFlowNodes/VariablesNodes/FloatVariableNode.h"
"StandardNodes/ExecutionFlowNodes/VariablesNodes/FloatVariableNode.cpp"
"StandardNodes/ExecutionFlowNodes/VariablesNodes/Vec2VariableNode.h"
"StandardNodes/ExecutionFlowNodes/VariablesNodes/Vec2VariableNode.cpp"
"StandardNodes/ExecutionFlowNodes/VariablesNodes/BoolVec2VariableNode.h"
"StandardNodes/ExecutionFlowNodes/VariablesNodes/BoolVec2VariableNode.cpp"
"StandardNodes/ExecutionFlowNodes/VariablesNodes/Vec3VariableNode.h"
"StandardNodes/ExecutionFlowNodes/VariablesNodes/Vec3VariableNode.cpp"
"StandardNodes/ExecutionFlowNodes/VariablesNodes/BoolVec3VariableNode.h"
"StandardNodes/ExecutionFlowNodes/VariablesNodes/BoolVec3VariableNode.cpp"
"StandardNodes/ExecutionFlowNodes/VariablesNodes/Vec4VariableNode.h"
"StandardNodes/ExecutionFlowNodes/VariablesNodes/Vec4VariableNode.cpp"
"StandardNodes/ExecutionFlowNodes/VariablesNodes/BoolVec4VariableNode.h"
"StandardNodes/ExecutionFlowNodes/VariablesNodes/BoolVec4VariableNode.cpp"
)
list(APPEND ControlFlowNodes_SOURCE_FILES
"StandardNodes/ExecutionFlowNodes/ControlFlowNodes/BranchNode.h"
"StandardNodes/ExecutionFlowNodes/ControlFlowNodes/BranchNode.cpp"
"StandardNodes/ExecutionFlowNodes/ControlFlowNodes/SequenceNode.h"
"StandardNodes/ExecutionFlowNodes/ControlFlowNodes/SequenceNode.cpp"
"StandardNodes/ExecutionFlowNodes/ControlFlowNodes/LoopNode.h"
"StandardNodes/ExecutionFlowNodes/ControlFlowNodes/LoopNode.cpp"
"StandardNodes/ExecutionFlowNodes/ControlFlowNodes/WhileLoopNode.h"
"StandardNodes/ExecutionFlowNodes/ControlFlowNodes/WhileLoopNode.cpp"
)
# *************** STANDARD_NODES END ***************
endif()
set(ALL_SOURCE_FILES "")
list(APPEND ALL_SOURCE_FILES
${VisualNodeSystem_SRC}
${VisualNodeArea_SRC}
${BaseExecutionFlowNodes_SOURCE_FILES}
${LiteralsNodes_SOURCE_FILES}
${VariablesNodes_SOURCE_FILES}
${LogicalOperatorNodes_SOURCE_FILES}
${ComparisonOperatorNodes_SOURCE_FILES}
${ArithmeticOperatorNodes_SOURCE_FILES}
${ControlFlowNodes_SOURCE_FILES}
# *************** THIRD_PARTY ***************
${jsoncpp_SRC}
)
if(VISUAL_NODE_SYSTEM_BUILD_SHARED_LIBS)
add_library(VisualNodeSystem SHARED ${ALL_SOURCE_FILES})
target_compile_definitions(VisualNodeSystem PRIVATE VISUAL_NODE_SYSTEM_EXPORTS)
target_compile_definitions(VisualNodeSystem PUBLIC VISUAL_NODE_SYSTEM_SHARED)
# Sometimes /GL conflicts with WINDOWS_EXPORT_ALL_SYMBOLS
set_target_properties(VisualNodeSystem PROPERTIES COMPILE_OPTIONS "/GL-")
set_target_properties(VisualNodeSystem PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
# Disable C4251 warning
target_compile_options(VisualNodeSystem PRIVATE /wd4251)
else()
add_library(VisualNodeSystem STATIC ${ALL_SOURCE_FILES})
endif()
source_group("Source Files" FILES ${VisualNodeSystem_SRC})
source_group("Source Files/SubSystems/VisualNodeArea/" FILES ${VisualNodeArea_SRC})
if(VISUAL_NODE_SYSTEM_BUILD_STANDARD_NODES)
source_group("Source Files/StandardNodes/ExecutionFlowNodes" FILES ${BaseExecutionFlowNodes_SOURCE_FILES})
source_group("Source Files/StandardNodes/ExecutionFlowNodes/LiteralsNodes" FILES ${LiteralsNodes_SOURCE_FILES})
source_group("Source Files/StandardNodes/ExecutionFlowNodes/VariablesNodes" FILES ${VariablesNodes_SOURCE_FILES})
source_group("Source Files/StandardNodes/ExecutionFlowNodes/OperatorNodes/Logical" FILES ${LogicalOperatorNodes_SOURCE_FILES})
source_group("Source Files/StandardNodes/ExecutionFlowNodes/OperatorNodes/Comparison" FILES ${ComparisonOperatorNodes_SOURCE_FILES})
source_group("Source Files/StandardNodes/ExecutionFlowNodes/OperatorNodes/Arithmetic" FILES ${ArithmeticOperatorNodes_SOURCE_FILES})
source_group("Source Files/StandardNodes/ExecutionFlowNodes/ControlFlowNodes" FILES ${ControlFlowNodes_SOURCE_FILES})
endif()
# *************** THIRD_PARTY ***************
source_group("Source Files/ThirdParty/jsoncpp" FILES ${jsoncpp_SRC})
set(VISUAL_NODE_SYSTEM_THIRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty)
# set the startup project
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT VisualNodeSystem)
# Prompt to give Dear ImGui path
set(DEAR_IMGUI_INCLUDE_DIR "" CACHE PATH "Path to Dear ImGui directory.")
if(VISUAL_NODE_SYSTEM_BUILD_SHARED_LIBS)
if(VISUAL_NODE_SYSTEM_USE_EXTERNAL_IMGUI)
# Use external ImGui library
set(EXTERNAL_IMGUI_LIBRARY "" CACHE FILEPATH "Path to external ImGui library")
if(NOT EXTERNAL_IMGUI_LIBRARY)
message(FATAL_ERROR "EXTERNAL_IMGUI_LIBRARY must be set when VISUAL_NODE_SYSTEM_USE_EXTERNAL_IMGUI is ON")
endif()
target_link_libraries(VisualNodeSystem PRIVATE ${EXTERNAL_IMGUI_LIBRARY})
else()
# If we are building .dll we would need GLFW information.
set(VISUAL_NODE_SYSTEM_GLFW_INCLUDE_DIR "" CACHE PATH "Path to GLFW include directory.")
target_include_directories(VisualNodeSystem PRIVATE ${VISUAL_NODE_SYSTEM_GLFW_INCLUDE_DIR})
set(VISUAL_NODE_SYSTEM_GLFW_LIBRARY "" CACHE PATH "Path to GLFW library.")
target_link_libraries(VisualNodeSystem PRIVATE ${VISUAL_NODE_SYSTEM_GLFW_LIBRARY})
# Add Dear ImGui source files
file(GLOB IMGUI_SOURCES
"${DEAR_IMGUI_INCLUDE_DIR}/*.cpp"
"${DEAR_IMGUI_INCLUDE_DIR}/*.h"
)
target_sources(VisualNodeSystem PRIVATE ${IMGUI_SOURCES})
source_group("Source Files/ThirdParty/ImGui" FILES ${IMGUI_SOURCES})
endif()
endif()
include_directories(
${DEAR_IMGUI_INCLUDE_DIR}
${VISUAL_NODE_SYSTEM_THIRDPARTY_DIR}
)
set(VISUAL_NODE_SYSTEM_THIRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty PARENT_SCOPE)
set(VISUAL_NODE_SYSTEM_DIR ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
add_custom_command(TARGET VisualNodeSystem PRE_BUILD
COMMAND ${CMAKE_COMMAND}
-D PROJECT_VERSION_PREFIX=VISUAL_NODE_SYSTEM_
-D PROJECT_VERSION_MAJOR=0
-D PROJECT_VERSION_MINOR=2
-D PROJECT_VERSION_PATCH=0
-D PROJECT_VERSION_DIR=${CMAKE_CURRENT_SOURCE_DIR}/VersionInfo
-P ${CMAKE_CURRENT_SOURCE_DIR}/VersionInfo/UpdateProjectVersion.cmake
)