From 3beaefd5ef4c5c685046a8cac03d88d73657c93d Mon Sep 17 00:00:00 2001 From: Daniel Simon Date: Mon, 16 Sep 2024 09:44:10 -0700 Subject: [PATCH 01/12] Added missing build byproduct for BoringSSL --- 3rdparty/boringssl/boringssl.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/3rdparty/boringssl/boringssl.cmake b/3rdparty/boringssl/boringssl.cmake index 5f9aeea9e33..87930862c98 100644 --- a/3rdparty/boringssl/boringssl.cmake +++ b/3rdparty/boringssl/boringssl.cmake @@ -48,7 +48,9 @@ ExternalProject_Add( CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS "" + BUILD_BYPRODUCTS + /$<${WIN32}:$,Debug,Release>/>lib/${CMAKE_STATIC_LIBRARY_PREFIX}ssl${CMAKE_STATIC_LIBRARY_SUFFIX} + /$<${WIN32}:$,Debug,Release>/>lib/${CMAKE_STATIC_LIBRARY_PREFIX}crypto${CMAKE_STATIC_LIBRARY_SUFFIX} ) ExternalProject_Get_Property(ext_boringssl SOURCE_DIR) From 9aeddae9c72c5b0d149c15f07d1d3ec083c570e3 Mon Sep 17 00:00:00 2001 From: Daniel Simon Date: Mon, 16 Sep 2024 09:44:34 -0700 Subject: [PATCH 02/12] Added missing build byproduct for libcurl --- 3rdparty/curl/curl.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/3rdparty/curl/curl.cmake b/3rdparty/curl/curl.cmake index c45dbea0dd9..7a73051c1c0 100644 --- a/3rdparty/curl/curl.cmake +++ b/3rdparty/curl/curl.cmake @@ -51,6 +51,7 @@ if(BUILD_CURL_FROM_SOURCE) ${ExternalProject_CMAKE_ARGS_hidden} BUILD_BYPRODUCTS /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX} + /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}-d${CMAKE_STATIC_LIBRARY_SUFFIX} ) ExternalProject_Get_Property(ext_curl INSTALL_DIR) @@ -79,7 +80,9 @@ else() CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS "" + BUILD_BYPRODUCTS + /lib/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX} + /lib/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}-d${CMAKE_STATIC_LIBRARY_SUFFIX} ) ExternalProject_Get_Property(ext_curl SOURCE_DIR) From 19740dfba29ea2db2436d5d2bd4300a90e8c90e4 Mon Sep 17 00:00:00 2001 From: Daniel Simon Date: Mon, 16 Sep 2024 09:45:15 -0700 Subject: [PATCH 03/12] Added missing build byproduct for ipp --- 3rdparty/ipp/ipp.cmake | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/3rdparty/ipp/ipp.cmake b/3rdparty/ipp/ipp.cmake index ffc9b320512..e4b2b43f2b0 100755 --- a/3rdparty/ipp/ipp.cmake +++ b/3rdparty/ipp/ipp.cmake @@ -35,6 +35,20 @@ else() set(IPP_SUBPATH "") endif() +# Threading layer libs must be linked first. +# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/ipp-performace-benefits-with-tl-functions.html +# Library dependency order: +# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/library-dependencies-by-domain.html +if (WIN32) + set(IPP_LIBRARIES ipp_iw ippcvmt_tl_tbb ippcvmt ippimt_tl_tbb ippimt ippccmt_tl_tbb ippccmt ippsmt ippvmmt ippcoremt_tl_tbb ippcoremt) +else() + set(IPP_LIBRARIES ipp_iw ippcv_tl_tbb ippcv ippi_tl_tbb ippi ippcc_tl_tbb ippcc ipps ippvm ippcore_tl_tbb ippcore) +endif() + +foreach(item IN LISTS IPP_LIBRARIES) + list(APPEND IPP_BUILD_BYPRODUCTS /${IPP_SUBPATH}lib/${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) +endforeach() + ExternalProject_Add(ext_ipp PREFIX ipp URL ${IPP_URL} @@ -45,16 +59,10 @@ ExternalProject_Add(ext_ipp CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - ) + BUILD_BYPRODUCTS + ${IPP_BUILD_BYPRODUCTS} +) + ExternalProject_Get_Property(ext_ipp SOURCE_DIR) set(IPP_INCLUDE_DIR "${SOURCE_DIR}/${IPP_SUBPATH}include/") -# Threading layer libs must be linked first. -# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/ipp-performace-benefits-with-tl-functions.html -# Library dependency order: -# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/library-dependencies-by-domain.html -if (WIN32) - set(IPP_LIBRARIES ipp_iw ippcvmt_tl_tbb ippcvmt ippimt_tl_tbb ippimt ippccmt_tl_tbb ippccmt ippsmt ippvmmt ippcoremt_tl_tbb ippcoremt) -else() - set(IPP_LIBRARIES ipp_iw ippcv_tl_tbb ippcv ippi_tl_tbb ippi ippcc_tl_tbb ippcc ipps ippvm ippcore_tl_tbb ippcore) -endif() set(IPP_LIB_DIR "${SOURCE_DIR}/${IPP_SUBPATH}lib") \ No newline at end of file From f4d452a87c8a017438d9fb503e2036a617f8f900 Mon Sep 17 00:00:00 2001 From: Daniel Simon Date: Mon, 16 Sep 2024 09:45:36 -0700 Subject: [PATCH 04/12] Fixed incorrect build byproduct for UVAtlas --- 3rdparty/uvatlas/uvatlas.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/uvatlas/uvatlas.cmake b/3rdparty/uvatlas/uvatlas.cmake index 51831059941..63642f80e3d 100644 --- a/3rdparty/uvatlas/uvatlas.cmake +++ b/3rdparty/uvatlas/uvatlas.cmake @@ -52,7 +52,7 @@ ExternalProject_Add( -Ddirectxmath_DIR= DEPENDS ext_directxheaders ext_directxmath BUILD_BYPRODUCTS - /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}uvatlas${CMAKE_STATIC_LIBRARY_SUFFIX} + /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}UVAtlas${CMAKE_STATIC_LIBRARY_SUFFIX} ) From cc330c5dbbb5f25b7d68da1d1103ca2fb3fc8dec Mon Sep 17 00:00:00 2001 From: Daniel Simon Date: Mon, 16 Sep 2024 09:46:59 -0700 Subject: [PATCH 05/12] Added missing build byproduct for VTK --- 3rdparty/vtk/vtk_build.cmake | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/3rdparty/vtk/vtk_build.cmake b/3rdparty/vtk/vtk_build.cmake index 271d3789667..905fa52ec6d 100644 --- a/3rdparty/vtk/vtk_build.cmake +++ b/3rdparty/vtk/vtk_build.cmake @@ -26,13 +26,13 @@ set(VTK_LIBRARIES vtksys-${VTK_VERSION}${VTK_LIB_SUFFIX} ) -foreach(item IN LISTS VTK_LIBRARIES) - list(APPEND VTK_BUILD_BYPRODUCTS /${Open3D_INSTALL_LIB_DIR}/${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) -endforeach() - if(BUILD_VTK_FROM_SOURCE) + foreach(item IN LISTS VTK_LIBRARIES) + list(APPEND VTK_BUILD_BYPRODUCTS /${Open3D_INSTALL_LIB_DIR}/${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) + endforeach() + ExternalProject_Add( ext_vtk PREFIX vtk @@ -294,6 +294,10 @@ if(BUILD_VTK_FROM_SOURCE) else() #### download prebuilt vtk + foreach(item IN LISTS VTK_LIBRARIES) + list(APPEND VTK_BUILD_BYPRODUCTS /lib/${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) + endforeach() + if(LINUX_AARCH64) message(FATAL "No precompiled vtk for platform. Enable BUILD_VTK_FROM_SOURCE") elseif(APPLE_AARCH64) @@ -334,7 +338,8 @@ else() #### download prebuilt vtk CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS "" + BUILD_BYPRODUCTS + ${VTK_BUILD_BYPRODUCTS} ) ExternalProject_Get_Property(ext_vtk SOURCE_DIR) From 5714a05fa1fb08152979a1347c49f463c30624b6 Mon Sep 17 00:00:00 2001 From: Daniel Simon Date: Mon, 16 Sep 2024 11:52:08 -0700 Subject: [PATCH 06/12] Fixed invalid generator expression on non-windows platforms --- 3rdparty/boringssl/boringssl.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/3rdparty/boringssl/boringssl.cmake b/3rdparty/boringssl/boringssl.cmake index 87930862c98..5048b76648f 100644 --- a/3rdparty/boringssl/boringssl.cmake +++ b/3rdparty/boringssl/boringssl.cmake @@ -49,8 +49,8 @@ ExternalProject_Add( BUILD_COMMAND "" INSTALL_COMMAND "" BUILD_BYPRODUCTS - /$<${WIN32}:$,Debug,Release>/>lib/${CMAKE_STATIC_LIBRARY_PREFIX}ssl${CMAKE_STATIC_LIBRARY_SUFFIX} - /$<${WIN32}:$,Debug,Release>/>lib/${CMAKE_STATIC_LIBRARY_PREFIX}crypto${CMAKE_STATIC_LIBRARY_SUFFIX} + /$<$:$,Debug,Release>/>lib/${CMAKE_STATIC_LIBRARY_PREFIX}ssl${CMAKE_STATIC_LIBRARY_SUFFIX} + /$<$:$,Debug,Release>/>lib/${CMAKE_STATIC_LIBRARY_PREFIX}crypto${CMAKE_STATIC_LIBRARY_SUFFIX} ) ExternalProject_Get_Property(ext_boringssl SOURCE_DIR) From 0f7e43d8f6145c9ea0e88e2e02198c7dd6bebb75 Mon Sep 17 00:00:00 2001 From: Daniel Simon Date: Mon, 16 Sep 2024 20:12:47 -0700 Subject: [PATCH 07/12] Added missing CMAKE_STATIC_LIBRARY_PREFIX --- 3rdparty/ipp/ipp.cmake | 2 +- 3rdparty/vtk/vtk_build.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/3rdparty/ipp/ipp.cmake b/3rdparty/ipp/ipp.cmake index e4b2b43f2b0..deaed2ab179 100755 --- a/3rdparty/ipp/ipp.cmake +++ b/3rdparty/ipp/ipp.cmake @@ -46,7 +46,7 @@ else() endif() foreach(item IN LISTS IPP_LIBRARIES) - list(APPEND IPP_BUILD_BYPRODUCTS /${IPP_SUBPATH}lib/${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) + list(APPEND IPP_BUILD_BYPRODUCTS /${IPP_SUBPATH}lib/${CMAKE_STATIC_LIBRARY_PREFIX}${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) endforeach() ExternalProject_Add(ext_ipp diff --git a/3rdparty/vtk/vtk_build.cmake b/3rdparty/vtk/vtk_build.cmake index 905fa52ec6d..f9217f2301e 100644 --- a/3rdparty/vtk/vtk_build.cmake +++ b/3rdparty/vtk/vtk_build.cmake @@ -30,7 +30,7 @@ set(VTK_LIBRARIES if(BUILD_VTK_FROM_SOURCE) foreach(item IN LISTS VTK_LIBRARIES) - list(APPEND VTK_BUILD_BYPRODUCTS /${Open3D_INSTALL_LIB_DIR}/${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) + list(APPEND VTK_BUILD_BYPRODUCTS /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) endforeach() ExternalProject_Add( From 10d0b1565218791a2877d5e6d1314bca4279d5fb Mon Sep 17 00:00:00 2001 From: Daniel Simon Date: Wed, 9 Oct 2024 17:31:17 -0700 Subject: [PATCH 08/12] Fix downloaded vtk build byproducts --- 3rdparty/vtk/vtk_build.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/vtk/vtk_build.cmake b/3rdparty/vtk/vtk_build.cmake index f9217f2301e..eb8430e8e46 100644 --- a/3rdparty/vtk/vtk_build.cmake +++ b/3rdparty/vtk/vtk_build.cmake @@ -295,7 +295,7 @@ if(BUILD_VTK_FROM_SOURCE) else() #### download prebuilt vtk foreach(item IN LISTS VTK_LIBRARIES) - list(APPEND VTK_BUILD_BYPRODUCTS /lib/${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) + list(APPEND VTK_BUILD_BYPRODUCTS /lib/${CMAKE_STATIC_LIBRARY_PREFIX}${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) endforeach() if(LINUX_AARCH64) From 3325a55273e5708693a17458f580bae110653176 Mon Sep 17 00:00:00 2001 From: Daniel Simon Date: Fri, 11 Oct 2024 20:28:32 -0700 Subject: [PATCH 09/12] Extracted minizip from zlib so that an external zlib could be used in its place. (The removes the patch to zlib required for it to use integrated minizip) --- 3rdparty/find_dependencies.cmake | 47 +++++++++++--- .../0001-patch-zlib-to-enable-unzip.patch | 63 ------------------- 3rdparty/zlib/LICENSE | 18 ++++++ 3rdparty/zlib/minizip.cmake | 37 +++++++++++ 3rdparty/zlib/zlib.cmake | 14 ++--- cpp/open3d/utility/CMakeLists.txt | 5 ++ cpp/open3d/utility/ExtractZIP.cpp | 16 ++--- 7 files changed, 109 insertions(+), 91 deletions(-) delete mode 100644 3rdparty/zlib/0001-patch-zlib-to-enable-unzip.patch create mode 100644 3rdparty/zlib/minizip.cmake diff --git a/3rdparty/find_dependencies.cmake b/3rdparty/find_dependencies.cmake index c3dc3885565..1265182f738 100644 --- a/3rdparty/find_dependencies.cmake +++ b/3rdparty/find_dependencies.cmake @@ -853,6 +853,25 @@ 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_PRIVATE_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_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_zlib) +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 @@ -912,6 +931,25 @@ if(NOT USE_SYSTEM_CURL) endif() list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_curl) +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() + # PNG if(USE_SYSTEM_PNG) # ZLIB::ZLIB is automatically included by the PNG package. @@ -925,15 +963,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} 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..ed65fa870a7 --- /dev/null +++ b/3rdparty/zlib/minizip.cmake @@ -0,0 +1,37 @@ +include(ExternalProject) + +find_package(Git QUIET REQUIRED) + +ExternalProject_Get_Property(ext_zlib INSTALL_DIR) +set(ZLIB_INSTALL_DIR ${INSTALL_DIR}) +unset(INSTALL_DIR) + +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} +) + +set(lib_name minizip) +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 f0d756b5e75..b05dbe7534c 100644 --- a/3rdparty/zlib/zlib.cmake +++ b/3rdparty/zlib/zlib.cmake @@ -10,16 +10,16 @@ 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_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} 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 9d80393d72a..c204d62609c 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. From 6de1aa43be3fe4e5dd1c4540463798ab2ff96857 Mon Sep 17 00:00:00 2001 From: Daniel Simon Date: Tue, 22 Oct 2024 18:14:37 -0700 Subject: [PATCH 10/12] Updated options to remove WITH_MINIZIP and instead use USE_SYSTEM_MINIZIP and USE_SYSTEM_ZLIB for consistency. --- 3rdparty/find_dependencies.cmake | 37 +++++++++++++------------------- CMakeLists.txt | 3 ++- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/3rdparty/find_dependencies.cmake b/3rdparty/find_dependencies.cmake index 1265182f738..7cdde4b52c9 100644 --- a/3rdparty/find_dependencies.cmake +++ b/3rdparty/find_dependencies.cmake @@ -931,25 +931,6 @@ if(NOT USE_SYSTEM_CURL) endif() list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_curl) -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() - # PNG if(USE_SYSTEM_PNG) # ZLIB::ZLIB is automatically included by the PNG package. @@ -1165,12 +1146,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/CMakeLists.txt b/CMakeLists.txt index 7b047cd0b82..7c4fe414e59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,6 +97,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) @@ -109,6 +110,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() @@ -121,7 +123,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) From dc898f7ff0426bfb2dcac18a72e4fcf668387608 Mon Sep 17 00:00:00 2001 From: Daniel Simon Date: Tue, 22 Oct 2024 18:26:39 -0700 Subject: [PATCH 11/12] Updated CHANGELOG.md in reference to PR #7022 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c52a549add6..f18c9a2a370 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ - Fix tensor EstimatePointWiseNormalsWithFastEigen3x3 (PR #6980) - Fix alpha shape reconstruction if alpha too small for point scale (PR #6998) - Fix render to depth image on Apple Retina displays (PR #7001) +- 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 From 557118cf50ac6d79f18bbe166a9f4d83b2661cec Mon Sep 17 00:00:00 2001 From: Daniel Simon Date: Tue, 22 Oct 2024 18:30:24 -0700 Subject: [PATCH 12/12] Added missing build byproduct to minizip.cmake --- 3rdparty/zlib/minizip.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/3rdparty/zlib/minizip.cmake b/3rdparty/zlib/minizip.cmake index ed65fa870a7..a87c51d6573 100644 --- a/3rdparty/zlib/minizip.cmake +++ b/3rdparty/zlib/minizip.cmake @@ -6,6 +6,8 @@ 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 @@ -28,9 +30,10 @@ ExternalProject_Add(ext_minizip -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} ) -set(lib_name minizip) ExternalProject_Get_Property(ext_minizip INSTALL_DIR) set(MINIZIP_INCLUDE_DIRS ${INSTALL_DIR}/include/minizip/) # "/" is critical. set(MINIZIP_LIB_DIR ${INSTALL_DIR}/lib)