Skip to content

Commit

Permalink
Merge pull request #937 from koordinates/pdal-upgrade
Browse files Browse the repository at this point in the history
Upgrade PDAL 2.5.3 -> 2.6.0
  • Loading branch information
olsen232 committed Nov 13, 2023
2 parents 19bce44 + 241ea41 commit 1f6ac79
Show file tree
Hide file tree
Showing 11 changed files with 421 additions and 13 deletions.
5 changes: 2 additions & 3 deletions tests/point_cloud/test_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,8 @@ def test_import_several_laz__convert(
input=f"main {head_sha} main 0000000000000000000000000000000000000000\n",
encoding="utf8",
)
assert (
stdout.splitlines()[0]
== "Running pre-push with --dry-run: found 16 LFS blobs (410KiB) to push"
assert stdout.splitlines()[0].startswith(
"Running pre-push with --dry-run: found 16 LFS blobs"
)

for x in range(4):
Expand Down
12 changes: 2 additions & 10 deletions vcpkg-vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -469,16 +469,8 @@ list(APPEND LIB_LIST ${SPATIALITE_EXTENSION})
find_package(PDAL CONFIG REQUIRED)
pkg_check_modules(PDAL REQUIRED pdal)

get_target_property(PDALUTIL_LIBRARY pdal_util LOCATION)
if(WIN32 OR APPLE)
get_target_property(PDALCPP_LIBRARY pdalcpp LOCATION)
list(APPEND LIB_LIST ${PDALCPP_LIBRARY} ${PDALUTIL_LIBRARY})
else()
get_target_property(PDALBASE_LIBRARY pdal_base LOCATION)
# set(PDALCPP_LIBRARY ${PDAL_LINK_LIBRARIES}) # why is this different on macOS vs Linux? And why
# isn't it a target?
list(APPEND LIB_LIST ${PDALBASE_LIBRARY} ${PDALUTIL_LIBRARY})
endif()
get_target_property(PDALCPP_LIBRARY pdalcpp LOCATION)
list(APPEND LIB_LIST ${PDALCPP_LIBRARY})

set(PDAL_EXECUTABLE "${CURRENT_PACKAGES_DIR}/tools/pdal/pdal${CMAKE_EXECUTABLE_SUFFIX}")
list(APPEND EXE_LIST "${PDAL_EXECUTABLE}")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include(CheckIncludeFileCXX)

check_include_file_cxx("filesystem" HAVE_CXX17_FILESYSTEM)
if(NOT HAVE_CXX17_FILESYSTEM)
message(FATAL_ERROR "Unable to find <filesystem> header. PDAL requires full C++17 compiler support.")
endif()
111 changes: 111 additions & 0 deletions vcpkg-vendor/vcpkg-overlay-ports/pdal/fix-dependency.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5bec0d744..ea519a9db 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -246,7 +246,7 @@ target_link_libraries(${PDAL_LIB_NAME}
PRIVATE
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_DL_LIBS}
- ${GDAL_LIBRARY}
+ ${GDAL_LIBRARIES}
${PROJ_LIBRARIES}
${GEOTIFF_LIBRARY}
${LIBXML2_LIBRARIES}
diff --git a/cmake/zstd.cmake b/cmake/zstd.cmake
index dfe3dc024..42a78d646 100644
--- a/cmake/zstd.cmake
+++ b/cmake/zstd.cmake
@@ -4,7 +4,14 @@
option(WITH_ZSTD
"Build support for compression/decompression with Zstd." TRUE)
if (WITH_ZSTD)
- find_package(ZSTD QUIET)
+ find_package(ZSTD NAMES zstd REQUIRED)
+ set(ZSTD_INCLUDE_DIRS "")
+ if(TARGET zstd::libzstd_static)
+ set(ZSTD_LIBRARIES zstd::libzstd_static)
+ set(ZSTD_STATIC_LIB zstd::libzstd_static)
+ else()
+ set(ZSTD_LIBRARIES zstd::libzstd_shared)
+ endif()
set_package_properties(ZSTD PROPERTIES TYPE
PURPOSE "General compression support")
if (ZSTD_FOUND)
diff --git a/pdal/private/KDImpl.hpp b/pdal/private/KDImpl.hpp
index 473ffba36..db6a7b05f 100644
--- a/pdal/private/KDImpl.hpp
+++ b/pdal/private/KDImpl.hpp
@@ -97,7 +97,7 @@ public:
resultSet.init(&output[0], &out_dist_sqr[0]);

std::array<double, 2> pt { x, y };
- m_index.findNeighbors(resultSet, &pt[0], nanoflann::SearchParams(10));
+ m_index.findNeighbors(resultSet, &pt[0], nanoflann::SearchParameters(10));
return output;
}

@@ -110,14 +110,14 @@ public:
resultSet.init(&indices->front(), &sqr_dists->front());

std::array<double, 2> pt { x, y };
- m_index.findNeighbors(resultSet, &pt[0], nanoflann::SearchParams(10));
+ m_index.findNeighbors(resultSet, &pt[0], nanoflann::SearchParameters(10));
}

PointIdList radius(double const& x, double const& y, double const& r) const
{
PointIdList output;
- std::vector<std::pair<std::size_t, double>> ret_matches;
- nanoflann::SearchParams params;
+ std::vector<nanoflann::ResultItem<std::size_t, double>> ret_matches;
+ nanoflann::SearchParameters params;
params.sorted = true;

std::array<double, 2> pt { x, y };
@@ -217,7 +217,7 @@ public:
// neighbor at the given stride.
nanoflann::KNNResultSet<double, PointId, point_count_t> resultSet(k2);
resultSet.init(&output[0], &out_dist_sqr[0]);
- m_index.findNeighbors(resultSet, &pt[0], nanoflann::SearchParams());
+ m_index.findNeighbors(resultSet, &pt[0], nanoflann::SearchParameters());

// Perform the downsampling if a stride is provided.
if (stride > 1)
@@ -241,14 +241,14 @@ public:
pt.push_back(x);
pt.push_back(y);
pt.push_back(z);
- m_index.findNeighbors(resultSet, &pt[0], nanoflann::SearchParams(10));
+ m_index.findNeighbors(resultSet, &pt[0], nanoflann::SearchParameters(10));
}

PointIdList radius(double x, double y, double z, double r) const
{
PointIdList output;
- std::vector<std::pair<std::size_t, double>> ret_matches;
- nanoflann::SearchParams params;
+ std::vector<nanoflann::ResultItem<std::size_t, double>> ret_matches;
+ nanoflann::SearchParameters params;
params.sorted = true;

std::vector<double> pt { x, y, z };
@@ -315,7 +315,7 @@ public:
// neighbor at the given stride.
nanoflann::KNNResultSet<double, PointId, point_count_t> resultSet(k2);
resultSet.init(&output[0], &out_dist_sqr[0]);
- m_index.findNeighbors(resultSet, &pt[0], nanoflann::SearchParams());
+ m_index.findNeighbors(resultSet, &pt[0], nanoflann::SearchParameters());

// Perform the downsampling if a stride is provided.
if (stride > 1)
@@ -330,8 +330,8 @@ public:
PointIdList radius(PointId idx, double r) const
{
PointIdList output;
- std::vector<std::pair<std::size_t, double>> ret_matches;
- nanoflann::SearchParams params;
+ std::vector<nanoflann::ResultItem<std::size_t, double>> ret_matches;
+ nanoflann::SearchParameters params;
params.sorted = true;

std::vector<double> pt;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/cmake/libraries.cmake b/cmake/libraries.cmake
index afac96030..c4819402c 100644
--- a/cmake/libraries.cmake
+++ b/cmake/libraries.cmake
@@ -1,9 +1,6 @@
# Build shared libraries by default.

set(PDAL_LIB_TYPE "SHARED")
-if (WIN32)
- set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_IMPORT_LIBRARY_SUFFIX})
-endif()


# Must be changed if there is an ABI change. This builds the SONAME
10 changes: 10 additions & 0 deletions vcpkg-vendor/vcpkg-overlay-ports/pdal/install-dimbuilder.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff --git a/dimbuilder/CMakeLists.txt b/dimbuilder/CMakeLists.txt
index 615e2e9..db44505 100644
--- a/dimbuilder/CMakeLists.txt
+++ b/dimbuilder/CMakeLists.txt
@@ -39,3 +39,5 @@ target_link_libraries(dimbuilder
if (MSVC)
target_link_options(dimbuilder PRIVATE /SUBSYSTEM:CONSOLE /ENTRY:mainCRTStartup)
endif(MSVC)
+
+install(TARGETS dimbuilder)
12 changes: 12 additions & 0 deletions vcpkg-vendor/vcpkg-overlay-ports/pdal/no-pkgconfig-requires.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/apps/pdal.pc.in b/apps/pdal.pc.in
index 6885221..cd2136c 100644
--- a/apps/pdal.pc.in
+++ b/apps/pdal.pc.in
@@ -5,7 +5,6 @@ includedir=@CMAKE_INSTALL_PREFIX@/include

Name: PDAL
Description: Point Data Abstraction Library
-Requires: @PKGCONFIG_LIBRARY_DEFINITIONS@
Version: @PDAL_VERSION@
Libs: -L${libdir} -l@PDAL_LIB_NAME@
Cflags: -I${includedir}/pdal @PDAL_CONFIG_DEFINITIONS@
12 changes: 12 additions & 0 deletions vcpkg-vendor/vcpkg-overlay-ports/pdal/no-rpath.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/cmake/rpath.cmake b/cmake/rpath.cmake
index ba486b7..4323a77 100644
--- a/cmake/rpath.cmake
+++ b/cmake/rpath.cmake
@@ -1,6 +1,7 @@
#
# Set options and variable related to OSX rpath.
#
+return()

# per http://www.cmake.org/Wiki/CMake_RPATH_handling
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
129 changes: 129 additions & 0 deletions vcpkg-vendor/vcpkg-overlay-ports/pdal/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO PDAL/PDAL
REF "${VERSION}"
SHA512 66390a6fc6f898f7d7aa05d4a6ec428e9c7d2f6f0c835110bde2f6c452fa78fb5bf8e8db954153566bf771323bbb31d6153056659c536126721bf7561e91794f
HEAD_REF master
PATCHES
fix-dependency.patch
fix-find-library-suffix.patch
no-pkgconfig-requires.patch
no-rpath.patch
install-dimbuilder.patch
)

# Prefer pristine CMake find modules + wrappers and config files from vcpkg.
foreach(package IN ITEMS Curl GeoTIFF ICONV ZSTD)
file(REMOVE "${SOURCE_PATH}/cmake/modules/Find${package}.cmake")
endforeach()

# De-vendoring
file(REMOVE_RECURSE
"${SOURCE_PATH}/vendor/nanoflann"
"${SOURCE_PATH}/vendor/nlohmann"
"${SOURCE_PATH}/pdal/JsonFwd.hpp"
)
file(INSTALL "${CURRENT_INSTALLED_DIR}/include/nanoflann.hpp" DESTINATION "${SOURCE_PATH}/vendor/nanoflann")
file(INSTALL "${CURRENT_INSTALLED_DIR}/include/nlohmann/json.hpp" DESTINATION "${SOURCE_PATH}/vendor/nlohmann/nlohmann")
file(APPEND "${SOURCE_PATH}/vendor/nlohmann/nlohmann/json.hpp" "namespace NL = nlohmann;\n")
file(INSTALL "${CURRENT_INSTALLED_DIR}/include/nlohmann/json_fwd.hpp" DESTINATION "${SOURCE_PATH}/pdal")
file(RENAME "${SOURCE_PATH}/pdal/json_fwd.hpp" "${SOURCE_PATH}/pdal/JsonFwd.hpp")
file(APPEND "${SOURCE_PATH}/pdal/JsonFwd.hpp" "namespace NL = nlohmann;\n")

unset(ENV{OSGEO4W_HOME})

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
draco BUILD_PLUGIN_DRACO
e57 BUILD_PLUGIN_E57
hdf5 BUILD_PLUGIN_HDF
i3s BUILD_PLUGIN_I3S
lzma WITH_LZMA
pgpointcloud BUILD_PLUGIN_PGPOINTCLOUD
zstd WITH_ZSTD
)

if(VCPKG_CROSSCOMPILING)
set(DIMBUILDER_EXECUTABLE "-DDIMBUILDER_EXECUTABLE=${CURRENT_HOST_INSTALLED_DIR}/tools/pdal/dimbuilder${VCPKG_HOST_EXECUTABLE_SUFFIX}")
endif()

vcpkg_find_acquire_program(PKGCONFIG)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
"-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_LIST_DIR}/cmake-project-include.cmake"
-DPDAL_PLUGIN_INSTALL_PATH=.
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
-DWITH_TESTS:BOOL=OFF
-DWITH_COMPLETION:BOOL=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_Libexecinfo:BOOL=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Libunwind:BOOL=ON
-DCMAKE_FIND_FRAMEWORK="NEVER"
${FEATURE_OPTIONS}
${DIMBUILDER_EXECUTABLE}
MAYBE_UNUSED_VARIABLES
PKG_CONFIG_EXECUTABLE
)

vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/PDAL)
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()

# Install and cleanup executables
file(GLOB pdal_unsupported
"${CURRENT_PACKAGES_DIR}/bin/*.bat"
"${CURRENT_PACKAGES_DIR}/bin/pdal-config"
"${CURRENT_PACKAGES_DIR}/debug/bin/*.bat"
"${CURRENT_PACKAGES_DIR}/debug/bin/*.exe"
"${CURRENT_PACKAGES_DIR}/debug/bin/pdal-config"
)
file(REMOVE ${pdal_unsupported})
vcpkg_copy_tools(TOOL_NAMES pdal dimbuilder AUTO_CLEAN)

# Post-install clean-up
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/include/pdal/filters/private/csf"
"${CURRENT_PACKAGES_DIR}/include/pdal/filters/private/miniball"
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)

file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

file(READ "${SOURCE_PATH}/LICENSE.txt" pdal_license)
file(READ "${SOURCE_PATH}/vendor/arbiter/LICENSE" arbiter_license)
file(READ "${SOURCE_PATH}/vendor/kazhdan/PoissonRecon.h" kazhdan_license)
string(REGEX REPLACE "^/\\*\n|\\*/.*\$" "" kazhdan_license "${kazhdan_license}")
file(READ "${SOURCE_PATH}/vendor/lazperf/lazperf.hpp" lazperf_license)
string(REGEX REPLACE "^/\\*\n|\\*/.*\$" "" lazperf_license "${lazperf_license}")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright"
"${pdal_license}
---
Files in vendor/arbiter/:
${arbiter_license}
---
Files in vendor/kazhdan/:
${kazhdan_license}
---
Files in vendor/lazperf/:
${lazperf_license}
---
Files in vendor/eigen:
Most Eigen source code is subject to the terms of the Mozilla Public License
v. 2.0. You can obtain a copy the MPL 2.0 at http://mozilla.org/MPL/2.0/.
Some files included in Eigen are under one of the following licenses:
- Apache License, Version 2.0
- BSD 3-Clause \"New\" or \"Revised\" License
")
9 changes: 9 additions & 0 deletions vcpkg-vendor/vcpkg-overlay-ports/pdal/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The package pdal provides CMake variables:

find_package(PDAL CONFIG REQUIRED)
target_include_directories(main PRIVATE ${PDAL_INCLUDE_DIRS})
target_link_libraries(main PRIVATE ${PDAL_LIBRARIES})

If necessary, override the default plugin search path by setting the
environment variable PDAL_DRIVER_PATH to a list of directories that
pdal should search for plugins.

0 comments on commit 1f6ac79

Please sign in to comment.