Skip to content

Commit 83d199f

Browse files
Fix for macos build based on isl-org#7022
1 parent 4356c17 commit 83d199f

File tree

15 files changed

+143
-100
lines changed

15 files changed

+143
-100
lines changed

3rdparty/assimp/assimp.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ ExternalProject_Add(
2929
-DASSIMP_BUILD_ASSIMP_TOOLS=OFF
3030
-DASSIMP_BUILD_TESTS=OFF
3131
-DASSIMP_INSTALL_PDB=OFF
32-
-DASSIMP_BUILD_ZLIB=ON
32+
-DASSIMP_BUILD_ZLIB=OFF
3333
-DASSIMP_NO_EXPORT=OFF
3434
-DHUNTER_ENABLED=OFF # Renamed to "ASSIMP_HUNTER_ENABLED" in newer assimp.
3535
-DASSIMP_WARNINGS_AS_ERRORS=OFF

3rdparty/find_dependencies.cmake

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,25 @@ if (BUILD_LIBREALSENSE)
855855
endif()
856856
endif()
857857

858+
if(USE_SYSTEM_ZLIB)
859+
open3d_find_package_3rdparty_library(3rdparty_zlib
860+
PACKAGE ZLIB
861+
TARGETS ZLIB::ZLIB
862+
)
863+
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_zlib)
864+
endif()
865+
if(NOT USE_SYSTEM_ZLIB)
866+
include(${Open3D_3RDPARTY_DIR}/zlib/zlib.cmake)
867+
open3d_import_3rdparty_library(3rdparty_zlib
868+
HIDDEN
869+
INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}
870+
LIB_DIR ${ZLIB_LIB_DIR}
871+
LIBRARIES ${ZLIB_LIBRARIES}
872+
DEPENDS ext_zlib
873+
)
874+
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_zlib)
875+
endif()
876+
858877
# Curl
859878
# - Curl should be linked before PNG, otherwise it will have undefined symbols.
860879
# - openssl.cmake needs to be included before curl.cmake, for the
@@ -927,15 +946,6 @@ if(USE_SYSTEM_PNG)
927946
endif()
928947
endif()
929948
if(NOT USE_SYSTEM_PNG)
930-
include(${Open3D_3RDPARTY_DIR}/zlib/zlib.cmake)
931-
open3d_import_3rdparty_library(3rdparty_zlib
932-
HIDDEN
933-
INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}
934-
LIB_DIR ${ZLIB_LIB_DIR}
935-
LIBRARIES ${ZLIB_LIBRARIES}
936-
DEPENDS ext_zlib
937-
)
938-
939949
include(${Open3D_3RDPARTY_DIR}/libpng/libpng.cmake)
940950
open3d_import_3rdparty_library(3rdparty_png
941951
INCLUDE_DIRS ${LIBPNG_INCLUDE_DIRS}
@@ -1138,12 +1148,24 @@ open3d_import_3rdparty_library(3rdparty_poisson
11381148
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_poisson)
11391149

11401150
# Minizip
1141-
if(WITH_MINIZIP)
1142-
open3d_pkg_config_3rdparty_library(3rdparty_minizip
1143-
SEARCH_ARGS minizip
1151+
if(USE_SYSTEM_MINIZIP)
1152+
open3d_find_package_3rdparty_library(3rdparty_zlib
1153+
PACKAGE minizip
1154+
TARGETS MINIZIP::minizip
11441155
)
11451156
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_minizip)
11461157
endif()
1158+
if(NOT USE_SYSTEM_MINIZIP)
1159+
include(${Open3D_3RDPARTY_DIR}/zlib/minizip.cmake)
1160+
open3d_import_3rdparty_library(3rdparty_minizip
1161+
HIDDEN
1162+
INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}
1163+
LIB_DIR ${MINIZIP_LIB_DIR}
1164+
LIBRARIES ${MINIZIP_LIBRARIES}
1165+
DEPENDS ext_minizip
1166+
)
1167+
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_minizip)
1168+
endif()
11471169

11481170
# Googletest
11491171
if (BUILD_UNIT_TESTS)

3rdparty/libpng/libpng.cmake

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@ if(MSVC)
44
set(LIBPNG_LIB_NAME libpng16_static)
55
else()
66
set(LIBPNG_LIB_NAME png16)
7+
# Add the -fno-define-target-os-macros flag for non-MSVC compilers (for instance, Clang)
78
endif()
89

910
ExternalProject_Add(
1011
ext_libpng
1112
PREFIX libpng
12-
URL https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
13-
URL_HASH SHA256=ca74a0dace179a8422187671aee97dd3892b53e168627145271cad5b5ac81307
13+
URL https://github.com/glennrp/libpng/archive/refs/tags/v1.6.47.tar.gz
14+
URL_HASH SHA256=631a4c58ea6c10c81f160c4b21fa8495b715d251698ebc2552077e8450f30454
1415
DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/libpng"
1516
UPDATE_COMMAND ""
1617
CMAKE_ARGS
1718
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
19+
-DCMAKE_CXX_FLAGS=-fno-define-target-os-macros
1820
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
1921
-DPNG_SHARED=OFF
2022
-DPNG_EXECUTABLES=OFF
2123
-DPNG_TESTS=OFF
22-
-DPNG_BUILD_ZLIB=ON # Prevent libpng from calling find_pacakge(zlib).
23-
-DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIRS}
24+
-DPNG_BUILD_ZLIB=OFF
2425
-DPNG_ARM_NEON=off # Must be lower case.
2526
${ExternalProject_CMAKE_ARGS_hidden}
2627
BUILD_BYPRODUCTS

3rdparty/openblas/openblas.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ ExternalProject_Add(
1414
DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/openblas"
1515
CMAKE_ARGS
1616
${ExternalProject_CMAKE_ARGS}
17+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
1718
-DTARGET=${OPENBLAS_TARGET}
1819
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
1920
BUILD_BYPRODUCTS
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff -u a/Src/SparseMatrix.inl b/Src/SparseMatrix.inl
2+
--- a/Src/SparseMatrix.inl
3+
+++ b/Src/SparseMatrix.inl
4+
@@ -463,7 +463,7 @@
5+
A.resize( aRows );
6+
for( size_t i=0 ; i<aRows ; i++ ) A.rowSizes[i] = 0;
7+
for( size_t i=0 ; i<At.rows() ; i++ ) for( const_iterator iter=At.begin(i) ; iter!=At.end(i) ; iter++ ) A.rowSizes[ iter->N ]++;
8+
- for( size_t i=0 ; i<A.rows ; i++ )
9+
+ for( size_t i=0 ; i<A.rows() ; i++ )
10+
{
11+
size_t t = A.rowSizes[i];
12+
A.rowSizes[i] = 0;
13+
@@ -496,7 +496,7 @@
14+
A.resize( aRows );
15+
for( size_t i=0 ; i<aRows ; i++ ) A.rowSizes[i] = 0;
16+
for( size_t i=0 ; i<At.rows() ; i++ ) for( const_iterator iter=At.begin(i) ; iter!=At.end(i) ; iter++ ) A.rowSizes[ iter->N ]++;
17+
- for( size_t i=0 ; i<A.rows ; i++ )
18+
+ for( size_t i=0 ; i<A.rows() ; i++ )
19+
{
20+
size_t t = A.rowSizes[i];
21+
A.rowSizes[i] = 0;

3rdparty/possionrecon/possionrecon.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ ExternalProject_Add(
1111
CONFIGURE_COMMAND ""
1212
BUILD_COMMAND ""
1313
INSTALL_COMMAND ""
14+
PATCH_COMMAND ${GIT_EXECUTABLE} init
15+
COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace --verbose
16+
${CMAKE_CURRENT_LIST_DIR}/eigen_rows.patch
1417
)
1518

1619
ExternalProject_Get_Property(ext_poisson SOURCE_DIR)

3rdparty/vtk/vtk_build.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ if(BUILD_VTK_FROM_SOURCE)
4343
UPDATE_COMMAND ""
4444
CMAKE_ARGS
4545
${ExternalProject_CMAKE_ARGS_hidden}
46+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
4647
-DBUILD_SHARED_LIBS=OFF
4748
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
4849
-DVTK_GROUP_ENABLE_Imaging=NO

3rdparty/zlib/0001-patch-zlib-to-enable-unzip.patch

Lines changed: 0 additions & 63 deletions
This file was deleted.

3rdparty/zlib/LICENSE

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,21 @@ Gailly and Mark Adler; it does not include third-party code.
3737
If you redistribute modified sources, we would appreciate that you include in
3838
the file ChangeLog history information documenting your changes. Please read
3939
the FAQ for more information on the distribution of modified source versions.
40+
41+
Condition of use and distribution are the same as zlib:
42+
43+
This software is provided 'as-is', without any express or implied
44+
warranty. In no event will the authors be held liable for any damages
45+
arising from the use of this software.
46+
47+
Permission is granted to anyone to use this software for any purpose,
48+
including commercial applications, and to alter it and redistribute it
49+
freely, subject to the following restrictions:
50+
51+
1. The origin of this software must not be misrepresented; you must not
52+
claim that you wrote the original software. If you use this software
53+
in a product, an acknowledgement in the product documentation would be
54+
appreciated but is not required.
55+
2. Altered source versions must be plainly marked as such, and must not be
56+
misrepresented as being the original software.
57+
3. This notice may not be removed or altered from any source distribution.

3rdparty/zlib/minizip.cmake

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
include(ExternalProject)
2+
3+
find_package(Git QUIET REQUIRED)
4+
5+
ExternalProject_Get_Property(ext_zlib INSTALL_DIR)
6+
set(ZLIB_INSTALL_DIR ${INSTALL_DIR})
7+
unset(INSTALL_DIR)
8+
9+
set(lib_name minizip)
10+
11+
ExternalProject_Add(ext_minizip
12+
PREFIX minizip-ng
13+
URL https://github.com/zlib-ng/minizip-ng/archive/refs/tags/4.0.7.tar.gz
14+
URL_HASH SHA256=a87f1f734f97095fe1ef0018217c149d53d0f78438bcb77af38adc21dff2dfbc
15+
DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/minizip-ng"
16+
CMAKE_ARGS
17+
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
18+
-DMZ_COMPAT:BOOL=ON
19+
-DMZ_ZLIB:BOOL=ON
20+
-DMZ_BZIP2:BOOL=OFF
21+
-DMZ_LZMA:BOOL=OFF
22+
-DMZ_ZSTD:BOOL=OFF
23+
-DMZ_LIBCOMP:BOOL=OFF
24+
-DMZ_FETCH_LIBS:BOOL=OFF
25+
-DMZ_FORCE_FETCH_LIBS:BOOL=OFF
26+
-DMZ_PKCRYPT:BOOL=OFF
27+
-DMZ_WZAES:BOOL=OFF
28+
-DMZ_OPENSSL:BOOL=OFF
29+
-DMZ_LIBBSD:BOOL=OFF
30+
-DMZ_ICONV:BOOL=OFF
31+
-DZLIB_ROOT:PATH=${ZLIB_INSTALL_DIR}
32+
${ExternalProject_CMAKE_ARGS}
33+
BUILD_BYPRODUCTS
34+
<INSTALL_DIR>/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX}
35+
)
36+
37+
ExternalProject_Get_Property(ext_minizip INSTALL_DIR)
38+
set(MINIZIP_INCLUDE_DIRS ${INSTALL_DIR}/include/minizip/) # "/" is critical.
39+
set(MINIZIP_LIB_DIR ${INSTALL_DIR}/lib)
40+
set(MINIZIP_LIBRARIES ${lib_name})

0 commit comments

Comments
 (0)