Skip to content

Commit

Permalink
Use host crssync
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Feb 27, 2024
1 parent 92d266f commit 0731c98
Show file tree
Hide file tree
Showing 23 changed files with 321 additions and 40 deletions.
12 changes: 11 additions & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,17 @@
"ossl"
]
},
"qgis-qt6",
{
"name": "qca",
"default-features": false,
"host": true
},
"qgis",
{
"name": "qgis",
"default-features": false,
"host": true
},
{
"name": "qtbase",
"default-features": false
Expand Down
27 changes: 0 additions & 27 deletions vcpkg/ports/qgis-qt6/crssync.patch

This file was deleted.

159 changes: 159 additions & 0 deletions vcpkg/ports/qgis/56284.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cb8430f3591..ee0788efe7c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -540,7 +540,11 @@ if(WITH_CORE)
endif()

# Password helper
- find_package(QtKeychain REQUIRED)
+ if(BUILD_WITH_QT6)
+ find_package(Qt6Keychain CONFIG REQUIRED)
+ else()
+ find_package(Qt5Keychain CONFIG REQUIRED)
+ endif()
# Master password hash and authentication encryption
find_package(QCA REQUIRED)
# Check for runtime dependency of qca-ossl plugin
diff --git a/cmake/FindQtKeychain.cmake b/cmake/FindQtKeychain.cmake
deleted file mode 100644
index a32ebff397a..00000000000
--- a/cmake/FindQtKeychain.cmake
+++ /dev/null
@@ -1,52 +0,0 @@
-# Find QtKeychain
-# ~~~~~~~~~~~~~~~
-# Copyright (c) 2016, Boundless Spatial
-# Author: Larry Shaffer <lshaffer (at) boundlessgeo (dot) com>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-#
-# CMake module to search for QtKeychain library from:
-# https://github.com/frankosterfeld/qtkeychain
-#
-# If it's found it sets QTKEYCHAIN_FOUND to TRUE
-# and following variables are set:
-# QTKEYCHAIN_INCLUDE_DIR
-# QTKEYCHAIN_LIBRARY
-
-FIND_PATH(QTKEYCHAIN_INCLUDE_DIR keychain.h
- PATHS
- ${LIB_DIR}/include
- "$ENV{LIB_DIR}/include"
- $ENV{INCLUDE}
- /usr/local/include
- /usr/include
- PATH_SUFFIXES ${QT_VERSION_BASE_LOWER}keychain qtkeychain
-)
-
-FIND_LIBRARY(QTKEYCHAIN_LIBRARY NAMES ${QT_VERSION_BASE_LOWER}keychain qtkeychain
- PATHS
- ${LIB_DIR}
- "$ENV{LIB_DIR}"
- $ENV{LIB_DIR}/lib
- $ENV{LIB}
- /usr/local/lib
- /usr/lib
-)
-
-
-IF (QTKEYCHAIN_INCLUDE_DIR AND QTKEYCHAIN_LIBRARY)
- SET(QTKEYCHAIN_FOUND TRUE)
-ELSE()
- SET(QTKEYCHAIN_FOUND FALSE)
-ENDIF (QTKEYCHAIN_INCLUDE_DIR AND QTKEYCHAIN_LIBRARY)
-
-IF (QTKEYCHAIN_FOUND)
- IF (NOT QTKEYCHAIN_FIND_QUIETLY)
- MESSAGE(STATUS "Found QtKeychain: ${QTKEYCHAIN_LIBRARY}")
- ENDIF (NOT QTKEYCHAIN_FIND_QUIETLY)
-ELSE (QTKEYCHAIN_FOUND)
- IF (QTKEYCHAIN_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "Could not find QtKeychain")
- ENDIF (QTKEYCHAIN_FIND_REQUIRED)
-ENDIF (QTKEYCHAIN_FOUND)
diff --git a/external/o2/src/o0keychainstore.cpp b/external/o2/src/o0keychainstore.cpp
index 2fe1d0e1ea9..d22591dce44 100644
--- a/external/o2/src/o0keychainstore.cpp
+++ b/external/o2/src/o0keychainstore.cpp
@@ -4,7 +4,11 @@
#include "o0keychainstore.h"

#include <QDebug>
-#include <keychain.h>
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+#include <qt6keychain/keychain.h>
+#else
+#include <qt5keychain/keychain.h>
+#endif
#include <QtCore/QDataStream>
#include <QtCore/QBuffer>
#include <QtCore/QEventLoop>
diff --git a/src/auth/oauth2/CMakeLists.txt b/src/auth/oauth2/CMakeLists.txt
index 6bb0c665327..a9e2cfeddc3 100644
--- a/src/auth/oauth2/CMakeLists.txt
+++ b/src/auth/oauth2/CMakeLists.txt
@@ -3,9 +3,6 @@
########################################################
# Packages

-if(NOT QTKEYCHAIN_FOUND)
- find_package(QtKeychain REQUIRED)
-endif()
option(WITH_INTERNAL_O2 "Download and locally include source of o2 library" ON)

if(WITH_INTERNAL_O2)
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index a802a8f6431..56f9c9e96aa 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -2416,6 +2416,16 @@ target_link_libraries(qgis_core
PROJ::proj
)

+if(BUILD_WITH_QT6)
+target_link_libraries(qgis_core
+ Qt6Keychain::Qt6Keychain
+)
+else()
+target_link_libraries(qgis_core
+ Qt5Keychain::Qt5Keychain
+)
+endif()
+
if (WITH_DRACO)
target_link_libraries(qgis_core ${DRACO_LIBRARY})
endif()
diff --git a/src/core/auth/qgsauthmanager.cpp b/src/core/auth/qgsauthmanager.cpp
index 5948df209df..429c3e58b42 100644
--- a/src/core/auth/qgsauthmanager.cpp
+++ b/src/core/auth/qgsauthmanager.cpp
@@ -47,9 +47,6 @@
#include <QSslConfiguration>
#endif

-// QtKeyChain library
-#include "keychain.h"
-
// QGIS includes
#include "qgsauthcertutils.h"
#include "qgsauthcrypto.h"
diff --git a/src/core/auth/qgsauthmanager.h b/src/core/auth/qgsauthmanager.h
index 6ab376d35ba..a29cc5b74ec 100644
--- a/src/core/auth/qgsauthmanager.h
+++ b/src/core/auth/qgsauthmanager.h
@@ -38,8 +38,11 @@
#include "qgsauthconfig.h"
#include "qgsauthmethod.h"

-// Qt5KeyChain library
-#include "keychain.h"
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+#include <qt6keychain/keychain.h>
+#else
+#include <qt5keychain/keychain.h>
+#endif

#ifndef SIP_RUN
namespace QCA
18 changes: 18 additions & 0 deletions vcpkg/ports/qgis/androidextras.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --color -Naur b/CMakeLists.txt QGIS-final-3_28_0/CMakeLists.txt
--- b/CMakeLists.txt 2022-10-22 19:08:22.563229185 +0200
+++ QGIS-final-3_28_0/CMakeLists.txt 2022-10-22 19:11:24.686948005 +0200
@@ -493,11 +493,11 @@
else()
message(STATUS "Found Qt version: ${Qt5Core_VERSION_STRING}")
endif()
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Android" AND NOT BUILD_WITH_QT6)
+ find_package(${QT_VERSION_BASE} COMPONENTS AndroidExtras)
+ endif()
if (WITH_QUICK)
find_package(${QT_VERSION_BASE} COMPONENTS Qml Quick REQUIRED)
- if(${CMAKE_SYSTEM_NAME} MATCHES "Android" AND NOT BUILD_WITH_QT6)
- find_package(${QT_VERSION_BASE} COMPONENTS AndroidExtras)
- endif()

# following variable is used in qgsconfig.h
set (HAVE_QUICK TRUE)
File renamed without changes.
12 changes: 12 additions & 0 deletions vcpkg/ports/qgis/crssync-no-install.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/src/crssync/CMakeLists.txt b/src/crssync/CMakeLists.txt
index 278272161a9..d29045fae55 100644
--- a/src/crssync/CMakeLists.txt
+++ b/src/crssync/CMakeLists.txt
@@ -26,7 +26,4 @@ else ()
)
endif()

- install(CODE "message(\"Installing crssync ...\")")
- install(TARGETS crssync RUNTIME DESTINATION ${QGIS_LIBEXEC_DIR})
-
endif()
File renamed without changes.
File renamed without changes.
File renamed without changes.
65 changes: 65 additions & 0 deletions vcpkg/ports/qgis/poly2tri1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2318388f5086..368c86b65476 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -398,7 +398,7 @@ if(WITH_CORE)
endif()

if (NOT WITH_INTERNAL_POLY2TRI)
- find_package(Poly2Tri REQUIRED)
+ find_package(poly2tri REQUIRED)
endif()

if (WITH_SPATIALITE)
diff --git a/cmake/FindPoly2Tri.cmake b/cmake/FindPoly2Tri.cmake
deleted file mode 100644
index 87fb34f3475b..000000000000
--- a/cmake/FindPoly2Tri.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-# Find Poly2Tri
-# ~~~~~~~~~
-# Copyright (c) 2020, Peter Petrik <zilolv at gmail dot com>
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-#
-#
-# Once run this will define:
-# Poly2Tri_FOUND - System has Poly2Tri
-# Poly2Tri_INCLUDE_DIR - The Poly2Tri include directory
-# Poly2Tri_LIBRARY - The library needed to use Poly2Tri
-
-find_path(Poly2Tri_INCLUDE_DIR poly2tri.h
- HINTS $ENV{LIB_DIR}/include)
-
-find_library(Poly2Tri_LIBRARY NAMES poly2tri libpoly2tri
- HINTS $ENV{LIB_DIR}/lib)
-
-include(FindPackageHandleStandardArgs)
-
-find_package_handle_standard_args(Poly2Tri DEFAULT_MSG
- Poly2Tri_LIBRARY Poly2Tri_INCLUDE_DIR)
-
-mark_as_advanced( Poly2Tri_INCLUDE_DIR Poly2Tri_LIBRARY )
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 1dd8bfa49bf3..9b3229480ea7 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -973,8 +973,6 @@ if (WITH_INTERNAL_POLY2TRI)
${CMAKE_SOURCE_DIR}/external/poly2tri/sweep/sweep.cc
)
include_directories(${CMAKE_SOURCE_DIR}/external/poly2tri)
-else ()
- include_directories(${Poly2Tri_INCLUDE_DIR})
endif ()

file(GLOB JSON_HELP_FILES "${CMAKE_SOURCE_DIR}/resources/function_help/json/*")
@@ -2347,7 +2345,7 @@ if(ENABLE_MODELTEST)
endif()

if (NOT WITH_INTERNAL_POLY2TRI)
- target_link_libraries(qgis_core ${Poly2Tri_LIBRARY})
+ target_link_libraries(qgis_core poly2tri::poly2tri)
endif()

if(HAVE_OPENCL)
37 changes: 37 additions & 0 deletions vcpkg/ports/qgis/poly2tri2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git a/cmake/Findpoly2tri.cmake b/cmake/Findpoly2tri.cmake
new file mode 100644
index 000000000000..8e3c8030ac53
--- /dev/null
+++ b/cmake/Findpoly2tri.cmake
@@ -0,0 +1,31 @@
+# Find poly2tri
+# ~~~~~~~~~~~~~
+# Copyright (c) 2020, Peter Petrik <zilolv at gmail dot com>
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+#
+# Once run this will define:
+# poly2tri_FOUND - System has poly2tri
+# poly2tri::poly2tri - Target
+
+find_package(poly2tri CONFIG)
+if(NOT poly2tri_FOUND)
+ find_path(poly2tri_INCLUDE_DIR poly2tri.h
+ HINTS $ENV{LIB_DIR}/include)
+
+ find_library(poly2tri_LIBRARY NAMES poly2tri libpoly2tri
+ HINTS $ENV{LIB_DIR}/lib)
+
+ include(FindPackageHandleStandardArgs)
+
+ find_package_handle_standard_args(poly2tri DEFAULT_MSG
+ poly2tri_LIBRARY poly2tri_INCLUDE_DIR)
+
+
+ add_library(poly2tri::poly2tri UNKNOWN IMPORTED)
+ target_link_libraries(poly2tri::poly2tri INTERFACE ${poly2tri_LIBRARY})
+ target_include_directories(poly2tri::poly2tri INTERFACE ${poly2tri_INCLUDE_DIR})
+ set_target_properties(poly2tri::poly2tri PROPERTIES IMPORTED_LOCATION ${poly2tri_LIBRARY})
+ mark_as_advanced(poly2tri_INCLUDE_DIR poly2tri_LIBRARY)
+endif()
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ vcpkg_from_github(
qgspython.patch # Make qgis support python's debug library
libxml2.patch
exiv2.patch
crssync.patch
bigobj.patch
mesh.patch
wrongattributeerrormessage.patch
sts.patch # Obsolete in QGIS >= 3.36.1
crssync-no-install.patch
)

file(REMOVE ${SOURCE_PATH}/cmake/FindGDAL.cmake)
Expand Down Expand Up @@ -137,9 +137,6 @@ if(VCPKG_TARGET_IS_WINDOWS)
FIND_LIB_OPTIONS(GDAL gdal gdald LIBRARY ${VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX})
FIND_LIB_OPTIONS(POSTGRES libpq libpq LIBRARY ${VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX})
FIND_LIB_OPTIONS(QCA qca qcad LIBRARY ${VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX})
if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
FIND_LIB_OPTIONS(ZSTD zstd_static zstd_staticd LIBRARY ${VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX})
endif()
if("server" IN_LIST FEATURES)
FIND_LIB_OPTIONS(FCGI libfcgi libfcgi LIBRARY ${VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX})
list(APPEND QGIS_OPTIONS -DFCGI_INCLUDE_DIR="${CURRENT_INSTALLED_DIR}/include/fastcgi")
Expand Down Expand Up @@ -225,6 +222,11 @@ if(VCPKG_TARGET_IS_WINDOWS)
copy_path(svg share)
endif()

# crssync only runs when building natively. If we are cross-compiling, copy the srs.cb from the host installation.
if(NOT HOST_TRIPLET STREQUAL TARGET_TRIPLET)
file(COPY "${CURRENT_HOST_INSTALLED_DIR}/share/qgis/resources/srs.db" DESTINATION "${CURRENT_PACKAGES_DIR}/share/qgis/resources")
endif()

file(GLOB QGIS_CMAKE_PATH ${CURRENT_PACKAGES_DIR}/*.cmake)
if(QGIS_CMAKE_PATH)
file(COPY ${QGIS_CMAKE_PATH} DESTINATION ${CURRENT_PACKAGES_DIR}/share/cmake/qgis)
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
{
"name": "qgis-qt6",
"name": "qgis",
"version-string": "current",
"homepage": "https://qgis.org",
"description": "QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)",
"dependencies": [
"expat",
{
"name": "qgis",
"host": true,
"default-features": false
},
"draco",
"libxml2",
"libzip",
Expand Down
Loading

0 comments on commit 0731c98

Please sign in to comment.