vcpkg/ports/pcl/devendor-zlib.patch
Kai Pastor 0df4519564
[pcl] Devendor zlib, cleanup, enable arm64-windows (#30996)
* [pcl] De-vendor zlib, misc fixes

* WIP

* vcpkg_copy_tools with AUTO_CLEAN

* WIP

* Fix empty executable suffix

* Finish PR

* [glew] arm64 MSVC is unsupported

* [openmvg] x86 family only
2023-04-24 15:31:10 -07:00

77 lines
2.9 KiB
Diff

diff --git a/surface/include/pcl/surface/3rdparty/opennurbs/opennurbs_zlib.h b/surface/include/pcl/surface/3rdparty/opennurbs/opennurbs_zlib.h
index 12787e1..b500233 100644
--- a/surface/include/pcl/surface/3rdparty/opennurbs/opennurbs_zlib.h
+++ b/surface/include/pcl/surface/3rdparty/opennurbs/opennurbs_zlib.h
@@ -31,13 +31,16 @@
#if !defined(Z_PREFIX)
/* decorates zlib functions with a "z_" prefix to prevent symbol collision. */
-#define Z_PREFIX
#endif
+#define z_deflate deflate
+#define z_inflate inflate
+#define z_Bytef Bytef
#if !defined(MY_ZCALLOC)
/* have zlib use oncalloc() and onfree() for memory managment*/
-#define MY_ZCALLOC
#endif
+#define zcalloc pcl_zcalloc
+#define zcfree pcl_zcfree
#include "zlib.h"
diff --git a/surface/src/3rdparty/opennurbs/openNURBS.cmake b/surface/src/3rdparty/opennurbs/openNURBS.cmake
index 51ca678..4ee5192 100644
--- a/surface/src/3rdparty/opennurbs/openNURBS.cmake
+++ b/surface/src/3rdparty/opennurbs/openNURBS.cmake
@@ -102,6 +102,8 @@ set(OPENNURBS_INCLUDES
include/pcl/${SUBSYS_NAME}/3rdparty/opennurbs/opennurbs_workspace.h
include/pcl/${SUBSYS_NAME}/3rdparty/opennurbs/opennurbs_xform.h
include/pcl/${SUBSYS_NAME}/3rdparty/opennurbs/opennurbs_zlib.h
+)
+file(REMOVE
include/pcl/${SUBSYS_NAME}/3rdparty/opennurbs/crc32.h
include/pcl/${SUBSYS_NAME}/3rdparty/opennurbs/deflate.h
include/pcl/${SUBSYS_NAME}/3rdparty/opennurbs/inffast.h
@@ -222,6 +224,8 @@ set(OPENNURBS_SOURCES
src/3rdparty/opennurbs/opennurbs_xform.cpp
src/3rdparty/opennurbs/opennurbs_zlib.cpp
src/3rdparty/opennurbs/opennurbs_zlib_memory.cpp
+)
+file(REMOVE
src/3rdparty/opennurbs/adler32.c
src/3rdparty/opennurbs/compress.c
src/3rdparty/opennurbs/crc32.c
diff --git a/surface/src/3rdparty/opennurbs/opennurbs_zlib.cpp b/surface/src/3rdparty/opennurbs/opennurbs_zlib.cpp
index 688c803..d1bc977 100644
--- a/surface/src/3rdparty/opennurbs/opennurbs_zlib.cpp
+++ b/surface/src/3rdparty/opennurbs/opennurbs_zlib.cpp
@@ -68,7 +68,6 @@
#endif // if WIN64 else WIN32
-#pragma comment(lib, "\"" OPENNURBS_ZLIB_OUTPUT_ROOT_DIR "/" OPENNURBS_CONFIGURATION_DIR "/" OPENNURBS_ZLIB_FILE_NAME "\"")
#endif // ON_DLL_EXPORTS
@@ -641,7 +640,7 @@ struct ON_CompressedBufferHelper
sizeof_x_buffer = 16384
};
unsigned char buffer[sizeof_x_buffer];
- z_stream strm;
+ z_stream strm = []() { z_stream zs; zs.zalloc = zcalloc; zs.zfree = zcfree; return zs; } ();
std::size_t m_buffer_compressed_capacity;
};
diff --git a/surface/src/on_nurbs/on_nurbs.cmake b/surface/src/on_nurbs/on_nurbs.cmake
index 20d4269..a7b5631 100644
--- a/surface/src/on_nurbs/on_nurbs.cmake
+++ b/surface/src/on_nurbs/on_nurbs.cmake
@@ -55,3 +55,5 @@ else()
set(ON_NURBS_SOURCES ${ON_NURBS_SOURCES} src/on_nurbs/nurbs_solve_eigen.cpp)
endif()
+find_package(ZLIB REQUIRED)
+set(ON_NURBS_LIBRARIES ${ON_NURBS_LIBRARIES} ${ZLIB_LIBRARIES})