forked from Ultimaker/CuraEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
294 lines (262 loc) · 9.48 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
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
# Copyright (c) 2022 Ultimaker B.V.
# CuraEngine is released under the terms of the AGPLv3 or higher.
cmake_policy(SET CMP0091 NEW) # For MSVC flags, will be ignored on non-Windows OS's
cmake_minimum_required(VERSION 3.20)
project(CuraEngine)
find_package(standardprojectsettings REQUIRED) # imports the cmake module https://github.com/Ultimaker/conan-ultimaker-index/recipes/standardprojectsettings
AssureOutOfSourceBuilds()
option(ENABLE_ARCUS "Enable support for ARCUS" ON)
option(ENABLE_TESTING "Build with unit tests" OFF)
option(ENABLE_BENCHMARKS "Build with Benchmarks" OFF)
option(EXTENSIVE_WARNINGS "Build with all warnings" ON)
option(ENABLE_PLUGINS "Build with plugins" ON)
option(ENABLE_REMOTE_PLUGINS "Build with all warnings" OFF)
option(ENABLE_SENTRY "Send crash data via Sentry" OFF)
option(ENABLE_MORE_COMPILER_OPTIMIZATION_FLAGS "Enable more optimization flags" ON)
option(USE_SYSTEM_LIBS "Use the system libraries if available" OFF)
option(OLDER_APPLE_CLANG "Apple Clang <= 13 used" OFF)
# Generate the plugin types
find_package(protobuf REQUIRED)
find_package(asio-grpc REQUIRED)
find_package(gRPC REQUIRED)
find_package(curaengine_grpc_definitions REQUIRED)
option(OLDER_APPLE_CLANG "Apple Clang <= 13 used" OFF)
MESSAGE(STATUS "Compiling with plugins support: ${ENABLE_PLUGINS}")
if (${ENABLE_PLUGINS})
MESSAGE(STATUS "Plugin secure remotes allowed: ${ENABLE_REMOTE_PLUGINS}")
endif ()
if (ENABLE_ARCUS)
message(STATUS "Building with Arcus")
find_package(arcus REQUIRED)
protobuf_generate_cpp(engine_PB_SRCS engine_PB_HEADERS Cura.proto)
endif ()
### Compiling CuraEngine ###
# First compile all of CuraEngine as library.
set(engine_SRCS # Except main.cpp.
src/Application.cpp
src/bridge.cpp
src/ConicalOverhang.cpp
src/ExtruderPlan.cpp
src/ExtruderTrain.cpp
src/FffGcodeWriter.cpp
src/FffPolygonGenerator.cpp
src/FffProcessor.cpp
src/gcodeExport.cpp
src/GCodePathConfig.cpp
src/infill.cpp
src/InterlockingGenerator.cpp
src/InsetOrderOptimizer.cpp
src/layerPart.cpp
src/LayerPlan.cpp
src/LayerPlanBuffer.cpp
src/mesh.cpp
src/MeshGroup.cpp
src/Mold.cpp
src/multiVolumes.cpp
src/PathOrderPath.cpp
src/Preheat.cpp
src/PrimeTower.cpp
src/raft.cpp
src/Scene.cpp
src/SkeletalTrapezoidation.cpp
src/SkeletalTrapezoidationGraph.cpp
src/skin.cpp
src/SkirtBrim.cpp
src/SupportInfillPart.cpp
src/Slice.cpp
src/sliceDataStorage.cpp
src/slicer.cpp
src/support.cpp
src/timeEstimate.cpp
src/TopSurface.cpp
src/TreeSupportTipGenerator.cpp
src/TreeModelVolumes.cpp
src/TreeSupport.cpp
src/WallsComputation.cpp
src/WallToolPaths.cpp
src/BeadingStrategy/BeadingStrategy.cpp
src/BeadingStrategy/BeadingStrategyFactory.cpp
src/BeadingStrategy/DistributedBeadingStrategy.cpp
src/BeadingStrategy/LimitedBeadingStrategy.cpp
src/BeadingStrategy/RedistributeBeadingStrategy.cpp
src/BeadingStrategy/WideningBeadingStrategy.cpp
src/BeadingStrategy/OuterWallInsetBeadingStrategy.cpp
src/communication/ArcusCommunication.cpp
src/communication/ArcusCommunicationPrivate.cpp
src/communication/CommandLine.cpp
src/communication/Listener.cpp
src/infill/ImageBasedDensityProvider.cpp
src/infill/NoZigZagConnectorProcessor.cpp
src/infill/ZigzagConnectorProcessor.cpp
src/infill/LightningDistanceField.cpp
src/infill/LightningGenerator.cpp
src/infill/LightningLayer.cpp
src/infill/LightningTreeNode.cpp
src/infill/SierpinskiFill.cpp
src/infill/SierpinskiFillProvider.cpp
src/infill/SubDivCube.cpp
src/infill/GyroidInfill.cpp
src/pathPlanning/Comb.cpp
src/pathPlanning/GCodePath.cpp
src/pathPlanning/LinePolygonsCrossings.cpp
src/pathPlanning/NozzleTempInsert.cpp
src/pathPlanning/SpeedDerivatives.cpp
src/plugins/converters.cpp
src/progress/Progress.cpp
src/progress/ProgressStageEstimator.cpp
src/settings/AdaptiveLayerHeights.cpp
src/settings/FlowTempGraph.cpp
src/settings/MeshPathConfigs.cpp
src/settings/PathConfigStorage.cpp
src/settings/Settings.cpp
src/settings/ZSeamConfig.cpp
src/utils/AABB.cpp
src/utils/AABB3D.cpp
src/utils/channel.cpp
src/utils/Date.cpp
src/utils/ExtrusionJunction.cpp
src/utils/ExtrusionLine.cpp
src/utils/ExtrusionSegment.cpp
src/utils/gettime.cpp
src/utils/LinearAlg2D.cpp
src/utils/ListPolyIt.cpp
src/utils/Matrix4x3D.cpp
src/utils/MinimumSpanningTree.cpp
src/utils/Point3LL.cpp
src/utils/PolygonConnector.cpp
src/utils/PolygonsPointIndex.cpp
src/utils/PolygonsSegmentIndex.cpp
src/utils/polygonUtils.cpp
src/utils/polygon.cpp
src/utils/PolylineStitcher.cpp
src/utils/Simplify.cpp
src/utils/SVG.cpp
src/utils/SquareGrid.cpp
src/utils/ThreadPool.cpp
src/utils/ToolpathVisualizer.cpp
src/utils/VoronoiUtils.cpp
src/utils/VoxelUtils.cpp
)
add_library(_CuraEngine STATIC ${engine_SRCS} ${engine_PB_SRCS})
use_threads(_CuraEngine)
target_include_directories(_CuraEngine
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> # Include Cura.pb.h
)
target_compile_definitions(_CuraEngine
PUBLIC
$<$<BOOL:${ENABLE_ARCUS}>:ARCUS>
$<$<BOOL:${ENABLE_PLUGINS}>:ENABLE_PLUGINS>
$<$<AND:$<BOOL:${ENABLE_PLUGINS}>,$<BOOL:${ENABLE_REMOTE_PLUGINS}>>:ENABLE_REMOTE_PLUGINS>
$<$<BOOL:${OLDER_APPLE_CLANG}>:OLDER_APPLE_CLANG>
CURA_ENGINE_VERSION=\"${CURA_ENGINE_VERSION}\"
$<$<BOOL:${ENABLE_TESTING}>:BUILD_TESTS>
PRIVATE
$<$<BOOL:${WIN32}>:NOMINMAX>
$<$<CONFIG:Debug>:ASSERT_INSANE_OUTPUT>
$<$<CONFIG:Debug>:USE_CPU_TIME>
$<$<CONFIG:Debug>:DEBUG>
$<$<CONFIG:RelWithDebInfo>:ASSERT_INSANE_OUTPUT>
$<$<CONFIG:RelWithDebInfo>:USE_CPU_TIME>
$<$<CONFIG:RelWithDebInfo>:DEBUG>
)
enable_sanitizers(_CuraEngine)
if (${EXTENSIVE_WARNINGS})
set_project_warnings(_CuraEngine)
endif ()
if (ENABLE_ARCUS)
target_link_libraries(_CuraEngine PUBLIC arcus::arcus )
endif ()
find_package(clipper REQUIRED)
find_package(RapidJSON REQUIRED)
find_package(stb REQUIRED)
find_package(Boost REQUIRED)
find_package(spdlog REQUIRED)
find_package(fmt REQUIRED)
find_package(range-v3 REQUIRED)
find_package(scripta REQUIRED)
find_package(semver REQUIRED)
if (ENABLE_SENTRY)
find_package(sentry REQUIRED)
endif ()
if (ENABLE_TESTING)
find_package(GTest REQUIRED)
endif ()
target_link_libraries(_CuraEngine
PUBLIC
spdlog::spdlog
range-v3::range-v3
fmt::fmt
clipper::clipper
rapidjson
stb::stb
boost::boost
scripta::scripta
semver::semver
curaengine_grpc_definitions::curaengine_grpc_definitions
asio-grpc::asio-grpc
grpc::grpc
protobuf::libprotobuf
$<$<BOOL:${ENABLE_TESTING}>:GTest::gtest>)
if (NOT WIN32)
add_executable(CuraEngine src/main.cpp) # Then compile main.cpp as separate executable, and link the library to it.
else ()
message(STATUS "Using windres")
set(RES_FILES "CuraEngine.rc")
ENABLE_LANGUAGE(RC)
if (NOT MSVC)
SET(CMAKE_RC_COMPILER_INIT windres)
SET(CMAKE_RC_COMPILE_OBJECT
"<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>"
)
endif ()
add_executable(CuraEngine src/main.cpp ${RES_FILES}) # ..., but don't forget the glitter!
endif (NOT WIN32)
use_threads(CuraEngine)
target_link_libraries(CuraEngine PRIVATE
_CuraEngine
$<$<BOOL:${ENABLE_SENTRY}>:sentry::sentry>
)
target_compile_definitions(CuraEngine PRIVATE
$<$<BOOL:${ENABLE_SENTRY}>:SENTRY_URL=\"${SENTRY_URL}\">
VERSION=\"${CURA_ENGINE_VERSION}\"
)
# Compiling the test environment.
if (ENABLE_TESTING OR ENABLE_BENCHMARKS)
set(TESTS_HELPERS_SRC tests/ReadTestPolygons.cpp)
set(TESTS_SRC_ARCUS)
if (ENABLE_ARCUS)
list(APPEND TESTS_SRC_ARCUS
ArcusCommunicationTest
ArcusCommunicationPrivateTest)
list(APPEND TESTS_HELPERS_SRC tests/arcus/MockSocket.cpp)
endif ()
add_library(test_helpers ${TESTS_HELPERS_SRC})
target_compile_definitions(test_helpers PUBLIC $<$<BOOL:${BUILD_TESTING}>:BUILD_TESTS> $<$<BOOL:${ENABLE_ARCUS}>:ARCUS>)
target_include_directories(test_helpers PUBLIC "include" ${CMAKE_BINARY_DIR}/generated)
target_link_libraries(test_helpers PRIVATE
_CuraEngine
GTest::gtest
GTest::gmock
clipper::clipper
curaengine_grpc_definitions::curaengine_grpc_definitions
asio-grpc::asio-grpc
grpc::grpc
protobuf::libprotobuf)
if (ENABLE_ARCUS)
target_link_libraries(test_helpers PUBLIC arcus::arcus)
endif ()
endif ()
if (ENABLE_BENCHMARKS)
add_subdirectory(benchmark)
if (NOT WIN32)
add_subdirectory(stress_benchmark)
endif()
endif ()
if (ENABLE_TESTING)
enable_testing()
add_subdirectory(tests)
endif ()