Skip to content

Commit

Permalink
[proj, proj4] Update to PROJ 9.0.0 & make proj the regular port (#23186)
Browse files Browse the repository at this point in the history
* Update to PROJ 9.0.0 & make proj the regular port

* Consolidate files in share, move data to subdir

* Update versions

* Update proj to 9.0.0 RC2

* Add license fields

* Update versions

* Update to PROJ 9.0.0 release

* Update versions

* Update versions
  • Loading branch information
dg0yt authored Mar 9, 2022
1 parent 857bccd commit fb34164
Show file tree
Hide file tree
Showing 24 changed files with 200 additions and 205 deletions.
4 changes: 2 additions & 2 deletions ports/gdal/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gdal",
"version-semver": "3.4.1",
"port-version": 3,
"port-version": 4,
"description": "The Geographic Data Abstraction Library for reading and writing geospatial raster and vector data",
"homepage": "https://gdal.org",
"license": null,
Expand Down Expand Up @@ -29,7 +29,7 @@
"libwebp",
"libxml2",
"openjpeg",
"proj4",
"proj",
"sqlite3",
"tiff",
{
Expand Down
4 changes: 3 additions & 1 deletion ports/libgeotiff/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"name": "libgeotiff",
"version": "1.7.0",
"port-version": 1,
"description": "Libgeotiff is an open source library on top of libtiff for reading and writing GeoTIFF information tags.",
"homepage": "https://github.com/OSGeo/libgeotiff",
"license": "MIT",
"dependencies": [
"proj4",
"proj",
{
"name": "tiff",
"default-features": false
Expand Down
4 changes: 3 additions & 1 deletion ports/libosmium/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"name": "libosmium",
"version-semver": "2.17.1",
"port-version": 1,
"description": "A fast and flexible C++ library for working with OpenStreetMap data",
"homepage": "https://osmcode.org/libosmium/",
"license": "BSL-1.0",
"dependencies": [
"boost",
"bzip2",
"expat",
"proj4",
"proj",
"protozero",
"utfcpp",
{
Expand Down
5 changes: 3 additions & 2 deletions ports/libspatialite/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "libspatialite",
"version": "5.0.1",
"port-version": 3,
"port-version": 4,
"description": "SpatiaLite is an open source library intended to extend the SQLite core to support fully fledged Spatial SQL capabilities.",
"homepage": "https://www.gaia-gis.it/gaia-sins/libspatialite-sources",
"license": "MPL-1.1 OR GPL-2.0-or-later OR LGPL-2.1-or-later",
"dependencies": [
"geos",
"libiconv",
"libxml2",
"proj4",
"proj",
{
"name": "sqlite3",
"default-features": false,
Expand Down
3 changes: 2 additions & 1 deletion ports/mapnik/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "mapnik",
"version-date": "2022-01-28",
"port-version": 1,
"description": "Mapnik is an open source toolkit for developing mapping applications.",
"homepage": "https://github.com/mapnik/mapnik",
"license": "LGPL-2.1-only",
Expand Down Expand Up @@ -157,7 +158,7 @@
"proj": {
"description": "PROJ Functionalities",
"dependencies": [
"proj4"
"proj"
]
},
"svg-renderer": {
Expand Down
File renamed without changes.
File renamed without changes.
70 changes: 69 additions & 1 deletion ports/proj/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1 +1,69 @@
SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO OSGeo/PROJ
REF 9.0.0
SHA512 f11a20e9f9615c513755f54ac400cc2e144e40caa91f616c8f640aef9caf779487dc94927b3a4b57b15a595c17b70636b872d9a77d7baaf912b1a507004e6520
HEAD_REF master
PATCHES
fix-win-output-name.patch
fix-proj4-targets-cmake.patch
tools-cmake.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
net ENABLE_CURL
tiff ENABLE_TIFF
tools BUILD_APPS
)

vcpkg_list(SET TOOL_NAMES cct cs2cs geod gie invgeod invproj proj projinfo projsync)
if("tools" IN_LIST FEATURES AND NOT "net" IN_LIST FEATURES)
set(BUILD_PROJSYNC OFF)
vcpkg_list(APPEND FEATURE_OPTIONS -DBUILD_PROJSYNC=${BUILD_PROJSYNC})
vcpkg_list(REMOVE_ITEM TOOL_NAMES projsync)
endif()

find_program(EXE_SQLITE3 NAMES "sqlite3" PATHS "${CURRENT_HOST_INSTALLED_DIR}/tools" NO_DEFAULT_PATH REQUIRED)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DNLOHMANN_JSON=external
-DPROJ_LIB_SUBDIR=lib
-DPROJ_INCLUDE_SUBDIR=include
-DPROJ_DATA_SUBDIR=share/${PORT}/data
-DBUILD_TESTING=OFF
"-DEXE_SQLITE3=${EXE_SQLITE3}"
)

vcpkg_cmake_install()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
# Enforce consistency with src/lib_proj.cmake build time configuration.
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/proj.h"
"#ifndef PROJ_DLL"
"#ifndef PROJ_DLL\n# define PROJ_DLL\n#elif 0"
)
endif()

vcpkg_cmake_config_fixup(PACKAGE_NAME proj4 CONFIG_PATH lib/cmake/proj4 DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/proj)

if ("tools" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES ${TOOL_NAMES} AUTO_CLEAN)
endif ()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

vcpkg_copy_pdbs()

vcpkg_fixup_pkgconfig()
if(NOT DEFINED VCPKG_BUILD_TYPE AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/proj.pc" " -lproj" " -lproj_d")
endif()

file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
10 changes: 5 additions & 5 deletions ports/proj4/tools-cmake.patch → ports/proj/tools-cmake.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
diff --git a/src/apps/CMakeLists.txt b/src/apps/CMakeLists.txt
index 534bc311b..f9fb0f1bb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
--- a/src/apps/CMakeLists.txt
+++ b/src/apps/CMakeLists.txt
@@ -83,10 +83,3 @@ if(BUILD_PROJSYNC)
endif()

# global configurations for all apps

-if(MSVC OR CMAKE_CONFIGURATION_TYPES)
- if(BIN_TARGETS)
- # Add _d suffix for your debug versions of the tools
- # Add _d suffix for debug versions of the apps
- set_target_properties(${BIN_TARGETS} PROPERTIES
- DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
- endif()
Expand Down
2 changes: 1 addition & 1 deletion ports/proj4/usage → ports/proj/usage
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The package proj4 provides CMake targets:
The package proj provides CMake targets:

find_package(PROJ CONFIG REQUIRED)
target_link_libraries(main PRIVATE PROJ::proj)
58 changes: 53 additions & 5 deletions ports/proj/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,57 @@
{
"name": "proj",
"version-string": "0",
"port-version": 1,
"description": "a stub package that pulls in proj4. Do not depend on this package.",
"version": "9.0.0",
"description": "PROJ library for cartographic projections",
"homepage": "https://proj.org/",
"license": "MIT",
"dependencies": [
"proj4"
]
"nlohmann-json",
{
"name": "sqlite3",
"default-features": false
},
{
"name": "sqlite3",
"host": true,
"features": [
"tool"
]
},
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"default-features": [
"net",
"tiff"
],
"features": {
"net": {
"description": "Enable network support",
"dependencies": [
"curl"
]
},
"tiff": {
"description": "Enable TIFF support to read some grids",
"dependencies": [
{
"name": "tiff",
"default-features": false,
"features": [
"lzma",
"zip"
]
}
]
},
"tools": {
"description": "Build tools"
}
}
}
53 changes: 0 additions & 53 deletions ports/proj4/pkgconfig.patch

This file was deleted.

71 changes: 1 addition & 70 deletions ports/proj4/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,70 +1 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO OSGeo/PROJ
REF 8.2.1
SHA512 8af4c41320e3fd60af3bfa89a89fd1bb22461786a4288a5873d82f90c51eaef021f539b6a6bcc8e393f786a84ea3747a75d80d95e620f20ef2a353f1a90b74bc
HEAD_REF master
PATCHES
fix-win-output-name.patch
fix-proj4-targets-cmake.patch
tools-cmake.patch
pkgconfig.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
net ENABLE_CURL
tiff ENABLE_TIFF
tools BUILD_APPS
)

vcpkg_list(SET TOOL_NAMES cct cs2cs geod gie invgeod invproj proj projinfo projsync)
if("tools" IN_LIST FEATURES AND NOT "net" IN_LIST FEATURES)
set(BUILD_PROJSYNC OFF)
vcpkg_list(APPEND FEATURE_OPTIONS -DBUILD_PROJSYNC=${BUILD_PROJSYNC})
vcpkg_list(REMOVE_ITEM TOOL_NAMES projsync)
endif()

find_program(EXE_SQLITE3 NAMES "sqlite3" PATHS "${CURRENT_HOST_INSTALLED_DIR}/tools" NO_DEFAULT_PATH REQUIRED)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DNLOHMANN_JSON=external
-DPROJ_LIB_SUBDIR=lib
-DPROJ_INCLUDE_SUBDIR=include
-DPROJ_DATA_SUBDIR=share/${PORT}
-DBUILD_TESTING=OFF
"-DEXE_SQLITE3=${EXE_SQLITE3}"
)

vcpkg_cmake_install()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
# Enforce consistency with src/lib_proj.cmake build time configuration.
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/proj.h"
"#ifndef PROJ_DLL"
"#ifndef PROJ_DLL\n# define PROJ_DLL\n#elif 0"
)
endif()

vcpkg_cmake_config_fixup(PACKAGE_NAME PROJ CONFIG_PATH lib/cmake/proj DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(PACKAGE_NAME PROJ4 CONFIG_PATH lib/cmake/proj4)

if ("tools" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES ${TOOL_NAMES} AUTO_CLEAN)
endif ()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

vcpkg_copy_pdbs()

vcpkg_fixup_pkgconfig()
if(NOT DEFINED VCPKG_BUILD_TYPE AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/proj.pc" " -lproj" " -lproj_d")
endif()

file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)
Loading

0 comments on commit fb34164

Please sign in to comment.