Skip to content

Commit

Permalink
Build Kart with a 2.5-based branch of PDAL...
Browse files Browse the repository at this point in the history
but with extra cherrypicks - the following PRs:

(Using a 2.6-based PDAL requires even more changes that I haven't
yet dealt with).
  • Loading branch information
olsen232 committed Sep 25, 2023
1 parent bfd3644 commit 45b64d9
Show file tree
Hide file tree
Showing 12 changed files with 375 additions and 0 deletions.
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()
33 changes: 33 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,33 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1705a8426..248edcd38 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -269,7 +269,7 @@ target_link_libraries(${PDAL_BASE_LIB_NAME}
PRIVATE
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_DL_LIBS}
- ${GDAL_LIBRARY}
+ ${GDAL_LIBRARIES}
${GEOTIFF_LIBRARY}
${LIBXML2_LIBRARIES}
${ZLIB_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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
diff --git a/cmake/libraries.cmake b/cmake/libraries.cmake
index 665bc53..fcdcf2c 100644
--- a/cmake/libraries.cmake
+++ b/cmake/libraries.cmake
@@ -1,6 +1,3 @@
# Build shared libraries by default.

set(PDAL_LIB_TYPE "SHARED")
-if (WIN32)
- set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_IMPORT_LIBRARY_SUFFIX})
-endif()
12 changes: 12 additions & 0 deletions vcpkg-vendor/vcpkg-overlay-ports/pdal/fix-gcc-13-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/plugins/e57/libE57Format/include/E57Format.h b/plugins/e57/libE57Format/include/E57Format.h
index 267d8c77bb..89d2b36a09 100644
--- a/plugins/e57/libE57Format/include/E57Format.h
+++ b/plugins/e57/libE57Format/include/E57Format.h
@@ -31,6 +31,7 @@

//! @file E57Format.h header file for the E57 API

+#include <cstdint>
#include <cfloat>
#include <memory>
#include <vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1705a8426..d13d41786 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -192,7 +192,7 @@ add_subdirectory(apps)
# so that users only need link libpdalcpp.
#
if (APPLE)
- set(PDAL_REEXPORT "-Wl,-reexport_library,$<TARGET_FILE:${PDAL_UTIL_LIB_NAME}>")
+ set(PDAL_REEXPORT "-Wl$<COMMA>-reexport_library$<COMMA>$<TARGET_FILE:${PDAL_UTIL_LIB_NAME}>")
#
# This allows the rpath reference for the reexported library (above) to
# be found.
22 changes: 22 additions & 0 deletions vcpkg-vendor/vcpkg-overlay-ports/pdal/gdal-3.7.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/pdal/Geometry.cpp b/pdal/Geometry.cpp
index 608bf86..8b010d3 100644
--- a/pdal/Geometry.cpp
+++ b/pdal/Geometry.cpp
@@ -153,7 +153,7 @@ Geometry& Geometry::operator=(const Geometry& input)

bool Geometry::srsValid() const
{
- OGRSpatialReference *srs = m_geom->getSpatialReference();
+ const OGRSpatialReference *srs = m_geom->getSpatialReference();
return srs && srs->GetRoot();
}

@@ -172,7 +172,7 @@ Utils::StatusWithReason Geometry::transform(SpatialReference out)
return StatusWithReason(-2,
"Geometry::transform() failed. NULL target SRS.");

- OGRSpatialReference *inSrs = m_geom->getSpatialReference();
+ const OGRSpatialReference *inSrs = m_geom->getSpatialReference();
SrsTransform transform(*inSrs, OGRSpatialReference(out.getWKT().data()));
if (m_geom->transform(transform.get()) != OGRERR_NONE)
return StatusWithReason(-1, "Geometry::transform() failed.");
13 changes: 13 additions & 0 deletions vcpkg-vendor/vcpkg-overlay-ports/pdal/mingw.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/io/OptechReader.cpp b/io/OptechReader.cpp
index bd12e70..2b7846b 100644
--- a/io/OptechReader.cpp
+++ b/io/OptechReader.cpp
@@ -60,7 +60,7 @@ std::string OptechReader::getName() const
return s_info.name;
}

-#ifndef _WIN32
+#ifndef _MSC_VER
const size_t OptechReader::MaximumNumberOfReturns;
const size_t OptechReader::MaxNumRecordsInBuffer;
const size_t OptechReader::NumBytesInRecord;
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)
123 changes: 123 additions & 0 deletions vcpkg-vendor/vcpkg-overlay-ports/pdal/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO koordinates/PDAL
REF kart-v0.14.2
SHA512 721010c6842a841e8a7d4db543022669ea818e78c87f468d672b1fd77f445897735135508e5b060d17a5b88456eea3a4a66c0c258ac418d995a07ad2804c3fa3
HEAD_REF kart-v0.14.2
PATCHES
fix-dependency.patch
fix-unix-compiler-options.patch
fix-find-library-suffix.patch
no-pkgconfig-requires.patch
no-rpath.patch
fix-gcc-13-build.patch #upstream PR: https://github.com/PDAL/PDAL/pull/4039
gdal-3.7.patch
mingw.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
)
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
${FEATURE_OPTIONS}
)

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 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.
109 changes: 109 additions & 0 deletions vcpkg-vendor/vcpkg-overlay-ports/pdal/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"name": "pdal",
"version": "2.5.3",
"port-version": 1,
"description": "PDAL - Point Data Abstraction Library is a library for manipulating point cloud data.",
"homepage": "https://pdal.io/",
"license": null,
"supports": "!(windows & staticcrt)",
"dependencies": [
{
"name": "curl",
"default-features": false
},
{
"name": "gdal",
"default-features": false
},
"libgeotiff",
{
"name": "libxml2",
"features": [
"http"
]
},
"nanoflann",
"nlohmann-json",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"default-features": [
"supported-plugins"
],
"features": {
"draco": {
"description": "Build the Draco plugin",
"dependencies": [
"draco"
]
},
"e57": {
"description": "Build the E57 plugin",
"dependencies": [
"xerces-c"
]
},
"hdf": {
"description": "Build the HDF plugin",
"dependencies": [
{
"name": "hdf5",
"default-features": false
}
]
},
"i3s": {
"description": "Build the SLPK/I3S plugins",
"dependencies": [
"zlib"
]
},
"liblzma": {
"description": "Support for compression/decompression with LZMA",
"dependencies": [
"liblzma"
]
},
"pgpointcloud": {
"description": "Build the PgPointCloud plugin",
"dependencies": [
"libpq"
]
},
"supported-plugins": {
"description": "Default set of plugins, dependent on platform",
"dependencies": [
{
"name": "pdal",
"default-features": false,
"features": [
"draco",
"e57",
"i3s"
]
},
{
"name": "pdal",
"default-features": false,
"features": [
"hdf",
"pgpointcloud"
],
"platform": "!uwp"
}
]
},
"zstd": {
"description": "Support for ZSTD compression/decompression",
"dependencies": [
"zstd"
]
}
}
}

0 comments on commit 45b64d9

Please sign in to comment.