proj4 uwp improvments (#18323)

* Remove prior arm/uwp patch since host dependencies now allow for proj database generation, and add a new patch that repairs Win32 API calls to use UWP counterparts in UWP builds

* Update ci baseline for port changes

* Update port version

* Fix patch list for PR

* Bump port-version, disable some broken downstream libs

* Update port version commit
This commit is contained in:
Geoff Evans 2021-09-07 21:02:10 -07:00 committed by GitHub
parent 6a8dea1ace
commit 4d8cf181f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 81 additions and 20 deletions

View File

@ -1,15 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7d736d129..93d7801dd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -269,7 +269,9 @@ endif()
################################################################################
include_directories(${PROJ_SOURCE_DIR}/src)
-add_subdirectory(data)
+if(BUILD_PROJ_DATABASE)
+ add_subdirectory(data)
+endif()
add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(man)

View File

@ -0,0 +1,71 @@
diff --git a/src/filemanager.cpp b/src/filemanager.cpp
index e6a9ed9..d85290b 100644
--- a/src/filemanager.cpp
+++ b/src/filemanager.cpp
@@ -48,6 +48,12 @@
#include "proj_config.h"
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
+#define UWP 1
+#else
+#define UWP 0
+#endif
+
#ifdef _WIN32
#include <shlobj.h>
#include <windows.h>
@@ -692,10 +698,21 @@ std::unique_ptr<File> FileWin32::open(PJ_CONTEXT *ctx, const char *filename,
? FILE_ATTRIBUTE_READONLY
: FILE_ATTRIBUTE_NORMAL;
try {
+#if UWP
+ CREATEFILE2_EXTENDED_PARAMETERS extendedParameters;
+ ZeroMemory(&extendedParameters, sizeof(extendedParameters));
+ extendedParameters.dwSize = sizeof(extendedParameters);
+ extendedParameters.dwFileAttributes = dwFlagsAndAttributes;
+ HANDLE hFile = CreateFile2(
+ UTF8ToWString(std::string(filename)).c_str(), dwDesiredAccess,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ dwCreationDisposition, &extendedParameters);
+#else // UWP
HANDLE hFile = CreateFileW(
UTF8ToWString(std::string(filename)).c_str(), dwDesiredAccess,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr,
dwCreationDisposition, dwFlagsAndAttributes, nullptr);
+#endif // UWP
return std::unique_ptr<File>(hFile != INVALID_HANDLE_VALUE
? new FileWin32(filename, ctx, hFile)
: nullptr);
@@ -1211,6 +1228,9 @@ const char *proj_context_get_user_writable_directory(PJ_CONTEXT *ctx,
wPath.resize(wcslen(wPath.data()));
path = NS_PROJ::WStringToUTF8(wPath);
#else
+#if UWP
+ if (false) {
+#else // UWP
wchar_t *wPath;
if (SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &wPath) ==
S_OK) {
@@ -1218,6 +1238,7 @@ const char *proj_context_get_user_writable_directory(PJ_CONTEXT *ctx,
std::string str = NS_PROJ::WStringToUTF8(ws);
path = str;
CoTaskMemFree(wPath);
+#endif // UWP
#endif
} else {
const char *local_app_data = getenv("LOCALAPPDATA");
@@ -1311,11 +1332,13 @@ static std::string pj_get_relative_share_proj_internal_no_check() {
#if defined(_WIN32) || defined(HAVE_LIBDL)
#ifdef _WIN32
HMODULE hm = NULL;
+#if !UWP
if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPCSTR)&pj_get_relative_share_proj, &hm) == 0) {
return std::string();
}
+#endif // UWP
DWORD path_size = 1024;

View File

@ -5,8 +5,8 @@ vcpkg_from_github(
SHA512 e6e77266dcd70c939c16667c916cccab8de161221d2ef600cfca43382f50da2dc8d790561556b4416adbb4ac6fba939004e0cc936c278e0e808dc3566e9a70d4 SHA512 e6e77266dcd70c939c16667c916cccab8de161221d2ef600cfca43382f50da2dc8d790561556b4416adbb4ac6fba939004e0cc936c278e0e808dc3566e9a70d4
HEAD_REF master HEAD_REF master
PATCHES PATCHES
fix-filemanager-uwp.patch
fix-sqlite3-bin.patch fix-sqlite3-bin.patch
disable-projdb-with-arm-uwp.patch
fix-win-output-name.patch fix-win-output-name.patch
fix-proj4-targets-cmake.patch fix-proj4-targets-cmake.patch
tools-cmake.patch tools-cmake.patch

View File

@ -1,7 +1,7 @@
{ {
"name": "proj4", "name": "proj4",
"version-semver": "7.2.1", "version-semver": "7.2.1",
"port-version": 4, "port-version": 5,
"description": "PROJ.4 library for cartographic projections", "description": "PROJ.4 library for cartographic projections",
"homepage": "https://github.com/OSGeo/PROJ", "homepage": "https://github.com/OSGeo/PROJ",
"dependencies": [ "dependencies": [

View File

@ -546,6 +546,8 @@ libcopp:arm64-windows=fail
libcopp:arm-uwp=fail libcopp:arm-uwp=fail
libcrafter:x86-windows=fail libcrafter:x86-windows=fail
libcrafter:x64-windows=fail libcrafter:x64-windows=fail
libgeotiff:arm-uwp=fail
libgeotiff:x64-uwp=fail
# Missing system libraries on linux to run/prepare autoconf # Missing system libraries on linux to run/prepare autoconf
libgpod:x64-linux=fail libgpod:x64-linux=fail
libgpod:x64-osx=fail libgpod:x64-osx=fail
@ -1235,8 +1237,6 @@ popsift:x64-windows-static-md=fail
portable-snippets:arm-uwp=fail portable-snippets:arm-uwp=fail
pqp:arm-uwp=fail pqp:arm-uwp=fail
pqp:x64-uwp=fail pqp:x64-uwp=fail
proj4:arm-uwp=fail
proj4:x64-uwp=fail
protobuf-c:x86-windows=fail protobuf-c:x86-windows=fail
protobuf-c:x64-windows=fail protobuf-c:x64-windows=fail
protobuf-c:x64-windows-static=fail protobuf-c:x64-windows-static=fail

View File

@ -5134,7 +5134,7 @@
}, },
"proj4": { "proj4": {
"baseline": "7.2.1", "baseline": "7.2.1",
"port-version": 4 "port-version": 5
}, },
"prometheus-cpp": { "prometheus-cpp": {
"baseline": "0.12.3", "baseline": "0.12.3",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "aa22133ae2355b540a2676402896abc323f26aa9",
"version-semver": "7.2.1",
"port-version": 5
},
{ {
"git-tree": "dee626b6811eafe58cf40fbceeb3cc28dfaf678c", "git-tree": "dee626b6811eafe58cf40fbceeb3cc28dfaf678c",
"version-semver": "7.2.1", "version-semver": "7.2.1",