git: 38181eafc218 - main - graphics/qgis-ltr: fix build against pdal 2.6.3

From: Loïc Bartoletti <lbartoletti_at_FreeBSD.org>
Date: Sat, 24 Feb 2024 05:24:14 UTC
The branch main has been updated by lbartoletti:

URL: https://cgit.FreeBSD.org/ports/commit/?id=38181eafc218f1aaeba262f6d0a9e0089e1814ce

commit 38181eafc218f1aaeba262f6d0a9e0089e1814ce
Author:     Loïc Bartoletti <lbartoletti@FreeBSD.org>
AuthorDate: 2024-02-22 21:14:10 +0000
Commit:     Loïc Bartoletti <lbartoletti@FreeBSD.org>
CommitDate: 2024-02-24 05:23:53 +0000

    graphics/qgis-ltr: fix build against pdal 2.6.3
---
 graphics/qgis-ltr/Makefile                         |  4 +-
 graphics/qgis-ltr/files/patch-cmake_FindPDAL.cmake | 83 ++++++++++++++++++++++
 2 files changed, 85 insertions(+), 2 deletions(-)

diff --git a/graphics/qgis-ltr/Makefile b/graphics/qgis-ltr/Makefile
index ad0eff27a3d5..b95dc84e5e0c 100644
--- a/graphics/qgis-ltr/Makefile
+++ b/graphics/qgis-ltr/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	qgis
 DISTVERSION=	3.28.15
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	graphics geography
 MASTER_SITES=	https://qgis.org/downloads/
 PKGNAMESUFFIX=	-ltr
@@ -43,7 +43,7 @@ LIB_DEPENDS=	libexiv2.so:graphics/exiv2 \
 		libmdal.so:math/mdal \
 		libnetcdf.so:science/netcdf \
 		libOpenCL.so:devel/ocl-icd \
-		libpdal_base.so:math/pdal \
+		libpdalcpp.so:math/pdal \
 		libproj.so:graphics/proj \
 		libprotobuf-lite.so:devel/protobuf \
 		libqjson-qt5.so:devel/qjson \
diff --git a/graphics/qgis-ltr/files/patch-cmake_FindPDAL.cmake b/graphics/qgis-ltr/files/patch-cmake_FindPDAL.cmake
new file mode 100644
index 000000000000..8e3ebf2b787e
--- /dev/null
+++ b/graphics/qgis-ltr/files/patch-cmake_FindPDAL.cmake
@@ -0,0 +1,83 @@
+--- cmake/FindPDAL.cmake.orig	2024-02-22 21:12:12 UTC
++++ cmake/FindPDAL.cmake
+@@ -7,8 +7,7 @@
+ # CMake module to search for PDAL library
+ #
+ # If it's found it sets PDAL_FOUND to TRUE
+-# and following variables are set:
+-#    PDAL_INCLUDE_DIR
++# and adds the following variable containing library target(s):
+ #    PDAL_LIBRARIES
+ 
+ # FIND_PATH and FIND_LIBRARY normally search standard locations
+@@ -18,6 +17,28 @@
+ # locations. When an earlier FIND_* succeeds, subsequent FIND_*s
+ # searching for the same item do nothing.
+ 
++find_package(PDAL CONFIG)
++
++if(PDAL_FOUND)
++  if(NOT PDAL_FIND_QUIETLY)
++    message(STATUS "Found PDAL: ${PDAL_LIBRARIES} (${PDAL_VERSION})")
++  endif()
++
++  if(PDAL_VERSION VERSION_LESS "1.7.0")
++    message(FATAL_ERROR "PDAL version is too old (${PDAL_VERSION}). Use 1.7 or higher.")
++  endif()
++
++  if(MSVC)
++    foreach(PDAL_TARG ${PDAL_LIBRARIES})
++      target_compile_definitions(${PDAL_TARG} INTERFACE WIN32_LEAN_AND_MEAN)
++    endforeach()
++  endif()
++
++  return()
++endif()
++
++# Fallback for systems where PDAL's config-file package is not present.
++# It is not adapted for PDAL 2.6+ (where pdal_util library is removed).
+ FIND_PATH(PDAL_INCLUDE_DIR pdal/pdal.hpp
+   "$ENV{LIB_DIR}/include"
+   "/usr/include"
+@@ -50,7 +71,7 @@ IF (PDAL_INCLUDE_DIR AND PDAL_CPP_LIBRARY AND PDAL_UTI
+ 
+ IF (PDAL_INCLUDE_DIR AND PDAL_CPP_LIBRARY AND PDAL_UTIL_LIBRARY AND PDAL_BIN)
+    SET(PDAL_FOUND TRUE)
+-   SET(PDAL_LIBRARIES ${PDAL_CPP_LIBRARY} ${PDAL_UTIL_LIBRARY})
++   SET(PDAL_LIBRARIES pdalcpp pdal_util)
+ ENDIF (PDAL_INCLUDE_DIR AND PDAL_CPP_LIBRARY AND PDAL_UTIL_LIBRARY AND PDAL_BIN)
+ 
+ IF (PDAL_FOUND)
+@@ -60,8 +81,8 @@ IF (PDAL_FOUND)
+ 	OUTPUT_VARIABLE PDAL_VERSION_OUT )
+     STRING(REGEX REPLACE "^.*([0-9]+)\\.([0-9]+)\\.([0-9]+).*$" "\\1" PDAL_VERSION_MAJOR "${PDAL_VERSION_OUT}")
+     STRING(REGEX REPLACE "^.*([0-9]+)\\.([0-9]+)\\.([0-9]+).*$" "\\2" PDAL_VERSION_MINOR "${PDAL_VERSION_OUT}")
+-    STRING(REGEX REPLACE "^.*([0-9]+)\\.([0-9]+)\\.([0-9]+).*$" "\\3" PDAL_VERSION_MICRO "${PDAL_VERSION_OUT}")
+-    STRING(CONCAT PDAL_VERSION ${PDAL_VERSION_MAJOR} "." ${PDAL_VERSION_MINOR} "." ${PDAL_VERSION_MICRO})
++    STRING(REGEX REPLACE "^.*([0-9]+)\\.([0-9]+)\\.([0-9]+).*$" "\\3" PDAL_VERSION_PATCH "${PDAL_VERSION_OUT}")
++    STRING(CONCAT PDAL_VERSION ${PDAL_VERSION_MAJOR} "." ${PDAL_VERSION_MINOR} "." ${PDAL_VERSION_PATCH})
+ 
+    IF (NOT PDAL_FIND_QUIETLY)
+       MESSAGE(STATUS "Found PDAL: ${PDAL_LIBRARIES} (${PDAL_VERSION})")
+@@ -70,6 +91,21 @@ IF (PDAL_FOUND)
+    IF ((PDAL_VERSION_MAJOR EQUAL 1) AND (PDAL_VERSION_MINOR LESS 7))
+       MESSAGE (FATAL_ERROR "PDAL version is too old (${PDAL_VERSION}). Use 1.7 or higher.")
+    ENDIF()
++
++   add_library(pdalcpp UNKNOWN IMPORTED)
++   target_link_libraries(pdalcpp INTERFACE ${PDAL_CPP_LIBRARY})
++   target_include_directories(pdalcpp INTERFACE ${PDAL_INCLUDE_DIR})
++   set_target_properties(pdalcpp PROPERTIES IMPORTED_LOCATION ${PDAL_CPP_LIBRARY})
++
++   add_library(pdal_util UNKNOWN IMPORTED)
++   target_link_libraries(pdal_util INTERFACE ${PDAL_UTIL_LIBRARY})
++   target_include_directories(pdal_util INTERFACE ${PDAL_INCLUDE_DIR})
++   set_target_properties(pdal_util PROPERTIES IMPORTED_LOCATION ${PDAL_UTIL_LIBRARY})
++
++   if(MSVC)
++     target_compile_definitions(pdalcpp INTERFACE WIN32_LEAN_AND_MEAN)
++     target_compile_definitions(pdal_util INTERFACE WIN32_LEAN_AND_MEAN)
++   endif()
+ 
+ ELSE (PDAL_FOUND)
+    IF (PDAL_FIND_REQUIRED)