vcpkg/ports/proj4/portfile.cmake
Stefan Uhrig 8fe4184c6a
[proj4] Copy over proj.pdb file on install (#15985)
* Copy over proj.pdb file on install

* Update port-version of proj4

* update version record

* Update proj4 version

* Update versions/p-/proj4

Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
2021-03-10 11:56:45 -06:00

85 lines
3.2 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO OSGeo/PROJ
REF 7.2.1
SHA512 e6e77266dcd70c939c16667c916cccab8de161221d2ef600cfca43382f50da2dc8d790561556b4416adbb4ac6fba939004e0cc936c278e0e808dc3566e9a70d4
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)
vcpkg_copy_pdbs()