diff --git a/deps/CGAL/CGAL.cmake b/deps/CGAL/CGAL.cmake index 987f8260e..94ba84d9c 100644 --- a/deps/CGAL/CGAL.cmake +++ b/deps/CGAL/CGAL.cmake @@ -5,7 +5,7 @@ bambustudio_add_cmake_project( # For whatever reason, this keeps downloading forever (repeats downloads if finished) URL https://github.com/CGAL/cgal/archive/refs/tags/v5.4.zip URL_HASH SHA256=d7605e0a5a5ca17da7547592f6f6e4a59430a0bc861948974254d0de43eab4c0 - DEPENDS dep_Boost dep_GMP dep_MPFR + DEPENDS ${BOOST_PKG} dep_GMP dep_MPFR ) include(GNUInstallDirs) diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 0b44d5c10..09f70b7fc 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -31,6 +31,15 @@ if (NPROC EQUAL 0) set(NPROC 1) endif () +option(DEP_BUILD_PNG "Compile libpng" ON) +option(DEP_BUILD_JPEG "Compile libjpeg" ON) +option(DEP_BUILD_TIFF "Compile libtiff" ON) +option(DEP_BUILD_BOOST "Compile boost" ON) +option(DEP_BUILD_OPENSSL "Compile openssl" ON) +option(DEP_BUILD_GLFW "Compile GLFW" ON) +option(DEP_BUILD_FREETYPE "Compile freetype" ON) +option(DEP_BUILD_WXWIDGETS "Compile wxWidgets" ON) + set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination directory") set(DEP_DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Path for downloaded source packages.") @@ -148,10 +157,20 @@ if (NOT ZLIB_FOUND) set(ZLIB_PKG dep_ZLIB) endif () set(PNG_PKG "") -if (NOT PNG_FOUND) +if (DEP_BUILD_PNG AND NOT PNG_FOUND) include(PNG/PNG.cmake) set(PNG_PKG dep_PNG) endif () +set(JPEG_PKG "") +if (DEP_BUILD_JPEG AND NOT JPEG_FOUND) + include(JPEG/JPEG.cmake) + set(JPEG_PKG dep_JPEG) +endif() +set(TIFF_PKG "") +if (DEP_BUILD_TIFF AND NOT TIFF_FOUND) + include(TIFF/TIFF.cmake) + set(TIFF_PKG dep_TIFF) +endif() set(EXPAT_PKG "") if (NOT EXPAT_FOUND) include(EXPAT/EXPAT.cmake) @@ -159,13 +178,21 @@ if (NOT EXPAT_FOUND) endif () set(DEP_Boost_COMPONENTS system iostreams filesystem thread log locale regex date_time) -include(Boost/Boost.cmake) +set(BOOST_PKG "") +if (DEP_BUILD_BOOST) + include(Boost/Boost.cmake) + set(BOOST_PKG dep_Boost) +endif () # The order of includes respects the dependencies between libraries include(Cereal/Cereal.cmake) include(Qhull/Qhull.cmake) include(GLEW/GLEW.cmake) -include(GLFW/GLFW.cmake) +set(GLFW_PKG "") +if (DEP_BUILD_GLFW) + include(GLFW/GLFW.cmake) + set(GLFW_PKG dep_GLFW) +endif () include(OpenCSG/OpenCSG.cmake) include(TBB/TBB.cmake) @@ -180,37 +207,46 @@ include(CGAL/CGAL.cmake) include(NLopt/NLopt.cmake) -include(OpenSSL/OpenSSL.cmake) - +set(OPENSSL_PKG "") +if (DEP_BUILD_OPENSSL) + include(OpenSSL/OpenSSL.cmake) + set(OPENSSL_PKG dep_OpenSSL) +endif () set(CURL_PKG "") if (NOT CURL_FOUND) include(CURL/CURL.cmake) set(CURL_PKG dep_CURL) endif () - -include(JPEG/JPEG.cmake) -include(TIFF/TIFF.cmake) -include(wxWidgets/wxWidgets.cmake) +set(WXWIDGETS_PKG "") +if (DEP_BUILD_WXWIDGETS) + include(wxWidgets/wxWidgets.cmake) + set(WXWIDGETS_PKG dep_wxWidgets) +endif () +set(FREETYPE_PKG "") +if (DEP_BUILD_FREETYPE) + include(FREETYPE/FREETYPE.cmake) + set(FREETYPE_PKG dep_FREETYPE) +endif () include(OCCT/OCCT.cmake) include(OpenCV/OpenCV.cmake) -include(FREETYPE/FREETYPE.cmake) set(_dep_list - dep_Boost + ${BOOST_PKG} dep_TBB ${CURL_PKG} - dep_wxWidgets + ${WXWIDGETS_PKG} dep_Cereal dep_NLopt dep_OpenVDB dep_OpenCSG dep_OpenCV dep_CGAL - dep_OpenSSL - dep_GLFW + ${OPENSSL_PKG} + ${GLFW_PKG} ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} + ${FREETYPE_PKG} ) if (MSVC) @@ -223,7 +259,9 @@ else() endif() list(APPEND _dep_list "dep_OCCT") -list(APPEND _dep_list "dep_FREETYPE") +# if (DEP_BUILD_FREETYPE) +# list(APPEND _dep_list "dep_FREETYPE") +# endif () add_custom_target(deps ALL DEPENDS ${_dep_list}) diff --git a/deps/CURL/CURL.cmake b/deps/CURL/CURL.cmake index b3c83b768..546e2f703 100644 --- a/deps/CURL/CURL.cmake +++ b/deps/CURL/CURL.cmake @@ -72,7 +72,9 @@ bambustudio_add_cmake_project(CURL ${_curl_platform_flags} ) -add_dependencies(dep_CURL dep_OpenSSL) +if (DEP_BUILD_OPENSSL AND CMAKE_SYSTEM_NAME STREQUAL "Linux") + add_dependencies(dep_CURL ${OPENSSL_PKG}) +endif () if (MSVC) add_debug_dep(dep_CURL) diff --git a/deps/Cereal/Cereal.cmake b/deps/Cereal/Cereal.cmake index 4651bab85..1bd9e3f82 100644 --- a/deps/Cereal/Cereal.cmake +++ b/deps/Cereal/Cereal.cmake @@ -1,6 +1,8 @@ bambustudio_add_cmake_project(Cereal - URL "https://github.com/USCiLab/cereal/archive/v1.2.2.tar.gz" - URL_HASH SHA256=1921f26d2e1daf9132da3c432e2fd02093ecaedf846e65d7679ddf868c7289c4 + URL "https://github.com/USCiLab/cereal/archive/refs/tags/v1.3.0.zip" + URL_HASH SHA256=71642cb54658e98c8f07a0f0d08bf9766f1c3771496936f6014169d3726d9657 CMAKE_ARGS - -DJUST_INSTALL_CEREAL=on + -DJUST_INSTALL_CEREAL=ON + -DSKIP_PERFORMANCE_COMPARISON=ON + -DBUILD_TESTS=OFF ) \ No newline at end of file diff --git a/deps/OCCT/OCCT.cmake b/deps/OCCT/OCCT.cmake index 2943a3cbb..4d7aa7e9a 100644 --- a/deps/OCCT/OCCT.cmake +++ b/deps/OCCT/OCCT.cmake @@ -18,6 +18,7 @@ bambustudio_add_cmake_project(OCCT #-DUSE_FREETYPE=OFF -DUSE_FFMPEG=OFF -DUSE_VTK=OFF + -DBUILD_DOC_Overview=OFF -DBUILD_MODULE_ApplicationFramework=OFF #-DBUILD_MODULE_DataExchange=OFF -DBUILD_MODULE_Draw=OFF @@ -27,4 +28,6 @@ bambustudio_add_cmake_project(OCCT -DBUILD_MODULE_Visualization=OFF ) -add_dependencies(dep_OCCT dep_FREETYPE) +if (DEP_BUILD_FREETYPE) + add_dependencies(dep_OCCT ${FREETYPE_PKG}) +endif () \ No newline at end of file diff --git a/deps/OpenVDB/OpenVDB.cmake b/deps/OpenVDB/OpenVDB.cmake index e22568cfd..7a28341d5 100644 --- a/deps/OpenVDB/OpenVDB.cmake +++ b/deps/OpenVDB/OpenVDB.cmake @@ -17,7 +17,7 @@ bambustudio_add_cmake_project(OpenVDB URL_HASH SHA256=f353e7b99bd0cbfc27ac9082de51acf32a8bc0b3e21ff9661ecca6f205ec1d81 # URL https://github.com/AcademySoftwareFoundation/openvdb/archive/refs/tags/v10.0.1.zip # URL_HASH SHA256=48C2CFA9853B58FA86282DF1F83F0E99D07858CC03EB2BA8227DC447A830100A - DEPENDS dep_TBB dep_Blosc dep_OpenEXR dep_Boost + DEPENDS dep_TBB dep_Blosc dep_OpenEXR ${BOOST_PKG} CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DOPENVDB_BUILD_PYTHON_MODULE=OFF diff --git a/deps/TIFF/TIFF.cmake b/deps/TIFF/TIFF.cmake index f820b6a75..93b3fcfc5 100644 --- a/deps/TIFF/TIFF.cmake +++ b/deps/TIFF/TIFF.cmake @@ -3,7 +3,7 @@ find_package(OpenGL QUIET REQUIRED) bambustudio_add_cmake_project(TIFF URL https://gitlab.com/libtiff/libtiff/-/archive/v4.1.0/libtiff-v4.1.0.zip URL_HASH SHA256=c56edfacef0a60c0de3e6489194fcb2f24c03dbb550a8a7de5938642d045bd32 - DEPENDS ${ZLIB_PKG} ${PNG_PKG} dep_JPEG + DEPENDS ${ZLIB_PKG} ${PNG_PKG} ${JPEG_PKG} CMAKE_ARGS -Dlzma:BOOL=OFF -Dwebp:BOOL=OFF diff --git a/deps/wxWidgets/wxWidgets.cmake b/deps/wxWidgets/wxWidgets.cmake index 5aebbceea..b7af0750c 100644 --- a/deps/wxWidgets/wxWidgets.cmake +++ b/deps/wxWidgets/wxWidgets.cmake @@ -1,4 +1,4 @@ -set(_wx_git_tag v3.1.5) +set(_wx_git_tag bambu) set(_wx_toolkit "") if(CMAKE_SYSTEM_NAME STREQUAL "Linux") @@ -18,17 +18,16 @@ else () set(_wx_edge "-DwxUSE_WEBVIEW_EDGE=OFF") endif () -if (MSVC) - set(_patch_cmd ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-wxWidget-fix.patch) -else () - set(_patch_cmd test -f WXWIDGETS_PATCHED || ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-wxWidget-fix.patch && touch WXWIDGETS_PATCHED) -endif () +# if (MSVC) +# set(_patch_cmd ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-wxWidget-fix.patch) +# else () +# set(_patch_cmd test -f WXWIDGETS_PATCHED || ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-wxWidget-fix.patch && touch WXWIDGETS_PATCHED) +# endif () bambustudio_add_cmake_project(wxWidgets - GIT_REPOSITORY "https://github.com/wxWidgets/wxWidgets" + GIT_REPOSITORY "https://github.com/MackBambu/wxWidgets" GIT_TAG ${_wx_git_tag} - PATCH_COMMAND ${_patch_cmd} - DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} dep_TIFF dep_JPEG + DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} ${TIFF_PKG} ${JPEG_PKG} CMAKE_ARGS -DwxBUILD_PRECOMP=ON ${_wx_toolkit} diff --git a/src/libslic3r/Format/svg.cpp b/src/libslic3r/Format/svg.cpp index 4a96274b9..7bfd73b98 100644 --- a/src/libslic3r/Format/svg.cpp +++ b/src/libslic3r/Format/svg.cpp @@ -1,3 +1,4 @@ +#include "libslic3r/ClipperUtils.hpp" #include "../libslic3r.h" #include "../Model.hpp" #include "../TriangleMesh.hpp" @@ -19,9 +20,8 @@ #include "TopExp_Explorer.hxx" #include "TopoDS.hxx" #include "BRepExtrema_SelfIntersection.hxx" -#include "clipper/clipper.hpp" - -using namespace ClipperLib; +#include "libslic3r/clipper.hpp" +#include "libslic3r/Polygon.hpp" namespace Slic3r { const double STEP_TRANS_CHORD_ERROR = 0.005; @@ -213,9 +213,9 @@ bool get_svg_profile(const char *path, std::vector &element_infos, for (int i = 0; i < path_line_points.size(); ++i) { ClipperLib::Path pt_path; for (auto line_point : path_line_points[i]) { - pt_path.push_back(IntPoint(line_point.first.X() * scale_size, line_point.first.Y() * scale_size)); + pt_path.push_back(ClipperLib::IntPoint(line_point.first.X() * scale_size, line_point.first.Y() * scale_size)); } - pt_path.push_back(IntPoint(path_line_points[i].back().second.X() * scale_size, path_line_points[i].back().second.Y() * scale_size)); + pt_path.push_back(ClipperLib::IntPoint(path_line_points[i].back().second.X() * scale_size, path_line_points[i].back().second.Y() * scale_size)); ClipperLib::Paths out_paths; ClipperLib::ClipperOffset co;