ENH: upgrade some deps libraries

CGAL to 5.4
 TBB to 2021.5
 OpenVDB to 8.2

Change-Id: I08992fce104e6f56001643c3c5dbf6c3f59ffc3d
(cherry picked from commit 1571f176fc37dda1c3e889776e13fa49bba4ae42)
This commit is contained in:
Arthur 2023-05-04 11:19:37 +08:00 committed by Lane.Wei
parent 4297f72283
commit 3d8383f127
6 changed files with 34 additions and 53 deletions

View file

@ -8,22 +8,16 @@ if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
set(_q QUIET)
endif()
# Only consider the config scripts if not building with the static dependencies
# and this call is not made from a static dependency build (e.g. dep_OpenVDB will use this module)
# BUILD_SHARED_LIBS will always be defined for dependency projects and will be OFF.
# Newer versions of TBB also discourage from using TBB as a static library
if (NOT SLIC3R_STATIC AND (NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS))
find_package(${CMAKE_FIND_PACKAGE_NAME} ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} CONFIG ${_q})
if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND)
message(STATUS "Falling back to MODULE search for ${CMAKE_FIND_PACKAGE_NAME}...")
else()
message(STATUS "${CMAKE_FIND_PACKAGE_NAME} found in ${${CMAKE_FIND_PACKAGE_NAME}_DIR}")
endif()
find_package(${CMAKE_FIND_PACKAGE_NAME} ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} CONFIG ${_q})
if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND)
message(STATUS "Falling back to MODULE search for ${CMAKE_FIND_PACKAGE_NAME}...")
else()
message(STATUS "${CMAKE_FIND_PACKAGE_NAME} found in ${${CMAKE_FIND_PACKAGE_NAME}_DIR}")
endif()
endif ()
endif()
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND)
include(${CMAKE_CURRENT_LIST_DIR}/FindTBB.cmake.in)

28
deps/CGAL/CGAL.cmake vendored
View file

@ -1,31 +1,11 @@
bambustudio_add_cmake_project(
CGAL
GIT_REPOSITORY https://github.com/CGAL/cgal.git
GIT_TAG caacd806dc55c61cc68adaad99f2240f00493b29 # releases/CGAL-5.3
# GIT_REPOSITORY https://github.com/CGAL/cgal.git
# GIT_TAG caacd806dc55c61cc68adaad99f2240f00493b29 # releases/CGAL-5.3
# For whatever reason, this keeps downloading forever (repeats downloads if finished)
#URL https://github.com/CGAL/cgal/archive/releases/CGAL-5.0.zip
#URL_HASH SHA256=c2b035bd078687b6d8c0fb6371a7443adcdb647856af9969532c4050cd5f48e5
URL https://github.com/CGAL/cgal/archive/refs/tags/v5.4.zip
URL_HASH SHA256=d7605e0a5a5ca17da7547592f6f6e4a59430a0bc861948974254d0de43eab4c0
DEPENDS dep_Boost dep_GMP dep_MPFR
)
include(GNUInstallDirs)
# CGAL, for whatever reason, makes itself non-relocatable by writing the build directory into
# CGALConfig-installation-dirs.cmake and including it in configure time.
# If this file is not present, it will not consider the stored absolute path
ExternalProject_Add_Step(dep_CGAL dep_CGAL_relocation_fix
DEPENDEES install
COMMAND ${CMAKE_COMMAND} -E remove CGALConfig-installation-dirs.cmake
WORKING_DIRECTORY "${DESTDIR}/usr/local/${CMAKE_INSTALL_LIBDIR}/cmake/CGAL"
)
# Again, for whatever reason, CGAL thinks that its version is not relevant if
# configured as a header only library. Fixing it by placing a cmake version file
# besides the installed config file.
ExternalProject_Add_Step(dep_CGAL dep_CGAL_version_fix
DEPENDEES install
COMMAND ${CMAKE_COMMAND} -E copy cgal/CGALConfigVersion.cmake "${DESTDIR}/usr/local/${CMAKE_INSTALL_LIBDIR}/cmake/CGAL/CGALConfigVersion.cmake"
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}"
)

View file

@ -6,9 +6,17 @@ else()
set(_build_static ON)
endif()
bambustudio_add_cmake_project(OpenVDB
URL https://github.com/tamasmeszaros/openvdb/archive/refs/tags/v6.2.1-prusa3d.zip #v6.2.1 patched
URL_HASH SHA256=caf9f0c91976722883ff9cb32420ef142af22f7e625fc643b91c23d6e4172f62
set (_openvdb_vdbprint ON)
#if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
# Build fails on raspberry pi due to missing link directive to latomic
# Let's hope it will be fixed soon.
#set (_openvdb_vdbprint OFF)
#endif ()
bambustudio_add_cmake_project(OpenVDB
URL https://github.com/tamasmeszaros/openvdb/archive/a68fd58d0e2b85f01adeb8b13d7555183ab10aa5.zip # 8.2 patched
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
CMAKE_ARGS
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
@ -18,7 +26,7 @@ bambustudio_add_cmake_project(OpenVDB
-DOPENVDB_CORE_STATIC=${_build_static}
-DOPENVDB_ENABLE_RPATH:BOOL=OFF
-DTBB_STATIC=${_build_static}
-DOPENVDB_BUILD_VDB_PRINT=ON
-DOPENVDB_BUILD_VDB_PRINT=${_openvdb_vdbprint}
-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON # Centos6 has old zlib
)
@ -33,4 +41,4 @@ if (MSVC)
WORKING_DIRECTORY "${BINARY_DIR}"
)
endif ()
endif ()
endif ()

10
deps/TBB/TBB.cmake vendored
View file

@ -1,12 +1,12 @@
bambustudio_add_cmake_project(
TBB
URL "https://github.com/wjakob/tbb/archive/a0dc9bf76d0120f917b641ed095360448cabc85b.tar.gz"
URL_HASH SHA256=0545cb6033bd1873fcae3ea304def720a380a88292726943ae3b9b207f322efe
PATCH_COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-TBB-GCC13.patch
CMAKE_ARGS
URL "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.5.0.zip"
URL_HASH SHA256=83ea786c964a384dd72534f9854b419716f412f9d43c0be88d41874763e7bb47
#PATCH_COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-TBB-GCC13.patch
CMAKE_ARGS
-DTBB_BUILD_SHARED=OFF
-DTBB_BUILD_TESTS=OFF
-DTBB_BUILD_TESTS=OFF
-DTBB_TEST=OFF
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_DEBUG_POSTFIX=_debug
)

View file

@ -4,7 +4,6 @@
#include <ClipperUtils.hpp>
#include <boost/geometry/index/rtree.hpp>
#include <tbb/parallel_for.h>
#include <tbb/atomic.h>
#if defined(_MSC_VER) && defined(__clang__)
#define BOOST_NO_CXX17_HDR_STRING_VIEW

View file

@ -3568,7 +3568,6 @@ const ExPolygons& TreeSupportData::calculate_avoidance(const RadiusLayerPair& ke
const auto& radius = key.radius;
const auto& layer_nr = key.layer_nr;
BOOST_LOG_TRIVIAL(debug) << "calculate_avoidance on radius=" << radius << ", layer=" << layer_nr<<", recursion="<<key.recursions;
std::pair<tbb::concurrent_unordered_map<RadiusLayerPair, ExPolygons, RadiusLayerPairHash>::iterator,bool> ret;
constexpr auto max_recursion_depth = 100;
if (key.recursions <= max_recursion_depth*2) {
if (layer_nr == 0) {
@ -3595,14 +3594,15 @@ const ExPolygons& TreeSupportData::calculate_avoidance(const RadiusLayerPair& ke
const ExPolygons &collision = get_collision(radius, layer_nr);
avoidance_areas.insert(avoidance_areas.end(), collision.begin(), collision.end());
avoidance_areas = std::move(union_ex(avoidance_areas));
ret = m_avoidance_cache.insert({key, std::move(avoidance_areas)});
auto ret = m_avoidance_cache.insert({ key, std::move(avoidance_areas) });
//assert(ret.second);
return ret.first->second;
} else {
ExPolygons avoidance_areas = std::move(offset_ex(m_layer_outlines_below[layer_nr], scale_(m_xy_distance + radius)));
ret = m_avoidance_cache.insert({key, std::move(avoidance_areas)});
auto ret = m_avoidance_cache.insert({ key, std::move(avoidance_areas) });
assert(ret.second);
return ret.first->second;
}
return ret.first->second;
}
} //namespace Slic3r