CMakeLists.txt 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. # Enable C++11 language standard.
  2. set(CMAKE_CXX_STANDARD 11)
  3. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  4. # Add our own cmake module path.
  5. list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/)
  6. if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
  7. # Workaround for an old CMake, which does not understand CMAKE_CXX_STANDARD.
  8. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall" )
  9. find_package(PkgConfig REQUIRED)
  10. endif()
  11. if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX)
  12. # Adding -fext-numeric-literals to enable GCC extensions on definitions of quad float literals, which are required by Boost.
  13. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals" )
  14. endif()
  15. # Where all the bundled libraries reside?
  16. set(LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/src/)
  17. # For the bundled boost libraries (boost::nowide)
  18. include_directories(${LIBDIR})
  19. # For libslic3r.h
  20. include_directories(${LIBDIR}/libslic3r)
  21. #set(CMAKE_INCLUDE_CURRENT_DIR ON)
  22. if(WIN32)
  23. # BOOST_ALL_NO_LIB: Avoid the automatic linking of Boost libraries on Windows. Rather rely on explicit linking.
  24. add_definitions(-D_USE_MATH_DEFINES -D_WIN32 -DBOOST_ALL_NO_LIB)
  25. # -D_ITERATOR_DEBUG_LEVEL)
  26. if(WIN10SDK_PATH)
  27. message("Building with Win10 Netfabb STL fixing service support")
  28. add_definitions(-DHAS_WIN10SDK)
  29. include_directories("${WIN10SDK_PATH}/Include")
  30. else()
  31. message("Building without Win10 Netfabb STL fixing service support")
  32. endif()
  33. endif()
  34. add_definitions(-DwxUSE_UNICODE -D_UNICODE -DUNICODE -DWXINTL_NO_GETTEXT_MACRO)
  35. add_library(libslic3r STATIC
  36. ${LIBDIR}/libslic3r/BoundingBox.cpp
  37. ${LIBDIR}/libslic3r/BoundingBox.hpp
  38. ${LIBDIR}/libslic3r/BridgeDetector.cpp
  39. ${LIBDIR}/libslic3r/BridgeDetector.hpp
  40. ${LIBDIR}/libslic3r/ClipperUtils.cpp
  41. ${LIBDIR}/libslic3r/ClipperUtils.hpp
  42. ${LIBDIR}/libslic3r/Config.cpp
  43. ${LIBDIR}/libslic3r/Config.hpp
  44. ${LIBDIR}/libslic3r/EdgeGrid.cpp
  45. ${LIBDIR}/libslic3r/EdgeGrid.hpp
  46. ${LIBDIR}/libslic3r/ExPolygon.cpp
  47. ${LIBDIR}/libslic3r/ExPolygon.hpp
  48. ${LIBDIR}/libslic3r/ExPolygonCollection.cpp
  49. ${LIBDIR}/libslic3r/ExPolygonCollection.hpp
  50. ${LIBDIR}/libslic3r/Extruder.cpp
  51. ${LIBDIR}/libslic3r/Extruder.hpp
  52. ${LIBDIR}/libslic3r/ExtrusionEntity.cpp
  53. ${LIBDIR}/libslic3r/ExtrusionEntity.hpp
  54. ${LIBDIR}/libslic3r/ExtrusionEntityCollection.cpp
  55. ${LIBDIR}/libslic3r/ExtrusionEntityCollection.hpp
  56. ${LIBDIR}/libslic3r/ExtrusionSimulator.cpp
  57. ${LIBDIR}/libslic3r/ExtrusionSimulator.hpp
  58. ${LIBDIR}/libslic3r/FileParserError.hpp
  59. ${LIBDIR}/libslic3r/Fill/Fill.cpp
  60. ${LIBDIR}/libslic3r/Fill/Fill.hpp
  61. ${LIBDIR}/libslic3r/Fill/Fill3DHoneycomb.cpp
  62. ${LIBDIR}/libslic3r/Fill/Fill3DHoneycomb.hpp
  63. ${LIBDIR}/libslic3r/Fill/FillBase.cpp
  64. ${LIBDIR}/libslic3r/Fill/FillBase.hpp
  65. ${LIBDIR}/libslic3r/Fill/FillConcentric.cpp
  66. ${LIBDIR}/libslic3r/Fill/FillConcentric.hpp
  67. ${LIBDIR}/libslic3r/Fill/FillHoneycomb.cpp
  68. ${LIBDIR}/libslic3r/Fill/FillHoneycomb.hpp
  69. ${LIBDIR}/libslic3r/Fill/FillGyroid.cpp
  70. ${LIBDIR}/libslic3r/Fill/FillGyroid.hpp
  71. ${LIBDIR}/libslic3r/Fill/FillPlanePath.cpp
  72. ${LIBDIR}/libslic3r/Fill/FillPlanePath.hpp
  73. ${LIBDIR}/libslic3r/Fill/FillRectilinear.cpp
  74. ${LIBDIR}/libslic3r/Fill/FillRectilinear.hpp
  75. ${LIBDIR}/libslic3r/Fill/FillRectilinear2.cpp
  76. ${LIBDIR}/libslic3r/Fill/FillRectilinear2.hpp
  77. ${LIBDIR}/libslic3r/Fill/FillRectilinear3.cpp
  78. ${LIBDIR}/libslic3r/Fill/FillRectilinear3.hpp
  79. ${LIBDIR}/libslic3r/Fill/FillSmooth.cpp
  80. ${LIBDIR}/libslic3r/Fill/FillSmooth.hpp
  81. ${LIBDIR}/libslic3r/Flow.cpp
  82. ${LIBDIR}/libslic3r/Flow.hpp
  83. ${LIBDIR}/libslic3r/Format/3mf.cpp
  84. ${LIBDIR}/libslic3r/Format/3mf.hpp
  85. ${LIBDIR}/libslic3r/Format/AMF.cpp
  86. ${LIBDIR}/libslic3r/Format/AMF.hpp
  87. ${LIBDIR}/libslic3r/Format/OBJ.cpp
  88. ${LIBDIR}/libslic3r/Format/OBJ.hpp
  89. ${LIBDIR}/libslic3r/Format/objparser.cpp
  90. ${LIBDIR}/libslic3r/Format/objparser.hpp
  91. ${LIBDIR}/libslic3r/Format/PRUS.cpp
  92. ${LIBDIR}/libslic3r/Format/PRUS.hpp
  93. ${LIBDIR}/libslic3r/Format/STL.cpp
  94. ${LIBDIR}/libslic3r/Format/STL.hpp
  95. ${LIBDIR}/libslic3r/GCode/Analyzer.cpp
  96. ${LIBDIR}/libslic3r/GCode/Analyzer.hpp
  97. ${LIBDIR}/libslic3r/GCode/CoolingBuffer.cpp
  98. ${LIBDIR}/libslic3r/GCode/CoolingBuffer.hpp
  99. ${LIBDIR}/libslic3r/GCode/PressureEqualizer.cpp
  100. ${LIBDIR}/libslic3r/GCode/PressureEqualizer.hpp
  101. ${LIBDIR}/libslic3r/GCode/PreviewData.cpp
  102. ${LIBDIR}/libslic3r/GCode/PreviewData.hpp
  103. ${LIBDIR}/libslic3r/GCode/PrintExtents.cpp
  104. ${LIBDIR}/libslic3r/GCode/PrintExtents.hpp
  105. ${LIBDIR}/libslic3r/GCode/SpiralVase.cpp
  106. ${LIBDIR}/libslic3r/GCode/SpiralVase.hpp
  107. ${LIBDIR}/libslic3r/GCode/ToolOrdering.cpp
  108. ${LIBDIR}/libslic3r/GCode/ToolOrdering.hpp
  109. ${LIBDIR}/libslic3r/GCode/WipeTower.hpp
  110. ${LIBDIR}/libslic3r/GCode/WipeTowerPrusaMM.cpp
  111. ${LIBDIR}/libslic3r/GCode/WipeTowerPrusaMM.hpp
  112. ${LIBDIR}/libslic3r/GCode.cpp
  113. ${LIBDIR}/libslic3r/GCode.hpp
  114. ${LIBDIR}/libslic3r/GCodeReader.cpp
  115. ${LIBDIR}/libslic3r/GCodeReader.hpp
  116. ${LIBDIR}/libslic3r/GCodeSender.cpp
  117. ${LIBDIR}/libslic3r/GCodeSender.hpp
  118. ${LIBDIR}/libslic3r/GCodeTimeEstimator.cpp
  119. ${LIBDIR}/libslic3r/GCodeTimeEstimator.hpp
  120. ${LIBDIR}/libslic3r/GCodeWriter.cpp
  121. ${LIBDIR}/libslic3r/GCodeWriter.hpp
  122. ${LIBDIR}/libslic3r/Geometry.cpp
  123. ${LIBDIR}/libslic3r/Geometry.hpp
  124. ${LIBDIR}/libslic3r/Int128.hpp
  125. # ${LIBDIR}/libslic3r/KdTree.hpp
  126. ${LIBDIR}/libslic3r/Layer.cpp
  127. ${LIBDIR}/libslic3r/Layer.hpp
  128. ${LIBDIR}/libslic3r/LayerRegion.cpp
  129. ${LIBDIR}/libslic3r/libslic3r.h
  130. ${LIBDIR}/libslic3r/Line.cpp
  131. ${LIBDIR}/libslic3r/Line.hpp
  132. ${LIBDIR}/libslic3r/Model.cpp
  133. ${LIBDIR}/libslic3r/Model.hpp
  134. ${LIBDIR}/libslic3r/MotionPlanner.cpp
  135. ${LIBDIR}/libslic3r/MotionPlanner.hpp
  136. ${LIBDIR}/libslic3r/MultiPoint.cpp
  137. ${LIBDIR}/libslic3r/MultiPoint.hpp
  138. ${LIBDIR}/libslic3r/MutablePriorityQueue.hpp
  139. ${LIBDIR}/libslic3r/PerimeterGenerator.cpp
  140. ${LIBDIR}/libslic3r/PerimeterGenerator.hpp
  141. ${LIBDIR}/libslic3r/PlaceholderParser.cpp
  142. ${LIBDIR}/libslic3r/PlaceholderParser.hpp
  143. ${LIBDIR}/libslic3r/Point.cpp
  144. ${LIBDIR}/libslic3r/Point.hpp
  145. ${LIBDIR}/libslic3r/Polygon.cpp
  146. ${LIBDIR}/libslic3r/Polygon.hpp
  147. ${LIBDIR}/libslic3r/Polyline.cpp
  148. ${LIBDIR}/libslic3r/Polyline.hpp
  149. ${LIBDIR}/libslic3r/PolylineCollection.cpp
  150. ${LIBDIR}/libslic3r/PolylineCollection.hpp
  151. ${LIBDIR}/libslic3r/Print.cpp
  152. ${LIBDIR}/libslic3r/Print.hpp
  153. ${LIBDIR}/libslic3r/PrintConfig.cpp
  154. ${LIBDIR}/libslic3r/PrintConfig.hpp
  155. ${LIBDIR}/libslic3r/PrintObject.cpp
  156. ${LIBDIR}/libslic3r/PrintRegion.cpp
  157. ${LIBDIR}/libslic3r/Slicing.cpp
  158. ${LIBDIR}/libslic3r/Slicing.hpp
  159. ${LIBDIR}/libslic3r/SlicingAdaptive.cpp
  160. ${LIBDIR}/libslic3r/SlicingAdaptive.hpp
  161. ${LIBDIR}/libslic3r/SupportMaterial.cpp
  162. ${LIBDIR}/libslic3r/SupportMaterial.hpp
  163. ${LIBDIR}/libslic3r/Surface.cpp
  164. ${LIBDIR}/libslic3r/Surface.hpp
  165. ${LIBDIR}/libslic3r/SurfaceCollection.cpp
  166. ${LIBDIR}/libslic3r/SurfaceCollection.hpp
  167. ${LIBDIR}/libslic3r/SVG.cpp
  168. ${LIBDIR}/libslic3r/SVG.hpp
  169. ${LIBDIR}/libslic3r/TriangleMesh.cpp
  170. ${LIBDIR}/libslic3r/TriangleMesh.hpp
  171. # ${LIBDIR}/libslic3r/utils.cpp
  172. ${LIBDIR}/libslic3r/Utils.hpp
  173. )
  174. add_library(libslic3r_gui STATIC
  175. ${LIBDIR}/slic3r/GUI/AboutDialog.cpp
  176. ${LIBDIR}/slic3r/GUI/AboutDialog.hpp
  177. ${LIBDIR}/slic3r/GUI/AppConfig.cpp
  178. ${LIBDIR}/slic3r/GUI/AppConfig.hpp
  179. ${LIBDIR}/slic3r/GUI/BitmapCache.cpp
  180. ${LIBDIR}/slic3r/GUI/BitmapCache.hpp
  181. ${LIBDIR}/slic3r/GUI/ConfigSnapshotDialog.cpp
  182. ${LIBDIR}/slic3r/GUI/ConfigSnapshotDialog.hpp
  183. ${LIBDIR}/slic3r/GUI/3DScene.cpp
  184. ${LIBDIR}/slic3r/GUI/3DScene.hpp
  185. ${LIBDIR}/slic3r/GUI/GLShader.cpp
  186. ${LIBDIR}/slic3r/GUI/GLShader.hpp
  187. ${LIBDIR}/slic3r/GUI/GLCanvas3D.hpp
  188. ${LIBDIR}/slic3r/GUI/GLCanvas3D.cpp
  189. ${LIBDIR}/slic3r/GUI/GLCanvas3DManager.hpp
  190. ${LIBDIR}/slic3r/GUI/GLCanvas3DManager.cpp
  191. ${LIBDIR}/slic3r/GUI/GLGizmo.hpp
  192. ${LIBDIR}/slic3r/GUI/GLGizmo.cpp
  193. ${LIBDIR}/slic3r/GUI/GLTexture.hpp
  194. ${LIBDIR}/slic3r/GUI/GLTexture.cpp
  195. ${LIBDIR}/slic3r/GUI/Preferences.cpp
  196. ${LIBDIR}/slic3r/GUI/Preferences.hpp
  197. ${LIBDIR}/slic3r/GUI/Preset.cpp
  198. ${LIBDIR}/slic3r/GUI/Preset.hpp
  199. ${LIBDIR}/slic3r/GUI/PresetBundle.cpp
  200. ${LIBDIR}/slic3r/GUI/PresetBundle.hpp
  201. ${LIBDIR}/slic3r/GUI/PresetHints.cpp
  202. ${LIBDIR}/slic3r/GUI/PresetHints.hpp
  203. ${LIBDIR}/slic3r/GUI/GUI.cpp
  204. ${LIBDIR}/slic3r/GUI/GUI.hpp
  205. ${LIBDIR}/slic3r/GUI/Tab.cpp
  206. ${LIBDIR}/slic3r/GUI/Tab.hpp
  207. ${LIBDIR}/slic3r/GUI/TabIface.cpp
  208. ${LIBDIR}/slic3r/GUI/TabIface.hpp
  209. ${LIBDIR}/slic3r/GUI/Field.cpp
  210. ${LIBDIR}/slic3r/GUI/Field.hpp
  211. ${LIBDIR}/slic3r/GUI/OptionsGroup.cpp
  212. ${LIBDIR}/slic3r/GUI/OptionsGroup.hpp
  213. ${LIBDIR}/slic3r/GUI/BedShapeDialog.cpp
  214. ${LIBDIR}/slic3r/GUI/BedShapeDialog.hpp
  215. ${LIBDIR}/slic3r/GUI/2DBed.cpp
  216. ${LIBDIR}/slic3r/GUI/2DBed.hpp
  217. ${LIBDIR}/slic3r/GUI/wxExtensions.cpp
  218. ${LIBDIR}/slic3r/GUI/wxExtensions.hpp
  219. ${LIBDIR}/slic3r/GUI/WipeTowerDialog.cpp
  220. ${LIBDIR}/slic3r/GUI/WipeTowerDialog.hpp
  221. ${LIBDIR}/slic3r/GUI/RammingChart.cpp
  222. ${LIBDIR}/slic3r/GUI/RammingChart.hpp
  223. ${LIBDIR}/slic3r/GUI/BonjourDialog.cpp
  224. ${LIBDIR}/slic3r/GUI/BonjourDialog.hpp
  225. ${LIBDIR}/slic3r/GUI/ButtonsDescription.cpp
  226. ${LIBDIR}/slic3r/GUI/ButtonsDescription.hpp
  227. ${LIBDIR}/slic3r/Config/Snapshot.cpp
  228. ${LIBDIR}/slic3r/Config/Snapshot.hpp
  229. ${LIBDIR}/slic3r/Config/Version.cpp
  230. ${LIBDIR}/slic3r/Config/Version.hpp
  231. ${LIBDIR}/slic3r/Utils/ASCIIFolding.cpp
  232. ${LIBDIR}/slic3r/Utils/ASCIIFolding.hpp
  233. ${LIBDIR}/slic3r/Utils/Serial.cpp
  234. ${LIBDIR}/slic3r/Utils/Serial.hpp
  235. ${LIBDIR}/slic3r/GUI/ConfigWizard.cpp
  236. ${LIBDIR}/slic3r/GUI/ConfigWizard.hpp
  237. ${LIBDIR}/slic3r/GUI/MsgDialog.cpp
  238. ${LIBDIR}/slic3r/GUI/MsgDialog.hpp
  239. ${LIBDIR}/slic3r/GUI/UpdateDialogs.cpp
  240. ${LIBDIR}/slic3r/GUI/UpdateDialogs.hpp
  241. ${LIBDIR}/slic3r/GUI/FirmwareDialog.cpp
  242. ${LIBDIR}/slic3r/GUI/FirmwareDialog.hpp
  243. ${LIBDIR}/slic3r/Utils/Http.cpp
  244. ${LIBDIR}/slic3r/Utils/Http.hpp
  245. ${LIBDIR}/slic3r/Utils/FixModelByWin10.cpp
  246. ${LIBDIR}/slic3r/Utils/FixModelByWin10.hpp
  247. ${LIBDIR}/slic3r/Utils/OctoPrint.cpp
  248. ${LIBDIR}/slic3r/Utils/OctoPrint.hpp
  249. ${LIBDIR}/slic3r/Utils/Bonjour.cpp
  250. ${LIBDIR}/slic3r/Utils/Bonjour.hpp
  251. ${LIBDIR}/slic3r/Utils/PresetUpdater.cpp
  252. ${LIBDIR}/slic3r/Utils/PresetUpdater.hpp
  253. ${LIBDIR}/slic3r/Utils/Time.cpp
  254. ${LIBDIR}/slic3r/Utils/Time.hpp
  255. ${LIBDIR}/slic3r/IProgressIndicator.hpp
  256. ${LIBDIR}/slic3r/AppController.hpp
  257. ${LIBDIR}/slic3r/AppController.cpp
  258. ${LIBDIR}/slic3r/AppControllerWx.cpp
  259. ${LIBDIR}/slic3r/Strings.hpp
  260. )
  261. add_library(admesh STATIC
  262. ${LIBDIR}/admesh/connect.cpp
  263. ${LIBDIR}/admesh/normals.cpp
  264. ${LIBDIR}/admesh/shared.cpp
  265. ${LIBDIR}/admesh/stl.h
  266. ${LIBDIR}/admesh/stl_io.cpp
  267. ${LIBDIR}/admesh/stlinit.cpp
  268. ${LIBDIR}/admesh/util.cpp
  269. )
  270. add_library(miniz STATIC
  271. ${LIBDIR}/miniz/miniz.h
  272. ${LIBDIR}/miniz/miniz_common.h
  273. ${LIBDIR}/miniz/miniz_tdef.h
  274. ${LIBDIR}/miniz/miniz_tinfl.h
  275. ${LIBDIR}/miniz/miniz_zip.h
  276. ${LIBDIR}/miniz/miniz.cpp
  277. ${LIBDIR}/miniz/miniz_tdef.cpp
  278. ${LIBDIR}/miniz/miniz_tinfl.cpp
  279. ${LIBDIR}/miniz/miniz_zip.cpp
  280. )
  281. add_library(clipper STATIC
  282. ${LIBDIR}/clipper.cpp
  283. ${LIBDIR}/clipper.hpp
  284. )
  285. add_library(polypartition STATIC
  286. ${LIBDIR}/polypartition.cpp
  287. ${LIBDIR}/polypartition.h
  288. )
  289. add_library(poly2tri STATIC
  290. ${LIBDIR}/poly2tri/common/shapes.cc
  291. ${LIBDIR}/poly2tri/common/shapes.h
  292. ${LIBDIR}/poly2tri/common/utils.h
  293. ${LIBDIR}/poly2tri/poly2tri.h
  294. ${LIBDIR}/poly2tri/sweep/advancing_front.cc
  295. ${LIBDIR}/poly2tri/sweep/advancing_front.h
  296. ${LIBDIR}/poly2tri/sweep/cdt.cc
  297. ${LIBDIR}/poly2tri/sweep/cdt.h
  298. ${LIBDIR}/poly2tri/sweep/sweep.cc
  299. ${LIBDIR}/poly2tri/sweep/sweep.h
  300. ${LIBDIR}/poly2tri/sweep/sweep_context.cc
  301. ${LIBDIR}/poly2tri/sweep/sweep_context.h
  302. )
  303. add_library(nowide STATIC
  304. ${LIBDIR}/boost/nowide/args.hpp
  305. ${LIBDIR}/boost/nowide/cenv.hpp
  306. ${LIBDIR}/boost/nowide/config.hpp
  307. ${LIBDIR}/boost/nowide/convert.hpp
  308. ${LIBDIR}/boost/nowide/cstdio.hpp
  309. ${LIBDIR}/boost/nowide/cstdlib.hpp
  310. ${LIBDIR}/boost/nowide/filebuf.hpp
  311. ${LIBDIR}/boost/nowide/fstream.hpp
  312. ${LIBDIR}/boost/nowide/integration/filesystem.hpp
  313. ${LIBDIR}/boost/nowide/iostream.cpp
  314. ${LIBDIR}/boost/nowide/iostream.hpp
  315. ${LIBDIR}/boost/nowide/stackstring.hpp
  316. ${LIBDIR}/boost/nowide/system.hpp
  317. ${LIBDIR}/boost/nowide/utf8_codecvt.hpp
  318. ${LIBDIR}/boost/nowide/windows.hpp
  319. )
  320. add_library(Shiny STATIC
  321. ${LIBDIR}/Shiny/Shiny.h
  322. ${LIBDIR}/Shiny/ShinyConfig.h
  323. ${LIBDIR}/Shiny/ShinyData.h
  324. ${LIBDIR}/Shiny/ShinyMacros.h
  325. ${LIBDIR}/Shiny/ShinyManager.c
  326. ${LIBDIR}/Shiny/ShinyManager.h
  327. ${LIBDIR}/Shiny/ShinyNode.c
  328. ${LIBDIR}/Shiny/ShinyNode.h
  329. ${LIBDIR}/Shiny/ShinyNodePool.c
  330. ${LIBDIR}/Shiny/ShinyNodePool.h
  331. ${LIBDIR}/Shiny/ShinyNodeState.c
  332. ${LIBDIR}/Shiny/ShinyNodeState.h
  333. ${LIBDIR}/Shiny/ShinyOutput.c
  334. ${LIBDIR}/Shiny/ShinyOutput.h
  335. ${LIBDIR}/Shiny/ShinyPrereqs.h
  336. ${LIBDIR}/Shiny/ShinyTools.c
  337. ${LIBDIR}/Shiny/ShinyTools.h
  338. ${LIBDIR}/Shiny/ShinyVersion.h
  339. ${LIBDIR}/Shiny/ShinyZone.c
  340. ${LIBDIR}/Shiny/ShinyZone.h
  341. )
  342. add_library(semver STATIC
  343. ${LIBDIR}/semver/semver.h
  344. ${LIBDIR}/semver/semver.c
  345. )
  346. # Generate the Slic3r Perl module (XS) typemap file.
  347. set(MyTypemap ${CMAKE_CURRENT_BINARY_DIR}/typemap)
  348. add_custom_command(
  349. OUTPUT ${MyTypemap}
  350. DEPENDS ${CMAKE_CURRENT_LIST_DIR}/xsp/my.map
  351. COMMAND ${PERL_EXECUTABLE} -MExtUtils::Typemaps -MExtUtils::Typemaps::Basic -e "$typemap = ExtUtils::Typemaps->new(file => \"${CMAKE_CURRENT_LIST_DIR}/xsp/my.map\"); $typemap->merge(typemap => ExtUtils::Typemaps::Basic->new); $typemap->write(file => \"${MyTypemap}\")"
  352. VERBATIM
  353. )
  354. # Generate the Slic3r Perl module (XS) main.xs file.
  355. set(XS_MAIN_XS ${CMAKE_CURRENT_BINARY_DIR}/main.xs)
  356. set(XSP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/xsp)
  357. #FIXME list the dependecies explicitely, add dependency on the typemap.
  358. set(XS_XSP_FILES
  359. ${XSP_DIR}/BoundingBox.xsp
  360. ${XSP_DIR}/BridgeDetector.xsp
  361. ${XSP_DIR}/Clipper.xsp
  362. ${XSP_DIR}/Config.xsp
  363. ${XSP_DIR}/ExPolygon.xsp
  364. ${XSP_DIR}/ExPolygonCollection.xsp
  365. ${XSP_DIR}/ExtrusionEntityCollection.xsp
  366. ${XSP_DIR}/ExtrusionLoop.xsp
  367. ${XSP_DIR}/ExtrusionMultiPath.xsp
  368. ${XSP_DIR}/ExtrusionPath.xsp
  369. ${XSP_DIR}/ExtrusionSimulator.xsp
  370. ${XSP_DIR}/Filler.xsp
  371. ${XSP_DIR}/Flow.xsp
  372. ${XSP_DIR}/GCode.xsp
  373. ${XSP_DIR}/GCodeSender.xsp
  374. ${XSP_DIR}/Geometry.xsp
  375. ${XSP_DIR}/GUI.xsp
  376. ${XSP_DIR}/GUI_AppConfig.xsp
  377. ${XSP_DIR}/GUI_3DScene.xsp
  378. ${XSP_DIR}/GUI_Preset.xsp
  379. ${XSP_DIR}/GUI_Tab.xsp
  380. ${XSP_DIR}/Layer.xsp
  381. ${XSP_DIR}/Line.xsp
  382. ${XSP_DIR}/Model.xsp
  383. ${XSP_DIR}/MotionPlanner.xsp
  384. ${XSP_DIR}/PerimeterGenerator.xsp
  385. ${XSP_DIR}/PlaceholderParser.xsp
  386. ${XSP_DIR}/Point.xsp
  387. ${XSP_DIR}/Polygon.xsp
  388. ${XSP_DIR}/Polyline.xsp
  389. ${XSP_DIR}/PolylineCollection.xsp
  390. ${XSP_DIR}/Print.xsp
  391. ${XSP_DIR}/Surface.xsp
  392. ${XSP_DIR}/SurfaceCollection.xsp
  393. ${XSP_DIR}/TriangleMesh.xsp
  394. ${XSP_DIR}/Utils_OctoPrint.xsp
  395. ${XSP_DIR}/Utils_PresetUpdater.xsp
  396. ${XSP_DIR}/AppController.xsp
  397. ${XSP_DIR}/XS.xsp
  398. )
  399. foreach (file ${XS_XSP_FILES})
  400. if (MSVC)
  401. # Visual Studio C compiler has issues with FILE pragmas containing quotes.
  402. set(INCLUDE_COMMANDS "${INCLUDE_COMMANDS}INCLUDE_COMMAND: $^X -MExtUtils::XSpp::Cmd -e xspp -- -t ${CMAKE_CURRENT_LIST_DIR}/xsp/typemap.xspt ${file}\n")
  403. else ()
  404. set(INCLUDE_COMMANDS "${INCLUDE_COMMANDS}INCLUDE_COMMAND: $^X -MExtUtils::XSpp::Cmd -e xspp -- -t \"${CMAKE_CURRENT_LIST_DIR}/xsp/typemap.xspt\" \"${file}\"\n")
  405. endif ()
  406. endforeach ()
  407. configure_file(main.xs.in ${XS_MAIN_XS} @ONLY) # Insert INCLUDE_COMMANDS into main.xs
  408. # Generate the Slic3r Perl module (XS) XS.cpp file.
  409. #FIXME add the dependency on main.xs and typemap.
  410. set(XS_MAIN_CPP ${CMAKE_CURRENT_BINARY_DIR}/XS.cpp)
  411. add_custom_command(
  412. OUTPUT ${XS_MAIN_CPP}
  413. DEPENDS ${MyTypemap} ${XS_XSP_FILES} ${CMAKE_CURRENT_LIST_DIR}/xsp/typemap.xspt
  414. COMMAND COMMAND xsubpp -typemap typemap -output ${XS_MAIN_CPP} -hiertype ${XS_MAIN_XS}
  415. )
  416. # Define the Perl XS shared library.
  417. if(APPLE)
  418. set(XS_SHARED_LIBRARY_TYPE MODULE)
  419. else()
  420. set(XS_SHARED_LIBRARY_TYPE SHARED)
  421. endif()
  422. add_library(XS ${XS_SHARED_LIBRARY_TYPE}
  423. ${XS_MAIN_CPP}
  424. ${LIBDIR}/libslic3r/utils.cpp
  425. ${LIBDIR}/slic3r/GUI/wxPerlIface.cpp
  426. ${LIBDIR}/perlglue.cpp
  427. ${LIBDIR}/ppport.h
  428. ${LIBDIR}/xsinit.h
  429. ${CMAKE_CURRENT_LIST_DIR}/xsp/my.map
  430. # mytype.map is empty. Is it required by Build.PL or the Perl xspp module?
  431. ${CMAKE_CURRENT_LIST_DIR}/xsp/mytype.map
  432. # Used by Perl xsubpp to generate XS.cpp
  433. ${CMAKE_CURRENT_LIST_DIR}/xsp/typemap.xspt
  434. )
  435. if(APPLE)
  436. set_target_properties(XS PROPERTIES BUNDLE TRUE)
  437. # Ignore undefined symbols of the perl interpreter, they will be found in the caller image.
  438. target_link_libraries(XS "-undefined dynamic_lookup")
  439. endif()
  440. target_link_libraries(XS libslic3r libslic3r_gui admesh miniz clipper nowide polypartition poly2tri semver avrdude)
  441. if(SLIC3R_PROFILE)
  442. target_link_libraries(XS Shiny)
  443. endif()
  444. # Add the OpenGL and GLU libraries.
  445. if (SLIC3R_GUI)
  446. if (MSVC)
  447. target_link_libraries(XS user32.lib Setupapi.lib OpenGL32.Lib GlU32.Lib)
  448. elseif (MINGW)
  449. target_link_libraries(XS -lopengl32)
  450. elseif (APPLE)
  451. target_link_libraries(XS "-framework OpenGL")
  452. else ()
  453. target_link_libraries(XS -lGL -lGLU)
  454. endif ()
  455. endif ()
  456. target_include_directories(XS PRIVATE src src/libslic3r) # Local include directories
  457. target_compile_definitions(XS PRIVATE -DSLIC3RXS)
  458. set_target_properties(XS PROPERTIES PREFIX "") # Prevent cmake from generating libXS.so instead of XS.so
  459. if (APPLE)
  460. # add_compile_options(-stdlib=libc++)
  461. # add_definitions(-DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_NO_CXX11_RVALUE_REFERENCES -DBOOST_THREAD_USES_MOVE)
  462. target_link_libraries(XS "-framework IOKit" "-framework CoreFoundation" -lc++)
  463. elseif (MSVC)
  464. target_link_libraries(XS )
  465. else ()
  466. target_link_libraries(XS -lstdc++)
  467. endif ()
  468. # Windows specific stuff
  469. if (WIN32)
  470. target_compile_definitions(XS PRIVATE -DNOGDI -DNOMINMAX -DHAS_BOOL)
  471. endif ()
  472. ## Configuration flags
  473. if (SLIC3R_GUI)
  474. message("Slic3r will be built with GUI support")
  475. target_compile_definitions(XS PRIVATE -DSLIC3R_GUI)
  476. endif ()
  477. if (SLIC3R_PROFILE)
  478. message("Slic3r will be built with a Shiny invasive profiler")
  479. add_definitions(-DSLIC3R_PROFILE)
  480. endif ()
  481. if (CMAKE_BUILD_TYPE MATCHES DEBUG)
  482. target_compile_definitions(XS PRIVATE -DSLIC3R_DEBUG -DDEBUG -D_DEBUG)
  483. else ()
  484. target_compile_definitions(XS PRIVATE -DNDEBUG)
  485. endif ()
  486. # Perl specific stuff
  487. find_package(PerlLibs REQUIRED)
  488. set(PerlEmbed_DEBUG 1)
  489. find_package(PerlEmbed REQUIRED)
  490. target_include_directories(XS PRIVATE ${PERL_INCLUDE_PATH})
  491. target_compile_options(XS PRIVATE ${PerlEmbed_CCFLAGS})
  492. # If the Perl is compiled with optimization off, disable optimization over the whole project.
  493. if (WIN32 AND ";${PerlEmbed_CCFLAGS};" MATCHES ";[-/]Od;")
  494. message(STATUS "Perl compiled without optimization. Disabling optimization for the Slic3r build.")
  495. message("Old CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
  496. message("Old CMAKE_CXX_FLAGS_RELWITHDEBINFO: ${CMAKE_CXX_FLAGS_RELEASE}")
  497. message("Old CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS_RELEASE}")
  498. set(CMAKE_CXX_FLAGS_RELEASE "/MD /Od /Zi /EHsc /DNDEBUG /DWIN32")
  499. set(CMAKE_C_FLAGS_RELEASE "/MD /Od /Zi /DNDEBUG /DWIN32")
  500. set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /Od /Zi /EHsc /DNDEBUG /DWIN32")
  501. set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MD /Od /Zi /DNDEBUG /DWIN32")
  502. set(CMAKE_CXX_FLAGS "/MD /Od /Zi /EHsc /DNDEBUG /DWIN32")
  503. set(CMAKE_C_FLAGS "/MD /Od /Zi /DNDEBUG /DWIN32")
  504. endif()
  505. # The following line will add -fPIC on Linux to make the XS.so rellocable.
  506. add_definitions(${PerlEmbed_CCCDLFLAGS})
  507. if (WIN32)
  508. target_link_libraries(XS ${PERL_LIBRARY})
  509. endif()
  510. add_subdirectory(src/avrdude)
  511. ## REQUIRED packages
  512. # Find and configure boost
  513. if(SLIC3R_STATIC)
  514. # Use static boost libraries.
  515. set(Boost_USE_STATIC_LIBS ON)
  516. # Use boost libraries linked statically to the C++ runtime.
  517. # set(Boost_USE_STATIC_RUNTIME ON)
  518. endif()
  519. #set(Boost_DEBUG ON)
  520. find_package(Boost REQUIRED COMPONENTS system filesystem thread log locale regex)
  521. if(Boost_FOUND)
  522. include_directories(${Boost_INCLUDE_DIRS})
  523. target_link_libraries(XS ${Boost_LIBRARIES})
  524. if (APPLE)
  525. # BOOST_ASIO_DISABLE_KQUEUE : prevents a Boost ASIO bug on OS X: https://svn.boost.org/trac/boost/ticket/5339
  526. add_definitions(-DBOOST_ASIO_DISABLE_KQUEUE)
  527. endif()
  528. if(NOT SLIC3R_STATIC)
  529. add_definitions(-DBOOST_LOG_DYN_LINK)
  530. endif()
  531. endif()
  532. # Find and configure intel-tbb
  533. if(SLIC3R_STATIC)
  534. set(TBB_STATIC 1)
  535. endif()
  536. set(TBB_DEBUG 1)
  537. find_package(TBB REQUIRED)
  538. include_directories(${TBB_INCLUDE_DIRS})
  539. add_definitions(${TBB_DEFINITIONS})
  540. if(MSVC)
  541. # Suppress implicit linking of the TBB libraries by the Visual Studio compiler.
  542. add_definitions(-D__TBB_NO_IMPLICIT_LINKAGE)
  543. endif()
  544. # The Intel TBB library will use the std::exception_ptr feature of C++11.
  545. add_definitions(-DTBB_USE_CAPTURED_EXCEPTION=0)
  546. target_link_libraries(XS ${TBB_LIBRARIES})
  547. # Find and configure wxWidgets
  548. if (SLIC3R_PRUSACONTROL)
  549. set(wxWidgets_UseAlienWx 1)
  550. if (wxWidgets_UseAlienWx)
  551. set(AlienWx_DEBUG 1)
  552. find_package(AlienWx REQUIRED COMPONENTS base core adv html gl)
  553. include_directories(${AlienWx_INCLUDE_DIRS})
  554. #add_compile_options(${AlienWx_CXX_FLAGS})
  555. add_definitions(${AlienWx_DEFINITIONS})
  556. set(wxWidgets_LIBRARIES ${AlienWx_LIBRARIES})
  557. # On Linux / gtk, we need to have a direct access to gtk+ for some workarounds.
  558. if (AlienWx_GUI_TOOLKIT STREQUAL "gtk2")
  559. pkg_check_modules(GTK2 gtk+-2.0)
  560. include_directories(${GTK2_INCLUDE_DIRS})
  561. endif()
  562. if (AlienWx_GUI_TOOLKIT STREQUAL "gtk3")
  563. pkg_check_modules(GTK3 gtk+-3.0)
  564. include_directories(${GTK3_INCLUDE_DIRS})
  565. endif()
  566. else ()
  567. find_package(wxWidgets REQUIRED COMPONENTS base core adv html gl)
  568. include(${wxWidgets_USE_FILE})
  569. endif ()
  570. add_definitions(-DSLIC3R_GUI -DSLIC3R_PRUS)
  571. target_link_libraries(XS ${wxWidgets_LIBRARIES})
  572. endif()
  573. find_package(CURL REQUIRED)
  574. include_directories(${CURL_INCLUDE_DIRS})
  575. target_link_libraries(XS ${CURL_LIBRARIES})
  576. if (SLIC3R_STATIC)
  577. if (NOT APPLE)
  578. # libcurl is always linked dynamically to the system libcurl on OSX.
  579. # On other systems, libcurl is linked statically if SLIC3R_STATIC is set.
  580. add_definitions(-DCURL_STATICLIB)
  581. endif()
  582. if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
  583. # As of now, our build system produces a statically linked libcurl,
  584. # which links the OpenSSL library dynamically.
  585. find_package(OpenSSL REQUIRED)
  586. message("OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}")
  587. message("OpenSSL libraries: ${OPENSSL_LIBRARIES}")
  588. include_directories(${OPENSSL_INCLUDE_DIR})
  589. target_link_libraries(XS ${OPENSSL_LIBRARIES})
  590. endif()
  591. endif()
  592. ## OPTIONAL packages
  593. # Find eigen3 or use bundled version
  594. if (NOT SLIC3R_STATIC)
  595. find_package(Eigen3)
  596. endif ()
  597. if (NOT Eigen3_FOUND)
  598. set(Eigen3_FOUND 1)
  599. set(EIGEN3_INCLUDE_DIR ${LIBDIR}/eigen/)
  600. endif ()
  601. include_directories(${EIGEN3_INCLUDE_DIR})
  602. # Find expat or use bundled version
  603. # Always use the system libexpat on Linux.
  604. if (NOT SLIC3R_STATIC OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
  605. find_package(EXPAT)
  606. endif ()
  607. if (NOT EXPAT_FOUND)
  608. add_library(expat STATIC
  609. ${LIBDIR}/expat/xmlparse.c
  610. ${LIBDIR}/expat/xmlrole.c
  611. ${LIBDIR}/expat/xmltok.c
  612. )
  613. set(EXPAT_FOUND 1)
  614. set(EXPAT_INCLUDE_DIRS ${LIBDIR}/expat/)
  615. set(EXPAT_LIBRARIES expat)
  616. endif ()
  617. include_directories(${EXPAT_INCLUDE_DIRS})
  618. target_link_libraries(XS ${EXPAT_LIBRARIES})
  619. # Find glew or use bundled version
  620. if (NOT SLIC3R_STATIC)
  621. find_package(GLEW)
  622. endif ()
  623. if (NOT GLEW_FOUND)
  624. add_library(glew STATIC ${LIBDIR}/glew/src/glew.c)
  625. set(GLEW_FOUND 1)
  626. set(GLEW_INCLUDE_DIRS ${LIBDIR}/glew/include/)
  627. set(GLEW_LIBRARIES glew)
  628. add_definitions(-DGLEW_STATIC)
  629. endif ()
  630. include_directories(${GLEW_INCLUDE_DIRS})
  631. target_link_libraries(XS ${GLEW_LIBRARIES})
  632. # Install the XS.pm and XS.{so,dll,bundle} into the local-lib directory.
  633. set(PERL_LOCAL_LIB_DIR "${PROJECT_SOURCE_DIR}/local-lib/lib/perl5/${PerlEmbed_ARCHNAME}")
  634. add_custom_command(
  635. TARGET XS
  636. POST_BUILD
  637. COMMAND ${CMAKE_COMMAND} -E make_directory "${PERL_LOCAL_LIB_DIR}/auto/Slic3r/XS/"
  638. COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:XS>" "${PERL_LOCAL_LIB_DIR}/auto/Slic3r/XS/"
  639. COMMAND ${CMAKE_COMMAND} -E make_directory "${PERL_LOCAL_LIB_DIR}/Slic3r/"
  640. COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/xs/lib/Slic3r/XS.pm" "${PERL_LOCAL_LIB_DIR}/Slic3r/"
  641. COMMENT "Installing XS.pm and XS.{so,dll,bundle} into the local-lib directory ..."
  642. )
  643. if(APPLE)
  644. add_custom_command(
  645. TARGET XS
  646. POST_BUILD
  647. COMMAND ${CMAKE_COMMAND} -E rename "${PERL_LOCAL_LIB_DIR}/auto/Slic3r/XS/XS" "${PERL_LOCAL_LIB_DIR}/auto/Slic3r/XS/XS.bundle"
  648. )
  649. endif()
  650. # Create a slic3r executable
  651. add_executable(slic3r ${PROJECT_SOURCE_DIR}/src/slic3r.cpp)
  652. target_include_directories(XS PRIVATE src src/libslic3r)
  653. target_link_libraries(slic3r libslic3r libslic3r_gui admesh miniz ${Boost_LIBRARIES} clipper ${EXPAT_LIBRARIES} ${GLEW_LIBRARIES} polypartition poly2tri ${TBB_LIBRARIES} ${wxWidgets_LIBRARIES})
  654. if(SLIC3R_PROFILE)
  655. target_link_libraries(Shiny)
  656. endif()
  657. if (APPLE)
  658. target_link_libraries(slic3r "-framework IOKit" "-framework CoreFoundation" -lc++)
  659. elseif (NOT MSVC)
  660. target_link_libraries(slic3r -lstdc++)
  661. endif ()
  662. if (MSVC)
  663. # Here we associate some additional properties with the MSVC project to enable compilation and debugging out of the box.
  664. get_filename_component(PROPS_PERL_BIN_PATH "${PERL_EXECUTABLE}" DIRECTORY)
  665. string(REPLACE "/" "\\" PROPS_PERL_BIN_PATH "${PROPS_PERL_BIN_PATH}")
  666. string(REPLACE "/" "\\" PROPS_PERL_EXECUTABLE "${PERL_EXECUTABLE}")
  667. string(REPLACE "/" "\\" PROPS_CMAKE_SOURCE_DIR "${CMAKE_SOURCE_DIR}")
  668. configure_file("${PROJECT_SOURCE_DIR}/cmake/msvc/xs.wperl.props.in" "${CMAKE_BINARY_DIR}/xs.wperl.props" NEWLINE_STYLE CRLF)
  669. set_target_properties(XS PROPERTIES VS_USER_PROPS "${CMAKE_BINARY_DIR}/xs.wperl.props")
  670. endif()
  671. # l10n
  672. set(L10N_DIR "${PROJECT_SOURCE_DIR}/resources/localization")
  673. add_custom_target(pot
  674. COMMAND xgettext --keyword=L --from-code=UTF-8 --debug
  675. -f "${L10N_DIR}/list.txt"
  676. -o "${L10N_DIR}/Slic3rPE.pot"
  677. WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
  678. COMMENT "Generate pot file from strings in the source tree"
  679. )
  680. # ##############################################################################
  681. # Adding libnest2d project for bin packing...
  682. # ##############################################################################
  683. set(LIBNEST2D_UNITTESTS ON CACHE BOOL "Force generating unittests for libnest2d")
  684. add_subdirectory(${LIBDIR}/libnest2d)
  685. target_include_directories(libslic3r PUBLIC BEFORE ${LIBNEST2D_INCLUDES})
  686. message(STATUS "Libnest2D Libraries: ${LIBNEST2D_LIBRARIES}")
  687. target_link_libraries(libslic3r ${LIBNEST2D_LIBRARIES})
  688. # ##############################################################################
  689. # Installation
  690. install(TARGETS XS DESTINATION ${PERL_VENDORARCH}/auto/Slic3r/XS)
  691. install(FILES lib/Slic3r/XS.pm DESTINATION ${PERL_VENDORLIB}/Slic3r)