-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
286 lines (236 loc) · 8.43 KB
/
CMakeLists.txt
File metadata and controls
286 lines (236 loc) · 8.43 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
cmake_minimum_required(VERSION 3.26)
# set vars
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 20)
# set exec names
set(AppExec enzoGui)
set(TestExec tests)
set(BenchExec bench)
set(CMAKE_AUTORCC ON)
# setup project
project(enzo)
set(ENZO_DEV_LIB_DIR "${CMAKE_SOURCE_DIR}/build/src/OpDefs/")
set(ENGINE_SOURCES
src/Engine/Attribute/Attribute.cpp
src/Engine/Attribute/Transform.cpp
src/Engine/Primitives/Primitive.cpp
src/Engine/Primitives/Mesh.cpp
src/Engine/Primitives/Camera.cpp
src/Engine/Selection/PrimPath.cpp
src/Engine/Network/NodePacket.cpp
src/Engine/Network/GeometryOperator.cpp
src/Engine/Network/GeometryConnection.cpp
src/Engine/Network/GeometryOpDef.cpp
src/Engine/Network/OperatorTable.cpp
src/Engine/Network/Context.cpp
src/Engine/Parameter/Template.cpp
src/Engine/Parameter/Parameter.cpp
src/Engine/Parameter/NodeParameter.cpp
src/Engine/Parameter/Default.cpp
src/Engine/Parameter/Range.cpp
src/Engine/Parameter/PrmName.cpp
src/Engine/Network/NetworkManager.cpp
src/Engine/Network/UpdateLock.cpp
src/Engine/UndoRedo/UndoStack.cpp
src/Engine/Serializer/Serializer.cpp
src/Engine/Selection/Selection.cpp
src/Engine/Selection/SelectionComponent.cpp
src/Engine/Selection/IndexSet.cpp
src/Engine/GeometryAlgorithms/MeshUtils.cpp
src/Engine/GeometryAlgorithms/MeshShapes.cpp
src/Engine/GeometryAlgorithms/BooleanUtils.cpp
src/Engine/Util/UnionFind.cpp
)
set(GUI_SOURCES
static/resources.qrc
src/Gui/main.cpp
src/Gui/Interface.cpp
src/Gui/IconRegistry.cpp
src/Gui/Icons/Builtin.cpp
src/Gui/UtilWidgets/Splitter.cpp
src/Gui/UtilWidgets/BoolSwitch.cpp
src/Gui/UtilWidgets/Slider.cpp
src/Gui/UtilWidgets/PopupList.cpp
src/Gui/UtilWidgets/Dropdown.cpp
src/Gui/GeometrySpreadsheetPanel/GeometrySpreadsheetPanel.cpp
src/Gui/GeometrySpreadsheetPanel/GeometrySpreadsheetMenuBar.cpp
src/Gui/GeometrySpreadsheetPanel/AttributeSpreadsheetModel.cpp
src/Gui/GeometrySpreadsheetPanel/PrimitiveTreeModel.cpp
src/Gui/GeometrySpreadsheetPanel/PrimitiveTreeItem.cpp
src/Gui/Viewport/Viewport.cpp
src/Gui/Viewport/ViewportGLWidget.cpp
src/Gui/Viewport/GLCamera.cpp
src/Gui/Viewport/GLMesh.cpp
src/Gui/Viewport/GLGrid.cpp
src/Gui/Viewport/GLPoints.cpp
src/Gui/Viewport/GLCameraPrim.cpp
src/Gui/Viewport/ViewportOverlay.cpp
src/Gui/Network/NetworkGraphicsView.cpp
src/Gui/Network/NetworkGraphicsScene.cpp
src/Gui/Network/NetworkPanel.cpp
src/Gui/Network/NodeGraphic.cpp
src/Gui/Network/SocketGraphic.cpp
src/Gui/Network/NodeEdgeGraphic.cpp
src/Gui/Network/FloatingEdgeGraphic.cpp
src/Gui/Network/DisplayFlagButton.cpp
src/Gui/Network/NodeIconGraphic.cpp
src/Gui/Network/TabMenu.cpp
src/Gui/ParametersPanel/ParametersPanel.cpp
src/Gui/Parameters/Parameter.cpp
src/Gui/Parameters/FloatSliderParm.cpp
src/Gui/Parameters/IntSliderParm.cpp
src/Gui/Parameters/BoolSwitchParm.cpp
src/Gui/Parameters/BoolIconParm.cpp
src/Gui/Parameters/BoolIconSlashParm.cpp
src/Gui/Parameters/BoolParm.cpp
src/Gui/Parameters/XYZParm.cpp
src/Gui/Parameters/StringParm.cpp
src/Gui/Parameters/DropdownParm.cpp
src/Gui/Parameters/GroupParm.cpp
src/Gui/HeaderBar/HeaderBar.cpp
src/Gui/Panels/Panel.cpp
src/Gui/Panels/CornerOverlay.cpp
)
set(ENGINE_INCLUDE_DIRECTORIES
src
extern/icecream-cpp/include
extern/cereal/include
)
# qt
find_package(Qt6 REQUIRED COMPONENTS Core Widgets SvgWidgets OpenGLWidgets)
qt_standard_project_setup()
ADD_DEFINITIONS(-DQT_NO_KEYWORDS)
# glm
find_package(glm REQUIRED)
# eigen (math)
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
# tbb
find_package(TBB REQUIRED COMPONENTS tbb)
find_package(Boost REQUIRED COMPONENTS filesystem system)
# cgal
find_package(CGAL REQUIRED COMPONENTS Core)
# manifold (boolean ops)
find_package(manifold CONFIG REQUIRED)
qt_add_executable(${AppExec}
${GUI_SOURCES}
${ENGINE_SOURCES}
)
target_compile_definitions(${AppExec} PRIVATE ENZO_DEV_LIB_DIR="${ENZO_DEV_LIB_DIR}")
target_compile_definitions(${AppExec} PRIVATE ENZO_DEV_ICONS_DIR="${CMAKE_SOURCE_DIR}/static/icons")
# TODO: turn this on when you're ready to handle incomplete enums
# target_compile_options(${AppExec} PRIVATE -Werror=switch)
# --- packaging ---
set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_SOURCE_DIR}/cmake/CPackProjectConfig.cmake)
set(CPACK_GENERATOR "RPM;TGZ")
set(ENZO_BIN_DIR ${CMAKE_PROJECT_NAME}/bin CACHE STRING "Binary install directory")
set(ENZO_LIB_DIR ${CMAKE_PROJECT_NAME}/lib CACHE STRING "Library install directory")
set_target_properties(${AppExec} PROPERTIES
INSTALL_RPATH "$ORIGIN/../lib;$ORIGIN/../../lib"
)
include(CPack)
# cpack_add_component("runtimes")
# cpack_add_component("tgz-runtimes")
install(TARGETS ${AppExec}
RUNTIME DESTINATION ${ENZO_BIN_DIR}
LIBRARY DESTINATION ${ENZO_LIB_DIR}
ARCHIVE DESTINATION ${ENZO_LIB_DIR}
# COMPONENT "runtimes"
)
# desktop integration (Flatpak / Linux desktop)
install(FILES flatpak/org.enzosoftware.Enzo.desktop
DESTINATION share/applications
)
install(FILES flatpak/org.enzosoftware.Enzo.metainfo.xml
DESTINATION share/metainfo
)
install(FILES static/icons/icon-main-white-square.svg
DESTINATION share/icons/hicolor/scalable/apps
RENAME org.enzosoftware.Enzo.svg
)
install(DIRECTORY static/icons/
DESTINATION ${CMAKE_PROJECT_NAME}/share/icons
FILES_MATCHING PATTERN "*.svg"
)
# install(TARGETS ${AppExec}
# RUNTIME_DEPENDENCY_SET app_deps
# RUNTIME DESTINATION ${ENZO_BIN_DIR}
# LIBRARY DESTINATION ${ENZO_LIB_DIR}
# ARCHIVE DESTINATION ${ENZO_LIB_DIR}
# COMPONENT "tgz-runtimes"
# )
# install(RUNTIME_DEPENDENCY_SET app_deps
# DIRECTORIES "${CMAKE_BINARY_DIR}"
# PRE_EXCLUDE_REGEXES
# "libc.so.*" "libm.so.*" "libpthread.so.*" "librt.so.*" "libdl.so.*"
# "libgcc_s.so.*" "libstdc++.so.*"
# DESTINATION ${ENZO_LIB_DIR}
# COMPONENT "tgz-runtimes"
# )
# install(
# DIRECTORY /usr/lib64/qt6
# DESTINATION ${CMAKE_PROJECT_NAME}
# COMPONENT "tgz-runtimes"
# )
# install(
# DIRECTORY /usr/lib64/
# DESTINATION ${ENZO_LIB_DIR}
# COMPONENT "tgz-runtimes"
# FILES_MATCHING PATTERN "*Qt*.so*"
# )
# file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/packaging/qt.conf
# "[Paths]
# Plugins = ../qt6/plugins
# Libraries = ../lib
# ")
# install(
# FILES ${CMAKE_CURRENT_BINARY_DIR}/packaging/qt.conf
# DESTINATION ${ENZO_BIN_DIR}
# COMPONENT "tgz-runtimes"
# )
# set(CPACK_RPM_PACKAGE_REQUIRES "openssl >= 1.1.1, zlib >= 1.2.11")
# --- end packaging
target_link_libraries(${AppExec} PRIVATE Qt6::Core Qt6::Widgets Qt6::SvgWidgets Qt6::OpenGLWidgets glm::glm Eigen3::Eigen TBB::tbb Boost::filesystem Boost::system CGAL::CGAL CGAL::CGAL_Core manifold::manifold)
target_include_directories(${AppExec} PUBLIC
${ENGINE_INCLUDE_DIRECTORIES}
)
# compile nodes
add_subdirectory(src/OpDefs)
# tests
option(ENZO_BUILD_TESTS "Build tests and benchmarks" ON)
if(ENZO_BUILD_TESTS)
Include(FetchContent)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.8.1 # or a later release
)
FetchContent_MakeAvailable(Catch2)
add_executable(${TestExec}
${ENGINE_SOURCES}
tests/main-tests.cpp
tests/ParameterTests.cpp
tests/OperatorTests.cpp
tests/NetworkTests.cpp
tests/SelectionTests.cpp
tests/MeshTests.cpp
tests/BooleanUtilsTests.cpp
)
target_link_libraries(${TestExec} PRIVATE Catch2::Catch2WithMain Eigen3::Eigen Qt6::Core TBB::tbb Boost::filesystem Boost::system CGAL::CGAL CGAL::CGAL_Core manifold::manifold)
target_compile_definitions(${TestExec} PRIVATE UNIT_TEST)
target_include_directories(${TestExec} PUBLIC
${ENGINE_INCLUDE_DIRECTORIES}
${BOOST_INCLUDE_DIRS}
)
target_compile_definitions(${TestExec} PRIVATE ENZO_DEV_LIB_DIR="${ENZO_DEV_LIB_DIR}")
# benchmarks
add_executable(${BenchExec}
${ENGINE_SOURCES}
tests/Benchmarks.cpp
)
target_link_libraries(${BenchExec} PRIVATE Catch2::Catch2WithMain Eigen3::Eigen Qt6::Core TBB::tbb Boost::filesystem Boost::system CGAL::CGAL CGAL::CGAL_Core manifold::manifold)
target_compile_definitions(${BenchExec} PRIVATE UNIT_TEST)
target_include_directories(${BenchExec} PUBLIC
${ENGINE_INCLUDE_DIRECTORIES}
)
target_compile_definitions(${BenchExec} PRIVATE ENZO_DEV_LIB_DIR="${ENZO_DEV_LIB_DIR}")
endif()