Skip to content

Commit ef979cc

Browse files
committed
Keep WITH_SYSTEM_ZLIB (but added deprecation notice).
Keep HAVE_ZLIB - added config include to opennurbs_zlib.cpp. Correctly check for ZLIB for libpng_wrapper as it includes <zlib.h>
1 parent a45d48c commit ef979cc

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,14 @@ endif()
449449
# Boost (required)
450450
include("${PCL_SOURCE_DIR}/cmake/pcl_find_boost.cmake")
451451

452+
# System zlib (for io-png and nurbs on surface)
453+
option(WITH_SYSTEM_ZLIB "Use system zlib" TRUE)
454+
message(WARNING "WITH_SYSTEM_ZLIB option is deprecated, has no effect and will be removed in 1.18.")
455+
find_package(ZLIB)
456+
if(ZLIB_FOUND)
457+
set(HAVE_ZLIB ON)
458+
endif()
459+
452460
option(WITH_SYSTEM_CJSON "Use system cJSON" TRUE)
453461
if(WITH_SYSTEM_CJSON)
454462
find_package(cJSON)

io/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ set(SUBSYS_EXT_DEPS boost eigen3)
55

66
PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ON)
77
if(WIN32)
8-
PCL_SUBSYS_DEPEND(build NAME ${SUBSYS_NAME} DEPS ${SUBSYS_DEPS} OPT_DEPS openni openni2 ensenso davidSDK dssdk rssdk rssdk2 pcap png vtk OpenMP EXT_DEPS ${SUBSYS_EXT_DEPS})
8+
PCL_SUBSYS_DEPEND(build NAME ${SUBSYS_NAME} DEPS ${SUBSYS_DEPS} OPT_DEPS openni openni2 ensenso davidSDK dssdk rssdk rssdk2 pcap png vtk OpenMP ZLIB EXT_DEPS ${SUBSYS_EXT_DEPS})
99
else()
10-
PCL_SUBSYS_DEPEND(build NAME ${SUBSYS_NAME} DEPS ${SUBSYS_DEPS} OPT_DEPS openni openni2 ensenso davidSDK dssdk pcap png vtk libusb OpenMP EXT_DEPS ${SUBSYS_EXT_DEPS})
10+
PCL_SUBSYS_DEPEND(build NAME ${SUBSYS_NAME} DEPS ${SUBSYS_DEPS} OPT_DEPS openni openni2 ensenso davidSDK dssdk pcap png vtk libusb OpenMP ZLIB EXT_DEPS ${SUBSYS_EXT_DEPS})
1111
endif()
1212

1313
PCL_ADD_DOC("${SUBSYS_NAME}")
@@ -244,7 +244,7 @@ set(srcs
244244
${RSSDK2_GRABBER_SOURCES}
245245
)
246246

247-
if(PNG_FOUND)
247+
if(PNG_FOUND AND ZLIB_FOUND)
248248
list(APPEND srcs
249249
src/libpng_wrapper.cpp
250250
)
@@ -373,6 +373,10 @@ if(PNG_FOUND)
373373
target_link_libraries("${LIB_NAME}" ${PNG_LIBRARIES})
374374
endif()
375375

376+
if(PNG_FOUND AND ZLIB_FOUND)
377+
target_link_libraries("${LIB_NAME}" ZLIB::ZLIB)
378+
endif()
379+
376380
if(LIBUSB_FOUND)
377381
target_link_libraries("${LIB_NAME}" libusb::libusb)
378382
endif()

pcl_config.h.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363

6464
#cmakedefine HAVE_PNG
6565

66+
#cmakedefine HAVE_ZLIB
67+
6668
#cmakedefine HAVE_CJSON
6769

6870
#cmakedefine PCL_PREFER_BOOST_FILESYSTEM

surface/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ if(BUILD_surface_on_nurbs)
6868
include(src/on_nurbs/on_nurbs.cmake)
6969

7070
find_package(ZLIB REQUIRED)
71-
list(APPEND ON_NURBS_LIBRARIES ${ZLIB_LIBRARIES})
7271
list(APPEND SUBSYS_EXT_DEPS zlib)
72+
list(APPEND ON_NURBS_LIBRARIES ZLIB::ZLIB)
7373
endif()
7474

7575
set(POISSON_INCLUDES

surface/src/3rdparty/opennurbs/opennurbs_zlib.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
////////////////////////////////////////////////////////////////
1515
*/
1616

17+
#include <pcl/pcl_config.h> // for HAVE_ZLIB
1718
#include "pcl/surface/3rdparty/opennurbs/opennurbs.h"
1819

1920
bool ON_BinaryArchive::WriteCompressedBuffer(

0 commit comments

Comments
 (0)