vcpkg/ports/proj4/portfile.cmake
Long Huan 629acdf9d1
[Proj4] Update to 7.2.0 (#14800)
* update proj4 to 7.2.0

* fix cmake find

* add tiff,curl feature

* fix depends

* Update fix-proj4-targets-cmake.patch

* fix

* remove tiff and curl when static build

* fix windows static build error

* Update ports/proj4/portfile.cmake

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* change port version

* use find_dependency instead of find_package

* Update fix-proj4-targets-cmake.patch

* Update fix-proj4-targets-cmake.patch

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
2020-12-01 13:59:39 -08:00

83 lines
3.2 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO OSGeo/PROJ
REF 7.2.0
SHA512 65dfca92b7890a9ffa78f48da443045069a250e2974dcf564fa23ffc297f87235b669983b39906352bd8eb702714b98fd89a4c7beaad4ad70834993a6de85128
HEAD_REF master
PATCHES
fix-sqlite3-bin.patch
disable-projdb-with-arm-uwp.patch
fix-win-output-name.patch
fix-proj4-targets-cmake.patch
tools-cmake.patch
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(VCPKG_BUILD_SHARED_LIBS ON)
set(EXTRA_FEATURES tiff ENABLE_TIFF tools BUILD_PROJSYNC tools ENABLE_CURL)
set(TOOL_NAMES cct cs2cs geod gie proj projinfo projsync)
else()
set(VCPKG_BUILD_SHARED_LIBS OFF)
set(TOOL_NAMES cct cs2cs geod gie proj projinfo)
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
database BUILD_PROJ_DATABASE
tools BUILD_CCT
tools BUILD_CS2CS
tools BUILD_GEOD
tools BUILD_GIE
tools BUILD_PROJ
tools BUILD_PROJINFO
${EXTRA_FEATURES}
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
message(WARNING "ENABLE_TIFF ENABLE_CURL and BUILD_PROJSYNC will be off when building static")
set(FEATURE_OPTIONS ${FEATURE_OPTIONS} -DENABLE_TIFF=OFF -DENABLE_CURL=OFF -DBUILD_PROJSYNC=OFF)
endif()
if ("database" IN_LIST FEATURES)
if (VCPKG_TARGET_IS_WINDOWS)
set(BIN_SUFFIX .exe)
if (EXISTS ${CURRENT_INSTALLED_DIR}/../x86-windows/tools/sqlite3.exe)
set(SQLITE3_BIN_PATH ${CURRENT_INSTALLED_DIR}/../x86-windows/tools)
elseif (EXISTS ${CURRENT_INSTALLED_DIR}/../x86-windows-static/tools/sqlite3.exe)
set(SQLITE3_BIN_PATH ${CURRENT_INSTALLED_DIR}/../x86-windows-static/tools)
elseif (EXISTS ${CURRENT_INSTALLED_DIR}/../x64-windows/tools/sqlite3.exe AND (NOT CMAKE_HOST_SYSTEM_PROCESSOR OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64"))
set(SQLITE3_BIN_PATH ${CURRENT_INSTALLED_DIR}/../x64-windows/tools)
elseif (EXISTS ${CURRENT_INSTALLED_DIR}/../x64-windows-static/tools/sqlite3.exe AND (NOT CMAKE_HOST_SYSTEM_PROCESSOR OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64"))
set(SQLITE3_BIN_PATH ${CURRENT_INSTALLED_DIR}/../x64-windows-static/tools)
elseif (NOT TRIPLET_SYSTEM_ARCH STREQUAL "arm" AND EXISTS ${CURRENT_INSTALLED_DIR}/tools/sqlite3.exe)
set(SQLITE3_BIN_PATH ${CURRENT_INSTALLED_DIR}/tools)
else()
message(FATAL_ERROR "Proj4 database need to install sqlite3[tool]:x86-windows first.")
endif()
else()
set(BIN_SUFFIX)
set(SQLITE3_BIN_PATH ${CURRENT_INSTALLED_DIR}/tools)
endif()
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS ${FEATURE_OPTIONS}
-DPROJ_LIB_SUBDIR=lib
-DPROJ_INCLUDE_SUBDIR=include
-DPROJ_DATA_SUBDIR=share/${PORT}
-DBUILD_TESTING=OFF
-DEXE_SQLITE3=${SQLITE3_BIN_PATH}/sqlite3${BIN_SUFFIX}
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT})
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)
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)