diff --git a/3rdparty/assimp/assimp.cmake b/3rdparty/assimp/assimp.cmake index d0da7f6a166..c7d055c64ec 100644 --- a/3rdparty/assimp/assimp.cmake +++ b/3rdparty/assimp/assimp.cmake @@ -6,6 +6,10 @@ else() set(lib_name assimp) endif() +ExternalProject_Get_Property(ext_zlib INSTALL_DIR) +set(ZLIB_INSTALL_DIR ${INSTALL_DIR}) +unset(INSTALL_DIR) + # IntelLLVM (SYCL) compiler defaults to fast math, causing NaN comparison code # compilation error. if(CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM") @@ -29,7 +33,8 @@ ExternalProject_Add( -DASSIMP_BUILD_ASSIMP_TOOLS=OFF -DASSIMP_BUILD_TESTS=OFF -DASSIMP_INSTALL_PDB=OFF - -DASSIMP_BUILD_ZLIB=ON + -DASSIMP_BUILD_ZLIB=OFF + -DZLIB_ROOT:PATH=${ZLIB_INSTALL_DIR} -DASSIMP_NO_EXPORT=OFF -DHUNTER_ENABLED=OFF # Renamed to "ASSIMP_HUNTER_ENABLED" in newer assimp. -DASSIMP_WARNINGS_AS_ERRORS=OFF diff --git a/3rdparty/civetweb/civetweb.cmake b/3rdparty/civetweb/civetweb.cmake index 5f5f68520e9..8b91b784ecc 100644 --- a/3rdparty/civetweb/civetweb.cmake +++ b/3rdparty/civetweb/civetweb.cmake @@ -8,7 +8,7 @@ ExternalProject_Add( DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/civetweb" UPDATE_COMMAND "" CMAKE_ARGS - -DCMAKE_POLICY_VERSION_MINIMUM=3.5 + -DCMAKE_POLICY_VERSION_MINIMUM=3.10 -DCIVETWEB_BUILD_TESTING=OFF -DCIVETWEB_ENABLE_CXX=ON -DCIVETWEB_SSL_OPENSSL_API_1_0=OFF diff --git a/3rdparty/find_dependencies.cmake b/3rdparty/find_dependencies.cmake index 13f6501c8de..1bf579170f5 100644 --- a/3rdparty/find_dependencies.cmake +++ b/3rdparty/find_dependencies.cmake @@ -494,28 +494,7 @@ open3d_find_package_3rdparty_library(3rdparty_threads TARGETS Threads::Threads ) -# Assimp -if(USE_SYSTEM_ASSIMP) - open3d_find_package_3rdparty_library(3rdparty_assimp - PACKAGE assimp - TARGETS assimp::assimp - ) - if(NOT 3rdparty_assimp_FOUND) - set(USE_SYSTEM_ASSIMP OFF) - endif() -endif() -if(NOT USE_SYSTEM_ASSIMP) - include(${Open3D_3RDPARTY_DIR}/assimp/assimp.cmake) - open3d_import_3rdparty_library(3rdparty_assimp - INCLUDE_DIRS ${ASSIMP_INCLUDE_DIR} - LIB_DIR ${ASSIMP_LIB_DIR} - LIBRARIES ${ASSIMP_LIBRARIES} - DEPENDS ext_assimp - ) - list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_assimp) -else() - list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_assimp) -endif() + # OpenMP if(WITH_OPENMP) @@ -855,6 +834,50 @@ if (BUILD_LIBREALSENSE) endif() endif() +if(USE_SYSTEM_ZLIB) + open3d_find_package_3rdparty_library(3rdparty_zlib + PACKAGE zlib + TARGETS ZLIB::zlib + ) + list(APPEND Open3D_3RDPARTY_HEADER_TARGETS_FROM_SYSTEM Open3D::3rdparty_zlib) + endif() +if(NOT USE_SYSTEM_ZLIB) + include(${Open3D_3RDPARTY_DIR}/zlib/zlib.cmake) + open3d_import_3rdparty_library(3rdparty_zlib + HIDDEN + INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} + LIB_DIR ${ZLIB_LIB_DIR} + LIBRARIES ${ZLIB_LIBRARIES} + DEPENDS ext_zlib + ) + list(APPEND Open3D_3RDPARTY_HEADER_TARGETS_FROM_CUSTOM Open3D::3rdparty_zlib) +endif() + +# Assimp +if(USE_SYSTEM_ASSIMP) + open3d_find_package_3rdparty_library(3rdparty_assimp + PACKAGE assimp + TARGETS assimp::assimp + ) + if(NOT 3rdparty_assimp_FOUND) + set(USE_SYSTEM_ASSIMP OFF) + endif() +endif() +if(NOT USE_SYSTEM_ASSIMP) + include(${Open3D_3RDPARTY_DIR}/assimp/assimp.cmake) + open3d_import_3rdparty_library(3rdparty_assimp + INCLUDE_DIRS ${ASSIMP_INCLUDE_DIR} + LIB_DIR ${ASSIMP_LIB_DIR} + LIBRARIES ${ASSIMP_LIBRARIES} + DEPENDS ext_assimp + ) + add_dependencies(ext_assimp ext_zlib) + target_link_libraries(3rdparty_assimp INTERFACE Open3D::3rdparty_zlib) + list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_assimp) +else() + list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_assimp) +endif() + # Curl # - Curl should be linked before PNG, otherwise it will have undefined symbols. # - openssl.cmake needs to be included before curl.cmake, for the @@ -927,15 +950,6 @@ if(USE_SYSTEM_PNG) endif() endif() if(NOT USE_SYSTEM_PNG) - include(${Open3D_3RDPARTY_DIR}/zlib/zlib.cmake) - open3d_import_3rdparty_library(3rdparty_zlib - HIDDEN - INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} - LIB_DIR ${ZLIB_LIB_DIR} - LIBRARIES ${ZLIB_LIBRARIES} - DEPENDS ext_zlib - ) - include(${Open3D_3RDPARTY_DIR}/libpng/libpng.cmake) open3d_import_3rdparty_library(3rdparty_png INCLUDE_DIRS ${LIBPNG_INCLUDE_DIRS} @@ -1138,12 +1152,24 @@ open3d_import_3rdparty_library(3rdparty_poisson list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_poisson) # Minizip -if(WITH_MINIZIP) - open3d_pkg_config_3rdparty_library(3rdparty_minizip - SEARCH_ARGS minizip +if(USE_SYSTEM_MINIZIP) + open3d_find_package_3rdparty_library(3rdparty_zlib + PACKAGE minizip + TARGETS MINIZIP::minizip ) list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_minizip) endif() +if(NOT USE_SYSTEM_MINIZIP) + include(${Open3D_3RDPARTY_DIR}/zlib/minizip.cmake) + open3d_import_3rdparty_library(3rdparty_minizip + HIDDEN + INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS} + LIB_DIR ${MINIZIP_LIB_DIR} + LIBRARIES ${MINIZIP_LIBRARIES} + DEPENDS ext_minizip + ) + list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_minizip) +endif() # Googletest if (BUILD_UNIT_TESTS) diff --git a/3rdparty/fmt/fmt.cmake b/3rdparty/fmt/fmt.cmake index 45757b01c5f..0b3a30f79b9 100644 --- a/3rdparty/fmt/fmt.cmake +++ b/3rdparty/fmt/fmt.cmake @@ -31,7 +31,7 @@ ExternalProject_Add( -DFMT_DOC=OFF -DFMT_TEST=OFF -DFMT_FUZZ=OFF - -DCMAKE_POLICY_VERSION_MINIMUM=3.5 + -DCMAKE_POLICY_VERSION_MINIMUM=3.10 BUILD_BYPRODUCTS /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${FMT_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX} /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${FMT_LIB_NAME}d${CMAKE_STATIC_LIBRARY_SUFFIX} diff --git a/3rdparty/libjpeg-turbo/libjpeg-turbo.cmake b/3rdparty/libjpeg-turbo/libjpeg-turbo.cmake index 32094ea9530..e0c08dd5f05 100644 --- a/3rdparty/libjpeg-turbo/libjpeg-turbo.cmake +++ b/3rdparty/libjpeg-turbo/libjpeg-turbo.cmake @@ -58,7 +58,7 @@ ExternalProject_Add( DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/libjpeg-turbo" UPDATE_COMMAND "" CMAKE_ARGS - -DCMAKE_POLICY_VERSION_MINIMUM=3.5 + -DCMAKE_POLICY_VERSION_MINIMUM=3.10 -DCMAKE_INSTALL_PREFIX= -DWITH_CRT_DLL=${WITH_CRT_DLL} -DENABLE_STATIC=ON diff --git a/3rdparty/libpng/libpng.cmake b/3rdparty/libpng/libpng.cmake index 8183b80080b..e88aac5b7fc 100644 --- a/3rdparty/libpng/libpng.cmake +++ b/3rdparty/libpng/libpng.cmake @@ -6,21 +6,25 @@ else() set(LIBPNG_LIB_NAME png16) endif() +ExternalProject_Get_Property(ext_zlib INSTALL_DIR) +set(ZLIB_INSTALL_DIR ${INSTALL_DIR}) +unset(INSTALL_DIR) + ExternalProject_Add( ext_libpng PREFIX libpng - URL https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz - URL_HASH SHA256=ca74a0dace179a8422187671aee97dd3892b53e168627145271cad5b5ac81307 + URL https://github.com/glennrp/libpng/archive/refs/tags/v1.6.47.tar.gz + URL_HASH SHA256=631a4c58ea6c10c81f160c4b21fa8495b715d251698ebc2552077e8450f30454 DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/libpng" UPDATE_COMMAND "" CMAKE_ARGS - -DCMAKE_POLICY_VERSION_MINIMUM=3.5 + -DCMAKE_POLICY_VERSION_MINIMUM=3.10 -DCMAKE_INSTALL_PREFIX= -DPNG_SHARED=OFF -DPNG_EXECUTABLES=OFF -DPNG_TESTS=OFF - -DPNG_BUILD_ZLIB=ON # Prevent libpng from calling find_pacakge(zlib). - -DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIRS} + -DPNG_BUILD_ZLIB=OFF + -DZLIB_ROOT:PATH=${ZLIB_INSTALL_DIR} -DPNG_ARM_NEON=off # Must be lower case. ${ExternalProject_CMAKE_ARGS_hidden} BUILD_BYPRODUCTS diff --git a/3rdparty/librealsense/librealsense.cmake b/3rdparty/librealsense/librealsense.cmake index d57ba037acc..5d1c5a60517 100644 --- a/3rdparty/librealsense/librealsense.cmake +++ b/3rdparty/librealsense/librealsense.cmake @@ -21,7 +21,7 @@ ExternalProject_Add( COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_LIST_DIR}/fix-macos-arm64.patch CMAKE_ARGS - -DCMAKE_POLICY_VERSION_MINIMUM=3.5 + -DCMAKE_POLICY_VERSION_MINIMUM=3.10 -DCMAKE_INSTALL_PREFIX= -DBUILD_SHARED_LIBS=OFF -DBUILD_EXAMPLES=OFF diff --git a/3rdparty/openblas/openblas.cmake b/3rdparty/openblas/openblas.cmake index e9b818ddf56..4475c8ba6db 100644 --- a/3rdparty/openblas/openblas.cmake +++ b/3rdparty/openblas/openblas.cmake @@ -14,6 +14,7 @@ ExternalProject_Add( DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/openblas" CMAKE_ARGS ${ExternalProject_CMAKE_ARGS} + -DCMAKE_POLICY_VERSION_MINIMUM=3.10 -DTARGET=${OPENBLAS_TARGET} -DCMAKE_INSTALL_PREFIX= BUILD_BYPRODUCTS diff --git a/3rdparty/possionrecon/eigen_rows.patch b/3rdparty/possionrecon/eigen_rows.patch new file mode 100644 index 00000000000..b62cfe46b49 --- /dev/null +++ b/3rdparty/possionrecon/eigen_rows.patch @@ -0,0 +1,21 @@ +diff -u a/Src/SparseMatrix.inl b/Src/SparseMatrix.inl +--- a/Src/SparseMatrix.inl ++++ b/Src/SparseMatrix.inl +@@ -463,7 +463,7 @@ + A.resize( aRows ); + for( size_t i=0 ; iN ]++; +- for( size_t i=0 ; iN ]++; +- for( size_t i=0 ; i -DVTK_GROUP_ENABLE_Imaging=NO diff --git a/3rdparty/zeromq/zeromq_build.cmake b/3rdparty/zeromq/zeromq_build.cmake index f0bf964655d..62449ea8b2b 100644 --- a/3rdparty/zeromq/zeromq_build.cmake +++ b/3rdparty/zeromq/zeromq_build.cmake @@ -38,7 +38,7 @@ ExternalProject_Add( # Does not seem to work. We have to directly set the flags on Windows. #-DCMAKE_POLICY_DEFAULT_CMP0091:STRING=NEW #-DCMAKE_MSVC_RUNTIME_LIBRARY:STRING=${CMAKE_MSVC_RUNTIME_LIBRARY} - -DCMAKE_POLICY_VERSION_MINIMUM=3.5 + -DCMAKE_POLICY_VERSION_MINIMUM=3.10 -DBUILD_STATIC=ON -DBUILD_SHARED=OFF -DBUILD_TESTS=OFF diff --git a/3rdparty/zlib/0001-patch-zlib-to-enable-unzip.patch b/3rdparty/zlib/0001-patch-zlib-to-enable-unzip.patch deleted file mode 100644 index caaf2152442..00000000000 --- a/3rdparty/zlib/0001-patch-zlib-to-enable-unzip.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 896883f4dc22d26db653bb92739ca77c4f330389 Mon Sep 17 00:00:00 2001 -From: reyanshsolis -Date: Sat, 25 Dec 2021 00:10:42 +0530 -Subject: [PATCH] patch zlib to enable unzip - ---- - CMakeLists.txt | 4 ++++ - contrib/minizip/ioapi.c | 3 +-- - contrib/minizip/unzip.c | 2 +- - 3 files changed, 6 insertions(+), 3 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 0fe939d..20f25bb 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -93,6 +93,8 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) - set(ZLIB_PUBLIC_HDRS - ${CMAKE_CURRENT_BINARY_DIR}/zconf.h - zlib.h -+ contrib/minizip/unzip.h -+ contrib/minizip/ioapi.h - ) - set(ZLIB_PRIVATE_HDRS - crc32.h -@@ -121,6 +123,8 @@ set(ZLIB_SRCS - trees.c - uncompr.c - zutil.c -+ contrib/minizip/unzip.c -+ contrib/minizip/ioapi.c - ) - - if(NOT MINGW) -diff --git a/contrib/minizip/ioapi.c b/contrib/minizip/ioapi.c -index 7f5c191..c2b536f 100644 ---- a/contrib/minizip/ioapi.c -+++ b/contrib/minizip/ioapi.c -@@ -221,8 +221,7 @@ static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream) - return ret; - } - --void fill_fopen_filefunc (pzlib_filefunc_def) -- zlib_filefunc_def* pzlib_filefunc_def; -+void fill_fopen_filefunc (zlib_filefunc_def* pzlib_filefunc_def) - { - pzlib_filefunc_def->zopen_file = fopen_file_func; - pzlib_filefunc_def->zread_file = fread_file_func; -diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c -index bcfb941..9319186 100644 ---- a/contrib/minizip/unzip.c -+++ b/contrib/minizip/unzip.c -@@ -69,7 +69,7 @@ - #include - - #ifndef NOUNCRYPT -- #define NOUNCRYPT -+ // #define NOUNCRYPT - #endif - - #include "zlib.h" --- -2.25.1 - diff --git a/3rdparty/zlib/LICENSE b/3rdparty/zlib/LICENSE index e7b8045b7f4..626bba38e27 100644 --- a/3rdparty/zlib/LICENSE +++ b/3rdparty/zlib/LICENSE @@ -37,3 +37,21 @@ Gailly and Mark Adler; it does not include third-party code. If you redistribute modified sources, we would appreciate that you include in the file ChangeLog history information documenting your changes. Please read the FAQ for more information on the distribution of modified source versions. + +Condition of use and distribution are the same as zlib: + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgement in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. diff --git a/3rdparty/zlib/minizip.cmake b/3rdparty/zlib/minizip.cmake new file mode 100644 index 00000000000..a87c51d6573 --- /dev/null +++ b/3rdparty/zlib/minizip.cmake @@ -0,0 +1,40 @@ +include(ExternalProject) + +find_package(Git QUIET REQUIRED) + +ExternalProject_Get_Property(ext_zlib INSTALL_DIR) +set(ZLIB_INSTALL_DIR ${INSTALL_DIR}) +unset(INSTALL_DIR) + +set(lib_name minizip) + +ExternalProject_Add(ext_minizip + PREFIX minizip-ng + URL https://github.com/zlib-ng/minizip-ng/archive/refs/tags/4.0.7.tar.gz + URL_HASH SHA256=a87f1f734f97095fe1ef0018217c149d53d0f78438bcb77af38adc21dff2dfbc + DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/minizip-ng" + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX= + -DMZ_COMPAT:BOOL=ON + -DMZ_ZLIB:BOOL=ON + -DMZ_BZIP2:BOOL=OFF + -DMZ_LZMA:BOOL=OFF + -DMZ_ZSTD:BOOL=OFF + -DMZ_LIBCOMP:BOOL=OFF + -DMZ_FETCH_LIBS:BOOL=OFF + -DMZ_FORCE_FETCH_LIBS:BOOL=OFF + -DMZ_PKCRYPT:BOOL=OFF + -DMZ_WZAES:BOOL=OFF + -DMZ_OPENSSL:BOOL=OFF + -DMZ_LIBBSD:BOOL=OFF + -DMZ_ICONV:BOOL=OFF + -DZLIB_ROOT:PATH=${ZLIB_INSTALL_DIR} + ${ExternalProject_CMAKE_ARGS} + BUILD_BYPRODUCTS + /lib/${CMAKE_STATIC_LIBRARY_PREFIX}${lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX} +) + +ExternalProject_Get_Property(ext_minizip INSTALL_DIR) +set(MINIZIP_INCLUDE_DIRS ${INSTALL_DIR}/include/minizip/) # "/" is critical. +set(MINIZIP_LIB_DIR ${INSTALL_DIR}/lib) +set(MINIZIP_LIBRARIES ${lib_name}) diff --git a/3rdparty/zlib/zlib.cmake b/3rdparty/zlib/zlib.cmake index 3c70fdf782f..849f430bc76 100644 --- a/3rdparty/zlib/zlib.cmake +++ b/3rdparty/zlib/zlib.cmake @@ -1,39 +1,42 @@ include(ExternalProject) +# ------------------------------------------------------------------ +# Library name (needed by the rest of Open3D build files) +# ------------------------------------------------------------------ if(MSVC) - set(lib_name zlibstatic) + set(ZLIB_LIB_NAME zlibstatic) # .lib produced by zlib‑ng –compat else() - set(lib_name z) + set(ZLIB_LIB_NAME z) # libz.a produced by zlib‑ng –compat endif() find_package(Git QUIET REQUIRED) ExternalProject_Add( ext_zlib - PREFIX zlib - URL https://github.com/madler/zlib/archive/refs/tags/v1.2.13.tar.gz - URL_HASH SHA256=1525952a0a567581792613a9723333d7f8cc20b87a81f920fb8bc7e3f2251428 + PREFIX zlib-ng + URL https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.2.2.tar.gz + URL_HASH SHA256=fcb41dd59a3f17002aeb1bb21f04696c9b721404890bb945c5ab39d2cb69654c DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/zlib" - UPDATE_COMMAND "" - PATCH_COMMAND ${GIT_EXECUTABLE} init - COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace - ${CMAKE_CURRENT_LIST_DIR}/0001-patch-zlib-to-enable-unzip.patch CMAKE_ARGS - -DCMAKE_POLICY_VERSION_MINIMUM=3.5 + -DCMAKE_POLICY_VERSION_MINIMUM=3.10 -DCMAKE_INSTALL_PREFIX= + -DZLIB_COMPAT:BOOL=ON + -DZLIB_ENABLE_TESTS:BOOL=OFF + -DZLIBNG_ENABLE_TESTS:BOOL=OFF + -DWITH_GTEST:BOOL=OFF # zlib needs visiible symbols for examples. Disabling example building causes # assember error in GPU CI. zlib symbols are hidden during linking. ${ExternalProject_CMAKE_ARGS} BUILD_BYPRODUCTS - /lib/${CMAKE_STATIC_LIBRARY_PREFIX}${lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX} - /lib/${CMAKE_STATIC_LIBRARY_PREFIX}${lib_name}d${CMAKE_STATIC_LIBRARY_SUFFIX} + /lib/${CMAKE_STATIC_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX} + /lib/${CMAKE_STATIC_LIBRARY_PREFIX}${ZLIB_LIB_NAME}d${CMAKE_STATIC_LIBRARY_SUFFIX} ) ExternalProject_Get_Property(ext_zlib INSTALL_DIR) set(ZLIB_INCLUDE_DIRS ${INSTALL_DIR}/include/) # "/" is critical. set(ZLIB_LIB_DIR ${INSTALL_DIR}/lib) if(MSVC) - set(ZLIB_LIBRARIES ${lib_name}$<$:d>) + set(ZLIB_LIBRARIES ${ZLIB_LIB_NAME}$<$:d>) else() - set(ZLIB_LIBRARIES ${lib_name}) -endif() + set(ZLIB_LIBRARIES ${ZLIB_LIB_NAME}) +endif() \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d93129e3f0..78f4df137b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ - Fix infinite loop in segment_plane if num_points < ransac_n (PR #7032) - Add select_by_index method to Feature class (PR #7039) - Add optional indices arg for fast computation of a small subset of FPFH features (PR #7118). +- Update the ZLib provider to not use a patched version, instead it uses the new separate minizip provider. The WITH_MINIZIP option is now USE_SYSTEM_MINIZIP. (PR #7022) ## 0.13 diff --git a/CMakeLists.txt b/CMakeLists.txt index 354125dc01d..7a726090bfc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,6 +107,7 @@ option(USE_SYSTEM_IMGUI "Use system pre-installed imgui" OFF option(USE_SYSTEM_JPEG "Use system pre-installed jpeg" OFF) option(USE_SYSTEM_JSONCPP "Use system pre-installed jsoncpp" OFF) option(USE_SYSTEM_LIBLZF "Use system pre-installed liblzf" OFF) +option(USE_SYSTEM_MINIZIP "Use system pre-installed minizip" OFF) option(USE_SYSTEM_MSGPACK "Use system pre-installed msgpack" OFF) option(USE_SYSTEM_NANOFLANN "Use system pre-installed nanoflann" OFF) option(USE_SYSTEM_OPENSSL "Use system pre-installed OpenSSL" OFF) @@ -119,6 +120,7 @@ option(USE_SYSTEM_TINYGLTF "Use system pre-installed tinygltf" OFF option(USE_SYSTEM_TINYOBJLOADER "Use system pre-installed tinyobjloader" OFF) option(USE_SYSTEM_VTK "Use system pre-installed VTK" OFF) option(USE_SYSTEM_ZEROMQ "Use system pre-installed ZeroMQ" OFF) +option(USE_SYSTEM_ZLIB "Use system pre-installed ZLib" OFF) if(LINUX_AARCH64 OR APPLE_AARCH64) option(BUILD_VTK_FROM_SOURCE "Build VTK from source" ON ) else() @@ -131,7 +133,6 @@ else() endif() option(PREFER_OSX_HOMEBREW "Prefer Homebrew libs over frameworks" ON ) -option(WITH_MINIZIP "Enable MiniZIP" OFF) # Sensor options option(BUILD_LIBREALSENSE "Build support for Intel RealSense camera" OFF) diff --git a/cmake/Open3DPrintConfigurationSummary.cmake b/cmake/Open3DPrintConfigurationSummary.cmake index 3e3d42da11e..0936a382f2f 100644 --- a/cmake/Open3DPrintConfigurationSummary.cmake +++ b/cmake/Open3DPrintConfigurationSummary.cmake @@ -78,6 +78,7 @@ function(open3d_print_configuration_summary) VTK WebRTC ZeroMQ + ZLIB ) foreach(dep IN LISTS 3RDPARTY_DEPENDENCIES) string(TOLOWER "${dep}" dep_lower) diff --git a/cpp/open3d/utility/CMakeLists.txt b/cpp/open3d/utility/CMakeLists.txt index d7211a0cefc..7ccb5ca05c6 100644 --- a/cpp/open3d/utility/CMakeLists.txt +++ b/cpp/open3d/utility/CMakeLists.txt @@ -19,6 +19,11 @@ target_sources(utility PRIVATE Timer.cpp ) +target_compile_definitions(utility PRIVATE + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE=1 +) + if (BUILD_ISPC_MODULE) target_sources(utility PRIVATE ISAInfo.ispc diff --git a/cpp/open3d/utility/ExtractZIP.cpp b/cpp/open3d/utility/ExtractZIP.cpp index eba295992c2..b54303ffe2c 100644 --- a/cpp/open3d/utility/ExtractZIP.cpp +++ b/cpp/open3d/utility/ExtractZIP.cpp @@ -20,14 +20,6 @@ #include "open3d/utility/FileSystem.h" #include "open3d/utility/Logging.h" -#ifdef __APPLE__ -// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no -// need for specific 64 bit functions -#define FOPEN_FUNC(filename, mode) fopen(filename, mode) -#else -#define FOPEN_FUNC(filename, mode) fopen64(filename, mode) -#endif - // If required in future, the `WRITEBUFFERSIZE` size can be increased to 16384. #define WRITEBUFFERSIZE (8192) @@ -43,7 +35,7 @@ static int ExtractCurrentFile(unzFile uf, int err = UNZ_OK; FILE *fout = nullptr; void *buf; - uInt size_buf; + std::uint32_t size_buf; unz_file_info64 file_info; err = unzGetCurrentFileInfo64(uf, &file_info, filename_inzip, @@ -97,14 +89,14 @@ static int ExtractCurrentFile(unzFile uf, if (err == UNZ_OK) { std::string file_path = extract_dir + "/" + static_cast(write_filename); - fout = FOPEN_FUNC(file_path.c_str(), "wb"); + fout = fopen(file_path.c_str(), "wb"); // Some zipfile don't contain directory alone before file. if ((fout == nullptr) && filename_withoutpath == (char *)filename_inzip) { utility::filesystem::MakeDirectoryHierarchy(extract_dir); - fout = FOPEN_FUNC(file_path.c_str(), "wb"); + fout = fopen(file_path.c_str(), "wb"); } if (fout == nullptr) { @@ -179,7 +171,7 @@ void ExtractFromZIP(const std::string &file_path, // ExtractFromZIP supports password. Can be exposed if required in future. const std::string password = ""; - for (uLong i = 0; i < gi.number_entry; ++i) { + for (std::uint64_t i = 0; i < gi.number_entry; ++i) { err = ExtractCurrentFile(uf, extract_dir, password); if (err != UNZ_OK) { // Close file, before throwing exception.