From 75dd38cd8a8143d9a77e81da25085ab1b7621cd6 Mon Sep 17 00:00:00 2001 From: JackBoosY <47264268+JackBoosY@users.noreply.github.com> Date: Fri, 18 Oct 2019 08:15:52 +0800 Subject: [PATCH] [proj4] Upgrade version to 6.1.1 and remove patches. (#7917) * [proj4]Upgrade version to 6.1.1 and remove useless patches. * [libgeotiff]Fix build errors using proj4 6.1.1. * [libspatialite]Fix build errors using proj4 6.1.1. * [gdal]Fix build errors using proj4 6.1.1. * [spatialite-tools]Fix build errors using proj4 6.1.1. * [spatialite-tools]Fix build errors using proj4 6.1.1. * [libgeotiff]Re-fix build errors using proj4 6.1.1. * [vtk]Fix build errors using proj4 6.1.1. * [proj4]Fix find sqlite binary failure. * [proj4]Disable build tools when building proj4 in arm/uwp. * [sqlite3/libgeotiff]Fix libdl library linkage. Re-fix use proj issue. * add back dl libs * [gdal]Fix dependent port proj library name. * [proj4]Set Windows library name to "proj" and revert fix-proj-name changes. * [liblas]Fix build errors using proj4 6.1.1. * [liblas]Fix build errors using proj4 6.1.1. * [liblas]Fix build errors using proj4 6.1.1. * [proj4]Fix feature database on triplet arm/uwp. * [gdal]Remove useless flag PROJ_STATIC. * [proj4]Fix build error on x64-windows-static. * [liblas]Use find_library to get proj4/sqlite3 libraries. * [proj4]Fix sqlite dependency. * [proj4]Fix arm/uwp dependency. * [proj4]Fix linux build: configure error. * [proj4]Disable export proj4 namespace. * [liblas]Delete proj dependency. * [libspatialite]Fix linux build. * [libspatialite]Fix linux command. * [libspatialite]Fix configure error. * [proj4]fix static cmake tools path. * [libgeotiff]Set configure options to 1/0 to avoid the "if" comparison failure in config.cmake. [proj4]Revert changes about namespace. [liblas]Remove FindPROJ4.cmake and FindGeoTIFF.cmake from the source. * [vtk]Fix using latest proj4 issue. * [proj4]Delete missing patch. --- ports/gdal/portfile.cmake | 12 +- ports/libgeotiff/CONTROL | 2 +- ports/libgeotiff/fix-proj4.patch | 17 ++ ports/libgeotiff/portfile.cmake | 12 +- ports/liblas/fix-BuildError.patch | 14 - ports/liblas/portfile.cmake | 3 +- ports/libspatialite/fix-linux-configure.patch | 135 ++++++++++ ports/libspatialite/portfile.cmake | 251 +++++++++--------- ...ion-of-recent-visual-studio-versions.patch | 26 -- ...by-only-setting-properties-for-targe.patch | 52 ---- ...urable-cmake-config-install-location.patch | 98 ------- ports/proj4/CONTROL | 10 +- ports/proj4/disable-export-namespace.patch | 28 ++ ports/proj4/disable-projdb-with-arm-uwp.patch | 15 ++ ports/proj4/fix-linux-build.patch | 18 ++ .../proj4/fix-sqlite-dependency-export.patch | 13 + ports/proj4/fix-sqlite3-bin.patch | 13 + ports/proj4/fix-win-output-name.patch | 13 + ports/proj4/portfile.cmake | 97 ++++--- ports/spatialite-tools/portfile.cmake | 10 +- ports/sqlite3/CONTROL | 2 +- ports/vtk/fix-proj4.patch | 175 ++++++++++++ ports/vtk/portfile.cmake | 9 + 23 files changed, 639 insertions(+), 386 deletions(-) create mode 100644 ports/libgeotiff/fix-proj4.patch create mode 100644 ports/libspatialite/fix-linux-configure.patch delete mode 100644 ports/proj4/0001-CMake-add-detection-of-recent-visual-studio-versions.patch delete mode 100644 ports/proj4/0002-CMake-fix-error-by-only-setting-properties-for-targe.patch delete mode 100644 ports/proj4/0003-CMake-configurable-cmake-config-install-location.patch create mode 100644 ports/proj4/disable-export-namespace.patch create mode 100644 ports/proj4/disable-projdb-with-arm-uwp.patch create mode 100644 ports/proj4/fix-linux-build.patch create mode 100644 ports/proj4/fix-sqlite-dependency-export.patch create mode 100644 ports/proj4/fix-sqlite3-bin.patch create mode 100644 ports/proj4/fix-win-output-name.patch create mode 100644 ports/vtk/fix-proj4.patch diff --git a/ports/gdal/portfile.cmake b/ports/gdal/portfile.cmake index 0e836e0d2..843459d8a 100644 --- a/ports/gdal/portfile.cmake +++ b/ports/gdal/portfile.cmake @@ -37,20 +37,20 @@ foreach(BUILD_TYPE IN LISTS BUILD_TYPES) vcpkg_apply_patches( SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE}/gdal-${GDAL_VERSION_STR} PATCHES - ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-debug-crt-flags.patch - ${CMAKE_CURRENT_LIST_DIR}/0002-Fix-static-build.patch + 0001-Fix-debug-crt-flags.patch + 0002-Fix-static-build.patch ) else() vcpkg_apply_patches( SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE}/gdal-${GDAL_VERSION_STR} PATCHES - ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-debug-crt-flags.patch + 0001-Fix-debug-crt-flags.patch ) endif() vcpkg_apply_patches( SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE}/gdal-${GDAL_VERSION_STR}/ogr PATCHES - ${CMAKE_CURRENT_LIST_DIR}/0003-Fix-std-fabs.patch + 0003-Fix-std-fabs.patch ) endforeach() @@ -65,7 +65,7 @@ if (NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStor # Setup proj4 libraries + include path file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" PROJ_INCLUDE_DIR) file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/proj.lib" PROJ_LIBRARY_REL) - file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/projd.lib" PROJ_LIBRARY_DBG) + file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/proj_d.lib" PROJ_LIBRARY_DBG) # Setup libpng libraries + include path file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" PNG_INCLUDE_DIR) @@ -192,6 +192,7 @@ if (NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStor PNGDIR=${PNG_INCLUDE_DIR} ZLIB_INC=-I${ZLIB_INCLUDE_DIR} ZLIB_EXTERNAL_LIB=1 + ACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1 MSVC_VER=1900 ) @@ -200,7 +201,6 @@ if (NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStor endif() if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - list(APPEND NMAKE_OPTIONS PROJ_FLAGS=-DPROJ_STATIC) list(APPEND NMAKE_OPTIONS CURL_CFLAGS=-DCURL_STATICLIB) else() # Enables PDBs for release and debug builds diff --git a/ports/libgeotiff/CONTROL b/ports/libgeotiff/CONTROL index 2e8d4836c..42a973875 100644 --- a/ports/libgeotiff/CONTROL +++ b/ports/libgeotiff/CONTROL @@ -1,5 +1,5 @@ Source: libgeotiff -Version: 1.4.2-9 +Version: 1.4.2-10 Homepage: https://download.osgeo.org/geotiff/libgeotiff Description: Libgeotiff is an open source library normally hosted on top of libtiff for reading, and writing GeoTIFF information tags. Build-Depends: tiff, proj4, zlib, libjpeg-turbo diff --git a/ports/libgeotiff/fix-proj4.patch b/ports/libgeotiff/fix-proj4.patch new file mode 100644 index 000000000..d6e8bce8a --- /dev/null +++ b/ports/libgeotiff/fix-proj4.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 617978c..baf45bc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -146,8 +146,11 @@ IF(WITH_PROJ4) + endif () + + IF(PROJ4_FOUND) +- ADD_DEFINITIONS(-DHAVE_LIBPROJ=1) ++ ADD_DEFINITIONS(-DHAVE_LIBPROJ=1 -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1) + INCLUDE_DIRECTORIES(${PROJ4_INCLUDE_DIR}) ++ IF(NOT WIN32) ++ LIST(APPEND PROJ4_LIBRARIES ${CMAKE_DL_LIBS}) ++ ENDIF() + ENDIF() + ENDIF() + diff --git a/ports/libgeotiff/portfile.cmake b/ports/libgeotiff/portfile.cmake index 1e4bb3370..174bed122 100644 --- a/ports/libgeotiff/portfile.cmake +++ b/ports/libgeotiff/portfile.cmake @@ -15,6 +15,7 @@ vcpkg_extract_source_archive_ex( PATCHES cmakelists.patch geotiff-config.patch + fix-proj4.patch ) # Delete FindPROJ4.cmake @@ -24,11 +25,11 @@ vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS - -DWITH_TIFF=ON - -DWITH_PROJ4=ON - -DWITH_ZLIB=ON - -DWITH_JPEG=ON - -DWITH_UTILITIES=ON + -DWITH_TIFF=1 + -DWITH_PROJ4=1 + -DWITH_ZLIB=1 + -DWITH_JPEG=1 + -DWITH_UTILITIES=1 ) vcpkg_install_cmake() @@ -55,6 +56,7 @@ endif() vcpkg_copy_pdbs() vcpkg_fixup_cmake_targets(CONFIG_PATH share/GeoTIFF) + file(INSTALL ${CURRENT_PACKAGES_DIR}/share/libgeotiff/geotiff-config-version.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/geotiff) file(INSTALL ${CURRENT_PACKAGES_DIR}/share/libgeotiff/geotiff-config.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/geotiff) file(INSTALL ${CURRENT_PACKAGES_DIR}/share/libgeotiff/geotiff-depends-release.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/geotiff) diff --git a/ports/liblas/fix-BuildError.patch b/ports/liblas/fix-BuildError.patch index 277e81ef7..4f9d768dc 100644 --- a/ports/liblas/fix-BuildError.patch +++ b/ports/liblas/fix-BuildError.patch @@ -31,17 +31,3 @@ index c7f583d..ca9e602 100644 # Now create the liblas-config files using the .in templates configure_file (liblas-config.cmake.in -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index e35de06..f7c25d2 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -226,7 +226,8 @@ target_link_libraries(${LIBLAS_LIB_NAME} - ${GEOTIFF_LIBRARY} - ${GDAL_LIBRARY} - ${LASZIP_LIBRARY} -- ${Boost_LIBRARIES}) -+ ${Boost_LIBRARIES} -+ proj) - - target_link_libraries(${LIBLAS_C_LIB_NAME} - ${LIBLAS_LIB_NAME} ) diff --git a/ports/liblas/portfile.cmake b/ports/liblas/portfile.cmake index e8697f589..32fdd7c7e 100644 --- a/ports/liblas/portfile.cmake +++ b/ports/liblas/portfile.cmake @@ -15,7 +15,8 @@ vcpkg_extract_source_archive_ex( PATCHES fix-BuildError.patch ) -file(REMOVE ${SOURCE_PATH}/cmake/modules/FindGeoTIFF.cmake) # remove outdated module. There are probably more +file(REMOVE ${SOURCE_PATH}/cmake/modules/FindPROJ4.cmake) +file(REMOVE ${SOURCE_PATH}/cmake/modules/FindGeoTIFF.cmake) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} diff --git a/ports/libspatialite/fix-linux-configure.patch b/ports/libspatialite/fix-linux-configure.patch new file mode 100644 index 000000000..59afa8c49 --- /dev/null +++ b/ports/libspatialite/fix-linux-configure.patch @@ -0,0 +1,135 @@ +diff --git a/configure b/configure +index aafdad5..fe46039 100644 +--- a/configure ++++ b/configure +@@ -17448,6 +17448,7 @@ fi + # --enable-proj + # + # Check whether --enable-proj was given. ++ + if test "${enable_proj+set}" = set; then : + enableval=$enable_proj; + else +@@ -17469,122 +17470,6 @@ fi + + done + +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pj_init_plus" >&5 +-$as_echo_n "checking for library containing pj_init_plus... " >&6; } +-if ${ac_cv_search_pj_init_plus+:} false; then : +- $as_echo_n "(cached) " >&6 +-else +- ac_func_search_save_LIBS=$LIBS +-cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +- +-/* Override any GCC internal prototype to avoid an error. +- Use char because int might match the return type of a GCC +- builtin and then its argument prototype would still apply. */ +-#ifdef __cplusplus +-extern "C" +-#endif +-char pj_init_plus (); +-int +-main () +-{ +-return pj_init_plus (); +- ; +- return 0; +-} +-_ACEOF +-for ac_lib in '' proj; do +- if test -z "$ac_lib"; then +- ac_res="none required" +- else +- ac_res=-l$ac_lib +- LIBS="-l$ac_lib -lm $ac_func_search_save_LIBS" +- fi +- if ac_fn_c_try_link "$LINENO"; then : +- ac_cv_search_pj_init_plus=$ac_res +-fi +-rm -f core conftest.err conftest.$ac_objext \ +- conftest$ac_exeext +- if ${ac_cv_search_pj_init_plus+:} false; then : +- break +-fi +-done +-if ${ac_cv_search_pj_init_plus+:} false; then : +- +-else +- ac_cv_search_pj_init_plus=no +-fi +-rm conftest.$ac_ext +-LIBS=$ac_func_search_save_LIBS +-fi +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pj_init_plus" >&5 +-$as_echo "$ac_cv_search_pj_init_plus" >&6; } +-ac_res=$ac_cv_search_pj_init_plus +-if test "$ac_res" != no; then : +- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" +- +-else +- as_fn_error $? "'libproj' is required but it doesn't seem to be installed on this system." "$LINENO" 5 +-fi +- +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pj_init_ctx" >&5 +-$as_echo_n "checking for library containing pj_init_ctx... " >&6; } +-if ${ac_cv_search_pj_init_ctx+:} false; then : +- $as_echo_n "(cached) " >&6 +-else +- ac_func_search_save_LIBS=$LIBS +-cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +- +-/* Override any GCC internal prototype to avoid an error. +- Use char because int might match the return type of a GCC +- builtin and then its argument prototype would still apply. */ +-#ifdef __cplusplus +-extern "C" +-#endif +-char pj_init_ctx (); +-int +-main () +-{ +-return pj_init_ctx (); +- ; +- return 0; +-} +-_ACEOF +-for ac_lib in '' proj; do +- if test -z "$ac_lib"; then +- ac_res="none required" +- else +- ac_res=-l$ac_lib +- LIBS="-l$ac_lib -lm $ac_func_search_save_LIBS" +- fi +- if ac_fn_c_try_link "$LINENO"; then : +- ac_cv_search_pj_init_ctx=$ac_res +-fi +-rm -f core conftest.err conftest.$ac_objext \ +- conftest$ac_exeext +- if ${ac_cv_search_pj_init_ctx+:} false; then : +- break +-fi +-done +-if ${ac_cv_search_pj_init_ctx+:} false; then : +- +-else +- ac_cv_search_pj_init_ctx=no +-fi +-rm conftest.$ac_ext +-LIBS=$ac_func_search_save_LIBS +-fi +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pj_init_ctx" >&5 +-$as_echo "$ac_cv_search_pj_init_ctx" >&6; } +-ac_res=$ac_cv_search_pj_init_ctx +-if test "$ac_res" != no; then : +- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" +- +-else +- as_fn_error $? "'libproj' is required but the version on this system does not support the required features (Version 4.8.0 or later is needed)." "$LINENO" 5 +-fi +- + else + $as_echo "#define OMIT_PROJ 1" >>confdefs.h + diff --git a/ports/libspatialite/portfile.cmake b/ports/libspatialite/portfile.cmake index f998d50d1..77e51b345 100644 --- a/ports/libspatialite/portfile.cmake +++ b/ports/libspatialite/portfile.cmake @@ -7,112 +7,111 @@ vcpkg_download_distfile(ARCHIVE ) if (VCPKG_TARGET_IS_WINDOWS) - find_program(NMAKE nmake) + find_program(NMAKE nmake) - vcpkg_extract_source_archive_ex( - OUT_SOURCE_PATH SOURCE_PATH - ARCHIVE ${ARCHIVE} - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/fix-makefiles.patch - ${CMAKE_CURRENT_LIST_DIR}/fix-sources.patch - ${CMAKE_CURRENT_LIST_DIR}/fix-latin-literals.patch - ) + vcpkg_extract_source_archive_ex( + OUT_SOURCE_PATH SOURCE_PATH + ARCHIVE ${ARCHIVE} + PATCHES + fix-makefiles.patch + fix-sources.patch + fix-latin-literals.patch + ) - # fix most of the problems when spacebar is in the path - set(CURRENT_INSTALLED_DIR "\"${CURRENT_INSTALLED_DIR}\"") + # fix most of the problems when spacebar is in the path + set(CURRENT_INSTALLED_DIR "\"${CURRENT_INSTALLED_DIR}\"") - if(VCPKG_CRT_LINKAGE STREQUAL dynamic) - set(CL_FLAGS_DBG "/MDd /Zi") - set(CL_FLAGS_REL "/MD /Ox") - set(GEOS_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/geos_c.lib") - set(GEOS_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/geos_cd.lib") - set(LIBXML2_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/libxml2.lib") - set(LIBXML2_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/libxml2.lib") - else() - set(CL_FLAGS_DBG "/MTd /Zi") - set(CL_FLAGS_REL "/MT /Ox") - set(GEOS_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/libgeos_c.lib ${CURRENT_INSTALLED_DIR}/lib/libgeos.lib") - set(GEOS_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/libgeos_cd.lib ${CURRENT_INSTALLED_DIR}/debug/lib/libgeosd.lib") - set(LIBXML2_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/libxml2.lib ${CURRENT_INSTALLED_DIR}/lib/lzma.lib ws2_32.lib") - set(LIBXML2_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/libxml2.lib ${CURRENT_INSTALLED_DIR}/debug/lib/lzmad.lib ws2_32.lib") - endif() + if(VCPKG_CRT_LINKAGE STREQUAL dynamic) + set(CL_FLAGS_DBG "/MDd /Zi /DACCEPT_USE_OF_DEPRECATED_PROJ_API_H") + set(CL_FLAGS_REL "/MD /Ox /DACCEPT_USE_OF_DEPRECATED_PROJ_API_H") + set(GEOS_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/geos_c.lib") + set(GEOS_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/geos_cd.lib") + set(LIBXML2_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/libxml2.lib") + set(LIBXML2_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/libxml2.lib") + else() + set(CL_FLAGS_DBG "/MTd /Zi /DACCEPT_USE_OF_DEPRECATED_PROJ_API_H") + set(CL_FLAGS_REL "/MT /Ox /DACCEPT_USE_OF_DEPRECATED_PROJ_API_H") + set(GEOS_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/libgeos_c.lib ${CURRENT_INSTALLED_DIR}/lib/libgeos.lib") + set(GEOS_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/libgeos_cd.lib ${CURRENT_INSTALLED_DIR}/debug/lib/libgeosd.lib") + set(LIBXML2_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/libxml2.lib ${CURRENT_INSTALLED_DIR}/lib/lzma.lib ws2_32.lib") + set(LIBXML2_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/libxml2.lib ${CURRENT_INSTALLED_DIR}/debug/lib/lzmad.lib ws2_32.lib") + endif() - set(LIBS_ALL_DBG - "${CURRENT_INSTALLED_DIR}/debug/lib/libiconv.lib \ - ${CURRENT_INSTALLED_DIR}/debug/lib/libcharset.lib \ - ${CURRENT_INSTALLED_DIR}/debug/lib/sqlite3.lib \ - ${CURRENT_INSTALLED_DIR}/debug/lib/freexl.lib \ - ${CURRENT_INSTALLED_DIR}/debug/lib/zlibd.lib \ - ${LIBXML2_LIBS_DBG} \ - ${GEOS_LIBS_DBG} \ - ${CURRENT_INSTALLED_DIR}/debug/lib/projd.lib" - ) - set(LIBS_ALL_REL - "${CURRENT_INSTALLED_DIR}/lib/libiconv.lib \ - ${CURRENT_INSTALLED_DIR}/lib/libcharset.lib \ - ${CURRENT_INSTALLED_DIR}/lib/sqlite3.lib \ - ${CURRENT_INSTALLED_DIR}/lib/freexl.lib \ - ${CURRENT_INSTALLED_DIR}/lib/zlib.lib \ - ${LIBXML2_LIBS_REL} \ - ${GEOS_LIBS_REL} \ - ${CURRENT_INSTALLED_DIR}/lib/proj.lib" - ) + set(LIBS_ALL_DBG + "${CURRENT_INSTALLED_DIR}/debug/lib/libiconv.lib \ + ${CURRENT_INSTALLED_DIR}/debug/lib/libcharset.lib \ + ${CURRENT_INSTALLED_DIR}/debug/lib/sqlite3.lib \ + ${CURRENT_INSTALLED_DIR}/debug/lib/freexl.lib \ + ${CURRENT_INSTALLED_DIR}/debug/lib/zlibd.lib \ + ${LIBXML2_LIBS_DBG} \ + ${GEOS_LIBS_DBG} \ + ${CURRENT_INSTALLED_DIR}/debug/lib/proj_d.lib" + ) + set(LIBS_ALL_REL + "${CURRENT_INSTALLED_DIR}/lib/libiconv.lib \ + ${CURRENT_INSTALLED_DIR}/lib/libcharset.lib \ + ${CURRENT_INSTALLED_DIR}/lib/sqlite3.lib \ + ${CURRENT_INSTALLED_DIR}/lib/freexl.lib \ + ${CURRENT_INSTALLED_DIR}/lib/zlib.lib \ + ${LIBXML2_LIBS_REL} \ + ${GEOS_LIBS_REL} \ + ${CURRENT_INSTALLED_DIR}/lib/proj.lib" + ) - ################ - # Debug build - ################ - if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") - message(STATUS "Building ${TARGET_TRIPLET}-dbg") + ################ + # Debug build + ################ + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + message(STATUS "Building ${TARGET_TRIPLET}-dbg") - file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}/debug" INST_DIR_DBG) + file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}/debug" INST_DIR_DBG) - vcpkg_execute_required_process( - COMMAND ${NMAKE} -f makefile.vc clean install - "INST_DIR=\"${INST_DIR_DBG}\"" INSTALLED_ROOT=${CURRENT_INSTALLED_DIR} "LINK_FLAGS=/debug" "CL_FLAGS=${CL_FLAGS_DBG}" "LIBS_ALL=${LIBS_ALL_DBG}" - WORKING_DIRECTORY ${SOURCE_PATH} - LOGNAME nmake-build-${TARGET_TRIPLET}-debug - ) - message(STATUS "Building ${TARGET_TRIPLET}-dbg done") - vcpkg_copy_pdbs() - endif() + vcpkg_execute_required_process( + COMMAND ${NMAKE} -f makefile.vc clean install + "INST_DIR=\"${INST_DIR_DBG}\"" INSTALLED_ROOT=${CURRENT_INSTALLED_DIR} "LINK_FLAGS=/debug" "CL_FLAGS=${CL_FLAGS_DBG}" "LIBS_ALL=${LIBS_ALL_DBG}" + WORKING_DIRECTORY ${SOURCE_PATH} + LOGNAME nmake-build-${TARGET_TRIPLET}-debug + ) + message(STATUS "Building ${TARGET_TRIPLET}-dbg done") + vcpkg_copy_pdbs() + endif() - ################ - # Release build - ################ - if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") - message(STATUS "Building ${TARGET_TRIPLET}-rel") + ################ + # Release build + ################ + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + message(STATUS "Building ${TARGET_TRIPLET}-rel") - file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" INST_DIR_REL) - vcpkg_execute_required_process( - COMMAND ${NMAKE} -f makefile.vc clean install - "INST_DIR=\"${INST_DIR_REL}\"" INSTALLED_ROOT=${CURRENT_INSTALLED_DIR} "LINK_FLAGS=" "CL_FLAGS=${CL_FLAGS_REL}" "LIBS_ALL=${LIBS_ALL_REL}" - WORKING_DIRECTORY ${SOURCE_PATH} - LOGNAME nmake-build-${TARGET_TRIPLET}-release - ) - message(STATUS "Building ${TARGET_TRIPLET}-rel done") - endif() + file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" INST_DIR_REL) + vcpkg_execute_required_process( + COMMAND ${NMAKE} -f makefile.vc clean install + "INST_DIR=\"${INST_DIR_REL}\"" INSTALLED_ROOT=${CURRENT_INSTALLED_DIR} "LINK_FLAGS=" "CL_FLAGS=${CL_FLAGS_REL}" "LIBS_ALL=${LIBS_ALL_REL}" + WORKING_DIRECTORY ${SOURCE_PATH} + LOGNAME nmake-build-${TARGET_TRIPLET}-release + ) + message(STATUS "Building ${TARGET_TRIPLET}-rel done") + endif() + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libspatialite RENAME copyright) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) - file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libspatialite RENAME copyright) + if (VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) + file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/spatialite_i.lib) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/spatialite_i.lib) + else() + file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/spatialite.lib) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/spatialite.lib) + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(RENAME ${CURRENT_PACKAGES_DIR}/lib/spatialite_i.lib ${CURRENT_PACKAGES_DIR}/lib/spatialite.lib) + endif() + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/spatialite_i.lib ${CURRENT_PACKAGES_DIR}/debug/lib/spatialite.lib) + endif() + endif() - if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) - file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/spatialite_i.lib) - file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/spatialite_i.lib) - else() - file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/spatialite.lib) - file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/spatialite.lib) - if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") - file(RENAME ${CURRENT_PACKAGES_DIR}/lib/spatialite_i.lib ${CURRENT_PACKAGES_DIR}/lib/spatialite.lib) - endif() - if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") - file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/spatialite_i.lib ${CURRENT_PACKAGES_DIR}/debug/lib/spatialite.lib) - endif() - endif() - - message(STATUS "Packaging ${TARGET_TRIPLET} done") + message(STATUS "Packaging ${TARGET_TRIPLET} done") elseif (VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX) # Build in UNIX # Check build system first find_program(MAKE make) @@ -124,38 +123,40 @@ elseif (VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX) # Build in UNIX ################ # Release build ################ - vcpkg_extract_source_archive_ex( - OUT_SOURCE_PATH SOURCE_PATH_RELEASE - ARCHIVE ${ARCHIVE} - REF release - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/fix-sources.patch - ${CMAKE_CURRENT_LIST_DIR}/fix-latin-literals.patch - ) + vcpkg_extract_source_archive_ex( + OUT_SOURCE_PATH SOURCE_PATH_RELEASE + ARCHIVE ${ARCHIVE} + REF release + PATCHES + fix-sources.patch + fix-latin-literals.patch + fix-linux-configure.patch + ) message(STATUS "Configuring ${TARGET_TRIPLET}-rel") set(OUT_PATH_RELEASE ${SOURCE_PATH_RELEASE}/../../make-build-${TARGET_TRIPLET}-release) - file(REMOVE_RECURSE ${OUT_PATH_RELEASE}) + file(REMOVE_RECURSE ${OUT_PATH_RELEASE}) file(MAKE_DIRECTORY ${OUT_PATH_RELEASE}) set(prefix ${CURRENT_INSTALLED_DIR}) set(exec_prefix ${prefix}/bin) set(includedir ${prefix}/include) set(libdir ${prefix}/lib) - configure_file(${CMAKE_CURRENT_LIST_DIR}/geos-config.in + configure_file(${CMAKE_CURRENT_LIST_DIR}/geos-config.in ${SOURCE_PATH_RELEASE}/geos-config @ONLY) - vcpkg_execute_required_process( + vcpkg_execute_required_process( COMMAND chmod -R 777 ${SOURCE_PATH_RELEASE}/geos-config WORKING_DIRECTORY ${SOURCE_PATH_RELEASE} LOGNAME config-${TARGET_TRIPLET}-rel ) vcpkg_execute_required_process( - COMMAND "${SOURCE_PATH_RELEASE}/configure" --prefix=${OUT_PATH_RELEASE} "CFLAGS=-I${includedir} ${VCPKG_C_FLAGS} ${VCPKG_C_FLAGS_RELEASE}" "LDFLAGS=-L${libdir}" "LIBS=-lpthread -ldl" "--with-geosconfig=${SOURCE_PATH_RELEASE}/geos-config" "LIBXML2_LIBS=-lxml2 -llzma" "LIBXML2_CFLAGS=${includedir}" + COMMAND "${SOURCE_PATH_RELEASE}/configure" --prefix=${OUT_PATH_RELEASE} "CFLAGS=-I${includedir} ${VCPKG_C_FLAGS} ${VCPKG_C_FLAGS_RELEASE} -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H" "LDFLAGS=-L${libdir}" "LIBS=-lpthread -ldl -lproj" "--with-geosconfig=${SOURCE_PATH_RELEASE}/geos-config" "LIBXML2_LIBS=-lxml2 -llzma" "LIBXML2_CFLAGS=${includedir}" WORKING_DIRECTORY ${SOURCE_PATH_RELEASE} LOGNAME config-${TARGET_TRIPLET}-rel ) message(STATUS "Building ${TARGET_TRIPLET}-rel") - vcpkg_execute_required_process( - COMMAND make + vcpkg_execute_build_process( + COMMAND make -j ${VCPKG_CONCURRENCY} + NO_PARALLEL_COMMAND make WORKING_DIRECTORY ${SOURCE_PATH_RELEASE} LOGNAME make-build-${TARGET_TRIPLET}-release ) @@ -180,39 +181,41 @@ elseif (VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX) # Build in UNIX ################ # Debug build ################ - vcpkg_extract_source_archive_ex( - OUT_SOURCE_PATH SOURCE_PATH_DEBUG - ARCHIVE ${ARCHIVE} - REF debug - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/fix-sources.patch - ${CMAKE_CURRENT_LIST_DIR}/fix-latin-literals.patch - ${CMAKE_CURRENT_LIST_DIR}/fix-configure-debug.patch - ) + vcpkg_extract_source_archive_ex( + OUT_SOURCE_PATH SOURCE_PATH_DEBUG + ARCHIVE ${ARCHIVE} + REF debug + PATCHES + fix-sources.patch + fix-latin-literals.patch + fix-configure-debug.patch + fix-linux-configure.patch + ) message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") set(OUT_PATH_DEBUG ${SOURCE_PATH_DEBUG}/../../make-build-${TARGET_TRIPLET}-debug) - file(REMOVE_RECURSE ${OUT_PATH_DEBUG}) + file(REMOVE_RECURSE ${OUT_PATH_DEBUG}) file(MAKE_DIRECTORY ${OUT_PATH_DEBUG}) - set(prefix ${CURRENT_INSTALLED_DIR}) + set(prefix ${CURRENT_INSTALLED_DIR}) set(exec_prefix ${prefix}/debug/bin) - set(includedir ${prefix}/include) + set(includedir ${prefix}/include) set(libdir ${prefix}/debug/lib) configure_file(${CMAKE_CURRENT_LIST_DIR}/geos-config-debug.in ${SOURCE_PATH_DEBUG}/geos-config @ONLY) - vcpkg_execute_required_process( + vcpkg_execute_required_process( COMMAND chmod -R 777 ${SOURCE_PATH_DEBUG}/geos-config WORKING_DIRECTORY ${SOURCE_PATH_DEBUG} LOGNAME config-${TARGET_TRIPLET}-debug ) vcpkg_execute_required_process( - COMMAND "${SOURCE_PATH_DEBUG}/configure" --prefix=${OUT_PATH_DEBUG} "CFLAGS=-I${includedir} ${VCPKG_C_FLAGS} ${VCPKG_C_FLAGS_DEBUG}" "LDFLAGS=-L${libdir}" "LIBS=-lpthread -ldl" "--with-geosconfig=${SOURCE_PATH_DEBUG}/geos-config" "LIBXML2_LIBS=-lxml2 -llzmad" "LIBXML2_CFLAGS=${includedir}" + COMMAND "${SOURCE_PATH_DEBUG}/configure" --prefix=${OUT_PATH_DEBUG} "CFLAGS=-I${includedir} ${VCPKG_C_FLAGS} ${VCPKG_C_FLAGS_DEBUG} -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H" "LDFLAGS=-L${libdir}" "LIBS=-lpthread -ldl -lproj" "--with-geosconfig=${SOURCE_PATH_DEBUG}/geos-config" "LIBXML2_LIBS=-lxml2 -llzmad" "LIBXML2_CFLAGS=${includedir}" WORKING_DIRECTORY ${SOURCE_PATH_DEBUG} LOGNAME config-${TARGET_TRIPLET}-debug ) message(STATUS "Building ${TARGET_TRIPLET}-dbg") - vcpkg_execute_required_process( - COMMAND make + vcpkg_execute_build_process( + COMMAND make -j ${VCPKG_CONCURRENCY} + NO_PARALLEL_COMMAND make WORKING_DIRECTORY ${SOURCE_PATH_DEBUG} LOGNAME make-build-${TARGET_TRIPLET}-debug ) diff --git a/ports/proj4/0001-CMake-add-detection-of-recent-visual-studio-versions.patch b/ports/proj4/0001-CMake-add-detection-of-recent-visual-studio-versions.patch deleted file mode 100644 index 2f1f9ca29..000000000 --- a/ports/proj4/0001-CMake-add-detection-of-recent-visual-studio-versions.patch +++ /dev/null @@ -1,26 +0,0 @@ -From ca8bb14234091ab7b1ada2b9e5abb04f40d459cb Mon Sep 17 00:00:00 2001 -From: Manuel Massing -Date: Tue, 22 Nov 2016 12:00:39 +0100 -Subject: [PATCH 1/3] CMake: add detection of recent visual studio versions - ---- - cmake/Proj4SystemInfo.cmake | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/cmake/Proj4SystemInfo.cmake b/cmake/Proj4SystemInfo.cmake -index 294a50b..c7fb6bf 100644 ---- a/cmake/Proj4SystemInfo.cmake -+++ b/cmake/Proj4SystemInfo.cmake -@@ -50,6 +50,9 @@ if(WIN32) - if(MSVC_VERSION EQUAL 1800) - set(PROJ_COMPILER_NAME "msvc-12.0") #Visual Studio 2013 - endif() -+ if(MSVC_VERSION GREATER_EQUAL 1900) -+ set(PROJ_COMPILER_NAME "msvc-14.0") #Visual Studio 2015/2017/2019 -+ endif() - endif(MSVC) - - if(MINGW) --- -2.9.2.windows.1 - diff --git a/ports/proj4/0002-CMake-fix-error-by-only-setting-properties-for-targe.patch b/ports/proj4/0002-CMake-fix-error-by-only-setting-properties-for-targe.patch deleted file mode 100644 index 2c470570e..000000000 --- a/ports/proj4/0002-CMake-fix-error-by-only-setting-properties-for-targe.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 1265d13f29259be05535241e9bcbfcf16857dc06 Mon Sep 17 00:00:00 2001 -From: Manuel Massing -Date: Tue, 22 Nov 2016 12:04:10 +0100 -Subject: [PATCH 2/3] CMake: fix error by only setting properties for targets - which are actually defined - ---- - src/CMakeLists.txt | 13 +++++++++---- - 1 file changed, 9 insertions(+), 4 deletions(-) - -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 8d7e7d1..59ad00a 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -22,25 +22,30 @@ if(NOT MSVC) - endif () - endif () - -+ - if(BUILD_CS2CS) -- include(bin_cs2cs.cmake) -+ list(APPEND BINARY_TARGETS cs2cs) -+ include(bin_cs2cs.cmake) - endif(BUILD_CS2CS) - - if(BUILD_PROJ) -+ list(APPEND BINARY_TARGETS proj) - include(bin_proj.cmake) - endif(BUILD_PROJ) - - if(BUILD_GEOD) -+ list(APPEND BINARY_TARGETS geod) - include(bin_geod.cmake) - include(bin_geodtest.cmake) - endif(BUILD_GEOD) - - if(BUILD_NAD2BIN) -+ list(APPEND BINARY_TARGETS nad2bin) - include(bin_nad2bin.cmake) - endif(BUILD_NAD2BIN) - --if (MSVC OR CMAKE_CONFIGURATION_TYPES) -+if ((MSVC OR CMAKE_CONFIGURATION_TYPES) AND BINARY_TARGETS) - # Add _d suffix for your debug versions of the tools -- set_target_properties (cs2cs binproj geod nad2bin PROPERTIES -- DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) -+ set_target_properties(${BINARY_TARGETS} PROPERTIES -+ DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) - endif () --- -2.9.2.windows.1 - diff --git a/ports/proj4/0003-CMake-configurable-cmake-config-install-location.patch b/ports/proj4/0003-CMake-configurable-cmake-config-install-location.patch deleted file mode 100644 index 5870e12ea..000000000 --- a/ports/proj4/0003-CMake-configurable-cmake-config-install-location.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 0be627798d943558c674d4d92767ca255d847631 Mon Sep 17 00:00:00 2001 -From: Manuel Massing -Date: Tue, 22 Nov 2016 12:26:39 +0100 -Subject: [PATCH 3/3] CMake: configurable cmake config install location - ---- - CMakeLists.txt | 1 + - cmake/CMakeLists.txt | 14 +++++++------- - cmake/Proj4InstallPath.cmake | 12 +++++++++--- - 3 files changed, 17 insertions(+), 10 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index cde21f0..1b1f892 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -106,6 +106,7 @@ set(LIBDIR "${DEFAULT_LIBDIR}" CACHE PATH "The directory to install libraries in - set(DATADIR "${DEFAULT_DATADIR}" CACHE PATH "The directory to install data files into.") - set(DOCDIR "${DEFAULT_DOCDIR}" CACHE PATH "The directory to install doc files into.") - set(INCLUDEDIR "${DEFAULT_INCLUDEDIR}" CACHE PATH "The directory to install includes into.") -+set(CMAKEDIR "${DEFAULT_CMAKE_CONFIGDIR}" CACHE PATH "The directory to install cmake files into.") - - ################################################################################# - # Build configured components -diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt -index 742da0e..2bdef0d 100644 ---- a/cmake/CMakeLists.txt -+++ b/cmake/CMakeLists.txt -@@ -2,13 +2,13 @@ - # ${INSTALL_CMAKE_DIR} and @PROJECT_ROOT_DIR@ is the relative - # path to the root from there. (Note that the whole install tree can - # be relocated.) --if (NOT WIN32) -- set (INSTALL_CMAKE_DIR "share/cmake/${PROJECT_NAME}") -- set (PROJECT_ROOT_DIR "../../..") --else () -- set (INSTALL_CMAKE_DIR "cmake") -- set (PROJECT_ROOT_DIR "..") --endif () -+ -+set (INSTALL_CMAKE_DIR ${CMAKEDIR}) -+if(NOT IS_ABSOLUTE ${INSTALL_CMAKE_DIR}) -+ set(INSTALL_CMAKE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKEDIR}") -+endif() -+ -+file(RELATIVE_PATH PROJECT_ROOT_DIR ${INSTALL_CMAKE_DIR} ${CMAKE_INSTALL_PREFIX}) - - string(TOLOWER "${PROJECT_NAME}" PROJECT_NAME_LOWER) - configure_file (project-config.cmake.in project-config.cmake @ONLY) -diff --git a/cmake/Proj4InstallPath.cmake b/cmake/Proj4InstallPath.cmake -index da1491c..826fb29 100644 ---- a/cmake/Proj4InstallPath.cmake -+++ b/cmake/Proj4InstallPath.cmake -@@ -28,13 +28,15 @@ if(WIN32) - set(DEFAULT_DATA_SUBDIR share) - set(DEFAULT_INCLUDE_SUBDIR local/include) - set(DEFAULT_DOC_SUBDIR share/doc/proj) -+ set(DEFAULT_CMAKE_CONFIG_SUBDIR "cmake") - else() -- # Common locatoins for Unix and Mac OS X -+ # Common locations for Unix and Mac OS X - set(DEFAULT_BIN_SUBDIR bin) - set(DEFAULT_LIB_SUBDIR lib) - set(DEFAULT_DATA_SUBDIR share/proj) - set(DEFAULT_DOC_SUBDIR doc/proj) - set(DEFAULT_INCLUDE_SUBDIR include) -+ set(DEFAULT_CMAKE_CONFIG_SUBDIR "share/cmake/${PROJECT_NAME}") - endif() - - # Locations are changeable by user to customize layout of PDAL installation -@@ -49,19 +51,23 @@ set(PROJ_DATA_SUBDIR ${DEFAULT_DATA_SUBDIR} CACHE STRING - "Subdirectory where data will be installed") - set(PROJ_DOC_SUBDIR ${DEFAULT_DOC_SUBDIR} CACHE STRING - "Subdirectory where data will be installed") -- -+set(PROJ_CMAKE_CONFIG_SUBDIR ${DEFAULT_CMAKE_CONFIG_SUBDIR} CACHE STRING -+ "Subdirectory where cmake configuration files will be installed") -+ - # Mark *DIR variables as advanced and dedicated to use by power-users only. - mark_as_advanced(PROJ_ROOT_DIR - PROJ_BIN_SUBDIR - PROJ_LIB_SUBDIR - PROJ_INCLUDE_SUBDIR - PROJ_DATA_SUBDIR -- PROJ_DOC_SUBDIR ) -+ PROJ_DOC_SUBDIR -+ PROJ_CMAKE_CONFIG_SUBDIR) - - set(DEFAULT_BINDIR "${PROJ_BIN_SUBDIR}") - set(DEFAULT_LIBDIR "${PROJ_LIB_SUBDIR}") - set(DEFAULT_DATADIR "${PROJ_DATA_SUBDIR}") - set(DEFAULT_DOCDIR "${PROJ_DOC_SUBDIR}") - set(DEFAULT_INCLUDEDIR "${PROJ_INCLUDE_SUBDIR}") -+set(DEFAULT_CMAKE_CONFIGDIR "${PROJ_CMAKE_CONFIG_SUBDIR}") - - --- -2.9.2.windows.1 - diff --git a/ports/proj4/CONTROL b/ports/proj4/CONTROL index 790b8f70f..6a9647493 100644 --- a/ports/proj4/CONTROL +++ b/ports/proj4/CONTROL @@ -1,4 +1,10 @@ Source: proj4 -Version: 4.9.3-5 -Homepage: https://download.osgeo.org/proj +Version: 6.1.1-1 +Homepage: https://github.com/OSGeo/PROJ Description: PROJ.4 library for cartographic projections +Build-Depends: sqlite3[core] +Default-Features: database + +Feature: database +Build-Depends: sqlite3[tool] (!uwp&!arm) +Description: generate database \ No newline at end of file diff --git a/ports/proj4/disable-export-namespace.patch b/ports/proj4/disable-export-namespace.patch new file mode 100644 index 000000000..87646fe3d --- /dev/null +++ b/ports/proj4/disable-export-namespace.patch @@ -0,0 +1,28 @@ +diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt +index 61c69f7..777b5d8 100644 +--- a/cmake/CMakeLists.txt ++++ b/cmake/CMakeLists.txt +@@ -28,7 +28,3 @@ install(FILES + install(EXPORT targets + FILE ${PROJECT_NAME_LOWER}-targets.cmake + DESTINATION "${CMAKECONFIGDIR}") +-install(EXPORT targets +- NAMESPACE ${PROJECT_NAME}:: +- FILE ${PROJECT_NAME_LOWER}-namespace-targets.cmake +- DESTINATION "${CMAKECONFIGDIR}") +diff --git a/cmake/project-config.cmake.in b/cmake/project-config.cmake.in +index c62ecb4..9a52b3b 100644 +--- a/cmake/project-config.cmake.in ++++ b/cmake/project-config.cmake.in +@@ -20,10 +20,9 @@ set (@PROJECT_NAME@_INCLUDE_DIRS "${_ROOT}/@INCLUDEDIR@") + set (@PROJECT_NAME@_LIBRARY_DIRS "${_ROOT}/@LIBDIR@") + set (@PROJECT_NAME@_BINARY_DIRS "${_ROOT}/@BINDIR@") + +-set (@PROJECT_NAME@_LIBRARIES @PROJECT_NAME@::proj) ++set (@PROJECT_NAME@_LIBRARIES proj) + # Read in the exported definition of the library + include ("${_DIR}/@PROJECT_NAME_LOWER@-targets.cmake") +-include ("${_DIR}/@PROJECT_NAME_LOWER@-namespace-targets.cmake") + + unset (_ROOT) + unset (_DIR) diff --git a/ports/proj4/disable-projdb-with-arm-uwp.patch b/ports/proj4/disable-projdb-with-arm-uwp.patch new file mode 100644 index 000000000..218a35335 --- /dev/null +++ b/ports/proj4/disable-projdb-with-arm-uwp.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9213990..f51cc5e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -224,7 +224,9 @@ set(CMAKECONFIGDIR "${DEFAULT_CMAKEDIR}" + include_directories(${PROJ4_SOURCE_DIR}/src) + + message(STATUS "") +-add_subdirectory(data) ++if(BUILD_PROJ_DATABASE) ++ add_subdirectory(data) ++endif() + add_subdirectory(include) + add_subdirectory(src) + add_subdirectory(man) diff --git a/ports/proj4/fix-linux-build.patch b/ports/proj4/fix-linux-build.patch new file mode 100644 index 000000000..0d81ef35d --- /dev/null +++ b/ports/proj4/fix-linux-build.patch @@ -0,0 +1,18 @@ +diff --git a/src/lib_proj.cmake b/src/lib_proj.cmake +index cf7533b..236581f 100644 +--- a/src/lib_proj.cmake ++++ b/src/lib_proj.cmake +@@ -431,11 +431,11 @@ set(PROJ_LIBRARIES ${PROJ_LIBRARIES} PARENT_SCOPE) + if(UNIX) + find_library(M_LIB m) + if(M_LIB) +- target_link_libraries(${PROJ_CORE_TARGET} -lm) ++ target_link_libraries(${PROJ_CORE_TARGET} PRIVATE -lm) + endif() + endif() + if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) +- target_link_libraries(${PROJ_CORE_TARGET} ${CMAKE_THREAD_LIBS_INIT}) ++ target_link_libraries(${PROJ_CORE_TARGET} PRIVATE ${CMAKE_THREAD_LIBS_INIT}) + endif() + + include_directories(${SQLITE3_INCLUDE_DIR}) diff --git a/ports/proj4/fix-sqlite-dependency-export.patch b/ports/proj4/fix-sqlite-dependency-export.patch new file mode 100644 index 000000000..a7f051699 --- /dev/null +++ b/ports/proj4/fix-sqlite-dependency-export.patch @@ -0,0 +1,13 @@ +diff --git a/src/lib_proj.cmake b/src/lib_proj.cmake +index 5a0a807..f7bfffd 100644 +--- a/src/lib_proj.cmake ++++ b/src/lib_proj.cmake +@@ -439,7 +439,7 @@ if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) + endif() + + include_directories(${SQLITE3_INCLUDE_DIR}) +-target_link_libraries(${PROJ_CORE_TARGET} ${SQLITE3_LIBRARY}) ++target_link_libraries(${PROJ_CORE_TARGET} PUBLIC ${SQLITE3_LIBRARY}) + + if(MSVC) + target_compile_definitions(${PROJ_CORE_TARGET} diff --git a/ports/proj4/fix-sqlite3-bin.patch b/ports/proj4/fix-sqlite3-bin.patch new file mode 100644 index 000000000..20fea7141 --- /dev/null +++ b/ports/proj4/fix-sqlite3-bin.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 75c4696..2e8a957 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -110,7 +110,7 @@ include(policies) + ################################################################################ + # Check for sqlite3 + ################################################################################ +-find_program(EXE_SQLITE3 sqlite3) ++# Use incoming parameter + if(NOT EXE_SQLITE3) + message(SEND_ERROR "sqlite3 binary not found!") + endif() diff --git a/ports/proj4/fix-win-output-name.patch b/ports/proj4/fix-win-output-name.patch new file mode 100644 index 000000000..5964d11be --- /dev/null +++ b/ports/proj4/fix-win-output-name.patch @@ -0,0 +1,13 @@ +diff --git a/cmake/ProjUtilities.cmake b/cmake/ProjUtilities.cmake +index 1a2b605..cf62f02 100644 +--- a/cmake/ProjUtilities.cmake ++++ b/cmake/ProjUtilities.cmake +@@ -104,7 +104,7 @@ function(proj_target_output_name TARGET_NAME OUTPUT_NAME) + + # On Windows, ABI version is specified using binary file name suffix. + # On Unix, suffix is empty and SOVERSION is used instead. +- if(WIN32) ++ if(0) + string(LENGTH "${${PROJECT_INTERN_NAME}_ABI_VERSION}" abilen) + if(abilen GREATER 0) + set(SUFFIX "_${${PROJECT_INTERN_NAME}_ABI_VERSION}") diff --git a/ports/proj4/portfile.cmake b/ports/proj4/portfile.cmake index 70878aae6..7d9c311ca 100644 --- a/ports/proj4/portfile.cmake +++ b/ports/proj4/portfile.cmake @@ -1,21 +1,17 @@ include(vcpkg_common_functions) -set(PROJ4_VERSION 4.9.3) - -vcpkg_download_distfile(ARCHIVE - URLS "http://download.osgeo.org/proj/proj-${PROJ4_VERSION}.zip" - FILENAME "proj-${PROJ4_VERSION}.zip" - SHA512 c9703008cd1f75fe1239b180158e560b9b88ae2ffd900b72923c716908eb86d1abbc4230647af5e3131f8c34481bdc66b03826d669620161ffcfbe67801cb631 -) - -vcpkg_extract_source_archive_ex( +vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH - ARCHIVE ${ARCHIVE} - REF ${PROJ4_VERSION} + REPO OSGeo/PROJ + REF 6.1.1 + SHA512 d7c13eec5bc75ace132b7a35118b0e254b9e766cad7bfe23f8d1ec52c32e388607b4f04e9befceef8185e25b98c678c492a6319d19a5e62d074a6d23474b68fa + HEAD_REF master PATCHES - 0001-CMake-add-detection-of-recent-visual-studio-versions.patch - 0002-CMake-fix-error-by-only-setting-properties-for-targe.patch - 0003-CMake-configurable-cmake-config-install-location.patch + fix-sqlite3-bin.patch + disable-projdb-with-arm-uwp.patch + fix-win-output-name.patch + fix-sqlite-dependency-export.patch + fix-linux-build.patch ) if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") @@ -24,53 +20,52 @@ else() set(VCPKG_BUILD_SHARED_LIBS OFF) endif() +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + database BUILD_PROJ_DATABASE +) + +if ("database" IN_LIST FEATURES) + if (VCPKG_TARGET_IS_WINDOWS) + set(BIN_SUFFIX .exe) + if (VCPKG_TARGET_ARCHITECTURE STREQUAL arm) + if (NOT EXISTS ${CURRENT_INSTALLED_DIR}/../x86-windows/tools/sqlite3-bin.exe) + message(FATAL_ERROR "Proj4 database need to install sqlite3[tool]:x86-windows first.") + endif() + set(SQLITE3_BIN_PATH ${CURRENT_INSTALLED_DIR}/../x86-windows/tools) + elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL arm64 OR (VCPKG_TARGET_ARCHITECTURE STREQUAL x64 AND VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)) + if (NOT EXISTS ${CURRENT_INSTALLED_DIR}/../x64-windows/tools/sqlite3-bin.exe) + message(FATAL_ERROR "Proj4 database need to install sqlite3[tool]:x64-windows first.") + endif() + set(SQLITE3_BIN_PATH ${CURRENT_INSTALLED_DIR}/../x64-windows/tools) + else() + set(SQLITE3_BIN_PATH ${CURRENT_INSTALLED_DIR}/tools) + 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 + OPTIONS ${FEATURE_OPTIONS} -DBUILD_LIBPROJ_SHARED=${VCPKG_BUILD_SHARED_LIBS} -DPROJ_LIB_SUBDIR=lib -DPROJ_INCLUDE_SUBDIR=include -DPROJ_DATA_SUBDIR=share/proj4 - -DPROJ_CMAKE_CONFIG_SUBDIR=share/proj4 - -DBUILD_CS2CS=NO - -DBUILD_PROJ=NO - -DBUILD_GEOD=NO - -DBUILD_NAD2BIN=NO - -DPROJ4_TESTS=NO + -DBUILD_CCT=OFF + -DBUILD_CS2CS=OFF + -DBUILD_GEOD=OFF + -DBUILD_GIE=OFF + -DBUILD_PROJ=OFF + -DBUILD_PROJINFO=OFF + -DPROJ_TESTS=OFF + -DEXE_SQLITE3=${SQLITE3_BIN_PATH}/sqlite3-bin${BIN_SUFFIX} ) vcpkg_install_cmake() -vcpkg_fixup_cmake_targets() - -# Rename library and adapt cmake configuration -if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") - file(READ ${CURRENT_PACKAGES_DIR}/share/proj4/proj4-targets-release.cmake _contents) - string(REPLACE "proj_4_9.lib" "proj.lib" _contents "${_contents}") - file(WRITE ${CURRENT_PACKAGES_DIR}/share/proj4/proj4-targets-release.cmake "${_contents}") -endif() - -if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") - file(READ ${CURRENT_PACKAGES_DIR}/share/proj4/proj4-targets-debug.cmake _contents) - string(REPLACE "proj_4_9_d.lib" "projd.lib" _contents "${_contents}") - file(WRITE ${CURRENT_PACKAGES_DIR}/share/proj4/proj4-targets-debug.cmake "${_contents}") -endif() - -file(READ ${CURRENT_PACKAGES_DIR}/share/proj4/proj4-targets.cmake _contents) -string(REPLACE "set(_IMPORT_PREFIX \"${CURRENT_PACKAGES_DIR}\")" - "set(_IMPORT_PREFIX \"\${CMAKE_CURRENT_LIST_DIR}\")\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)" - _contents "${_contents}" -) -file(WRITE ${CURRENT_PACKAGES_DIR}/share/proj4/proj4-targets.cmake "${_contents}") - -if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") - if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") - file(RENAME ${CURRENT_PACKAGES_DIR}/lib/proj_4_9.lib ${CURRENT_PACKAGES_DIR}/lib/proj.lib) - endif() - if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") - file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/proj_4_9_d.lib ${CURRENT_PACKAGES_DIR}/debug/lib/projd.lib) - endif() -endif() +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/proj4) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) diff --git a/ports/spatialite-tools/portfile.cmake b/ports/spatialite-tools/portfile.cmake index 2f23dbb7e..7a731fd3f 100644 --- a/ports/spatialite-tools/portfile.cmake +++ b/ports/spatialite-tools/portfile.cmake @@ -20,8 +20,8 @@ find_program(NMAKE nmake) set(LDIR "\"${CURRENT_INSTALLED_DIR}\"") if(VCPKG_CRT_LINKAGE STREQUAL dynamic) - set(CL_FLAGS_DBG "/MDd /Zi") - set(CL_FLAGS_REL "/MD /Ox") + set(CL_FLAGS_DBG "/MDd /Zi /DACCEPT_USE_OF_DEPRECATED_PROJ_API_H") + set(CL_FLAGS_REL "/MD /Ox /DACCEPT_USE_OF_DEPRECATED_PROJ_API_H") set(GEOS_LIBS_REL "${LDIR}/lib/geos_c.lib") set(GEOS_LIBS_DBG "${LDIR}/debug/lib/geos_cd.lib") set(LIBXML2_LIBS_REL "${LDIR}/lib/libxml2.lib") @@ -31,8 +31,8 @@ if(VCPKG_CRT_LINKAGE STREQUAL dynamic) set(ICONV_LIBS_REL "${LDIR}/lib/libiconv.lib") set(ICONV_LIBS_DBG "${LDIR}/debug/lib/libiconv.lib") else() - set(CL_FLAGS_DBG "/MTd /Zi") - set(CL_FLAGS_REL "/MT /Ox") + set(CL_FLAGS_DBG "/MTd /Zi /DACCEPT_USE_OF_DEPRECATED_PROJ_API_H") + set(CL_FLAGS_REL "/MT /Ox /DACCEPT_USE_OF_DEPRECATED_PROJ_API_H") set(GEOS_LIBS_REL "${LDIR}/lib/libgeos_c.lib ${LDIR}/lib/libgeos.lib") set(GEOS_LIBS_DBG "${LDIR}/debug/lib/libgeos_c.lib ${LDIR}/debug/lib/libgeos.lib") set(LIBXML2_LIBS_REL "${LDIR}/lib/libxml2.lib ${LDIR}/lib/lzma.lib ws2_32.lib") @@ -52,7 +52,7 @@ set(LIBS_ALL_DBG ${LDIR}/debug/lib/readosm.lib \ ${LDIR}/debug/lib/expat.lib \ ${LDIR}/debug/lib/zlibd.lib \ - ${LDIR}/debug/lib/projd.lib" + ${LDIR}/debug/lib/proj_d.lib" ) set(LIBS_ALL_REL "${ICONV_LIBS_REL} \ diff --git a/ports/sqlite3/CONTROL b/ports/sqlite3/CONTROL index b6667cdd8..3418b867e 100644 --- a/ports/sqlite3/CONTROL +++ b/ports/sqlite3/CONTROL @@ -1,5 +1,5 @@ Source: sqlite3 -Version: 3.30.1 +Version: 3.30.1-1 Homepage: https://sqlite.org/ Description: SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. diff --git a/ports/vtk/fix-proj4.patch b/ports/vtk/fix-proj4.patch new file mode 100644 index 000000000..ad49b1523 --- /dev/null +++ b/ports/vtk/fix-proj4.patch @@ -0,0 +1,175 @@ +diff --git a/Geovis/Core/vtkGeoProjection.cxx b/Geovis/Core/vtkGeoProjection.cxx +index f3a8852..8240603 100644 +--- a/Geovis/Core/vtkGeoProjection.cxx ++++ b/Geovis/Core/vtkGeoProjection.cxx +@@ -72,6 +72,9 @@ public: + } + + std::map< std::string, std::string > OptionalParameters; ++#if PROJ_VERSION_MAJOR >= 5 ++ PJ_PROJ_INFO ProjInfo; ++#endif + }; + + //----------------------------------------------------------------------------- +@@ -80,7 +83,7 @@ int vtkGeoProjection::GetNumberOfProjections() + if ( vtkGeoProjectionNumProj < 0 ) + { + vtkGeoProjectionNumProj = 0; +- for ( const PJ_LIST* pj = pj_get_list_ref(); pj && pj->id; ++ pj ) ++ for ( const PJ_LIST* pj = proj_list_operations(); pj && pj->id; ++ pj ) + ++ vtkGeoProjectionNumProj; + } + return vtkGeoProjectionNumProj; +@@ -91,7 +94,7 @@ const char* vtkGeoProjection::GetProjectionName( int projection ) + if ( projection < 0 || projection >= vtkGeoProjection::GetNumberOfProjections() ) + return nullptr; + +- return pj_get_list_ref()[projection].id; ++ return proj_list_operations()[projection].id; + } + //----------------------------------------------------------------------------- + const char* vtkGeoProjection::GetProjectionDescription( int projection ) +@@ -99,7 +102,7 @@ const char* vtkGeoProjection::GetProjectionDescription( int projection ) + if ( projection < 0 || projection >= vtkGeoProjection::GetNumberOfProjections() ) + return nullptr; + +- return pj_get_list_ref()[projection].descr[0]; ++ return proj_list_operations()[projection].descr[0]; + } + //----------------------------------------------------------------------------- + vtkGeoProjection::vtkGeoProjection() +@@ -144,7 +147,7 @@ void vtkGeoProjection::PrintSelf( ostream& os, vtkIndent indent ) + int vtkGeoProjection::GetIndex() + { + int i = 0; +- for ( const PJ_LIST* proj = pj_get_list_ref(); proj && proj->id; ++ proj, ++ i ) ++ for ( const PJ_LIST* proj = proj_list_operations(); proj && proj->id; ++ proj, ++ i ) + { + if ( ! strcmp( proj->id, this->Name ) ) + { +@@ -161,7 +164,11 @@ const char* vtkGeoProjection::GetDescription() + { + return nullptr; + } ++#if PROJ_VERSION_MAJOR >= 5 ++ return this->Internals->ProjInfo.description; ++#else + return this->Projection->descr; ++#endif + } + //----------------------------------------------------------------------------- + projPJ vtkGeoProjection::GetProjection() +@@ -232,6 +239,9 @@ int vtkGeoProjection::UpdateProjection() + this->ProjectionMTime = this->GetMTime(); + if ( this->Projection ) + { ++#if PROJ_VERSION_MAJOR >= 5 ++ this->Internals->ProjInfo = proj_pj_info(this->Projection); ++#endif + return 0; + } + return 1; +diff --git a/Geovis/Core/vtkGeoTransform.cxx b/Geovis/Core/vtkGeoTransform.cxx +index aeeabc1..b80a8c0 100644 +--- a/Geovis/Core/vtkGeoTransform.cxx ++++ b/Geovis/Core/vtkGeoTransform.cxx +@@ -167,9 +167,17 @@ void vtkGeoTransform::InternalTransformPoints( double* x, vtkIdType numPts, int + double* coord = x; + for ( vtkIdType i = 0; i < numPts; ++ i ) + { ++#if PROJ_VERSION_MAJOR >= 5 ++ xy.x = coord[0]; xy.y = coord[1]; ++#else + xy.u = coord[0]; xy.v = coord[1]; ++#endif + lp = pj_inv( xy, src ); ++#if PROJ_VERSION_MAJOR >= 5 ++ coord[0] = lp.lam; coord[1] = lp.phi; ++#else + coord[0] = lp.u; coord[1] = lp.v; ++#endif + coord += stride; + } + } +@@ -191,9 +199,17 @@ void vtkGeoTransform::InternalTransformPoints( double* x, vtkIdType numPts, int + double* coord = x; + for ( vtkIdType i = 0; i < numPts; ++ i ) + { ++#if PROJ_VERSION_MAJOR >= 5 ++ lp.lam = coord[0]; lp.phi = coord[1]; ++#else + lp.u = coord[0]; lp.v = coord[1]; ++#endif + xy = pj_fwd( lp, dst ); ++#if PROJ_VERSION_MAJOR >= 5 ++ coord[0] = xy.x; coord[1] = xy.y; ++#else + coord[0] = xy.u; coord[1] = xy.v; ++#endif + coord += stride; + } + } +diff --git a/ThirdParty/libproj/CMakeLists.txt b/ThirdParty/libproj/CMakeLists.txt +index a19609e..e23e44b 100644 +--- a/ThirdParty/libproj/CMakeLists.txt ++++ b/ThirdParty/libproj/CMakeLists.txt +@@ -1,4 +1,9 @@ + vtk_module_third_party(LibPROJ + LIBRARIES vtklibproj ++ USE_VARIABLES LibPROJ_MAJOR_VERSION + INCLUDE_DIRS ${vtklibproj_SOURCE_DIR}/vtklibproj + ${vtklibproj_BINARY_DIR}/vtklibproj) ++ ++if (NOT VTK_MODULE_USE_EXTERNAL_VTK_libproj) ++ set(LibPROJ_MAJOR_VERSION "4") ++endif () +\ No newline at end of file +diff --git a/ThirdParty/libproj/vtk_libproj.h.in b/ThirdParty/libproj/vtk_libproj.h.in +index cd9edc3..d441a1a 100644 +--- a/ThirdParty/libproj/vtk_libproj.h.in ++++ b/ThirdParty/libproj/vtk_libproj.h.in +@@ -17,8 +17,23 @@ + + /* Use the libproj library configured for VTK. */ + #cmakedefine VTK_USE_SYSTEM_LIBPROJ ++ ++#define VTK_LibPROJ_MAJOR_VERSION @LibPROJ_MAJOR_VERSION@ ++ ++#if VTK_LibPROJ_MAJOR_VERSION < 5 ++# define PROJ_VERSION_MAJOR @LibPROJ_MAJOR_VERSION@ ++# define proj_list_operations pj_get_list_ref ++#endif + #ifdef VTK_USE_SYSTEM_LIBPROJ +-# include ++# if VTK_LibPROJ_MAJOR_VERSION >= 5 ++# include ++# endif ++# if VTK_LibPROJ_MAJOR_VERSION < 6 ++# include ++# endif ++# if VTK_LibPROJ_MAJOR_VERSION >= 6 ++# define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 1 ++# endif + # include + # include + #else +diff --git a/CMake/FindLibPROJ.cmake b/CMake/FindLibPROJ.cmake +index 2d8301d..d8d08cd 100644 +--- a/CMake/FindLibPROJ.cmake ++++ b/CMake/FindLibPROJ.cmake +@@ -5,6 +5,14 @@ + # LibPROJ_LIBRARIES to libproj4 and any dependent libraries + # If LibPROJ_REQUIRED is defined, then a fatal error message will be generated if libproj4 is not found + ++find_package(PROJ4 6 CONFIG REQUIRED) ++if (PROJ4_FOUND) ++ set(LibPROJ_FOUND 1) ++ set(LibPROJ_INCLUDE_DIR ${PROJ4_INCLUDE_DIRS}) ++ set(LibPROJ_LIBRARIES ${PROJ_LIBRARY}) ++ set(LibPROJ_MAJOR_VERSION 6) ++endif() ++ + if ( NOT LibPROJ_INCLUDE_DIR OR NOT LibPROJ_LIBRARIES OR NOT LibPROJ_FOUND ) + + if ( $ENV{LibPROJ_DIR} ) diff --git a/ports/vtk/portfile.cmake b/ports/vtk/portfile.cmake index e487d879e..c2d12c498 100644 --- a/ports/vtk/portfile.cmake +++ b/ports/vtk/portfile.cmake @@ -33,6 +33,7 @@ vcpkg_from_github( fix-pugixml-link.patch hdf5_static.patch fix-find-lzma.patch + fix-proj4.patch ) # Remove the FindGLEW.cmake and FindPythonLibs.cmake that are distributed with VTK, @@ -77,9 +78,13 @@ if(VTK_WITH_ALL_MODULES) # -DVTK_USE_SYSTEM_XDMF3=ON # -DVTK_USE_SYSTEM_ZFP=ON # -DVTK_USE_SYSTEM_ZOPE=ON + # -DVTK_USE_SYSTEM_LIBPROJ=ON ) endif() +set(PROJ_LIBRARY_REL "${CURRENT_INSTALLED_DIR}/lib/proj.lib") +set(PROJ_LIBRARY_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/proj_d.lib") + # ============================================================================= # Configure & Install @@ -106,6 +111,10 @@ vcpkg_configure_cmake( -DPYTHON_EXECUTABLE=${PYTHON3} ${ADDITIONAL_OPTIONS} + OPTIONS_RELEASE + -DPROJ_LIBRARY=${PROJ_LIBRARY_REL} + OPTIONS_DEBUG + -DPROJ_LIBRARY=${PROJ_LIBRARY_DBG} ) vcpkg_install_cmake()