2018-05-18 14:46:04 +08:00
|
|
|
# vcpkg portfile.cmake for GDAL
|
|
|
|
#
|
|
|
|
# NOTE: update the version and checksum for new GDAL release
|
2019-05-03 13:57:43 +08:00
|
|
|
include(vcpkg_common_functions)
|
|
|
|
|
2019-04-24 04:15:23 +08:00
|
|
|
set(GDAL_VERSION_STR "2.4.1")
|
|
|
|
set(GDAL_VERSION_PKG "241")
|
2019-01-26 10:34:31 +08:00
|
|
|
set(GDAL_VERSION_LIB "204")
|
2019-04-24 04:15:23 +08:00
|
|
|
set(GDAL_PACKAGE_SUM "edb9679ee6788334cf18971c803615ac9b1c72bc0c96af8fd4852cb7e8f58e9c4f3d9cb66406bc8654419612e1a7e9d0e62f361712215f4a50120f646bb0a738")
|
2018-05-18 14:46:04 +08:00
|
|
|
|
2016-11-24 01:30:50 +08:00
|
|
|
if (TRIPLET_SYSTEM_ARCH MATCHES "arm")
|
2018-03-18 11:01:13 +08:00
|
|
|
message(FATAL_ERROR "ARM is currently not supported.")
|
2016-11-24 01:30:50 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
vcpkg_download_distfile(ARCHIVE
|
2018-05-18 14:46:04 +08:00
|
|
|
URLS "http://download.osgeo.org/gdal/${GDAL_VERSION_STR}/gdal${GDAL_VERSION_PKG}.zip"
|
|
|
|
FILENAME "gdal${GDAL_VERSION_PKG}.zip"
|
|
|
|
SHA512 ${GDAL_PACKAGE_SUM}
|
2018-10-13 06:12:15 +08:00
|
|
|
)
|
2016-11-24 01:30:50 +08:00
|
|
|
|
2018-03-18 11:01:13 +08:00
|
|
|
# Extract source into architecture specific directory, because GDALs' nmake based build currently does not
|
2016-11-24 01:30:50 +08:00
|
|
|
# support out of source builds.
|
2018-05-18 14:46:04 +08:00
|
|
|
set(SOURCE_PATH_DEBUG ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-debug/gdal-${GDAL_VERSION_STR})
|
|
|
|
set(SOURCE_PATH_RELEASE ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-release/gdal-${GDAL_VERSION_STR})
|
2016-11-24 01:30:50 +08:00
|
|
|
|
2018-10-13 06:12:15 +08:00
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
list(APPEND BUILD_TYPES "release")
|
|
|
|
endif()
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
list(APPEND BUILD_TYPES "debug")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
foreach(BUILD_TYPE IN LISTS BUILD_TYPES)
|
2018-03-18 11:01:13 +08:00
|
|
|
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE})
|
2016-11-30 17:24:10 +08:00
|
|
|
vcpkg_extract_source_archive(${ARCHIVE} ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE})
|
2019-04-05 16:38:24 +08:00
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
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
|
|
|
|
)
|
|
|
|
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
|
|
|
|
)
|
|
|
|
endif()
|
2019-05-10 06:00:16 +08:00
|
|
|
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
|
|
|
|
)
|
2016-11-24 01:30:50 +08:00
|
|
|
endforeach()
|
|
|
|
|
2019-04-05 16:38:24 +08:00
|
|
|
|
2016-11-24 01:30:50 +08:00
|
|
|
find_program(NMAKE nmake REQUIRED)
|
|
|
|
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" NATIVE_PACKAGES_DIR)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}/share/gdal" NATIVE_DATA_DIR)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}/share/gdal/html" NATIVE_HTML_DIR)
|
|
|
|
|
2017-01-09 18:04:18 +08:00
|
|
|
# Setup proj4 libraries + include path
|
2016-12-06 16:57:58 +08:00
|
|
|
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)
|
2016-11-24 01:30:50 +08:00
|
|
|
|
2017-01-09 18:04:18 +08:00
|
|
|
# Setup libpng libraries + include path
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" PNG_INCLUDE_DIR)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/libpng16.lib" PNG_LIBRARY_REL)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/libpng16d.lib" PNG_LIBRARY_DBG)
|
|
|
|
|
2019-05-07 01:44:27 +08:00
|
|
|
# Setup zlib libraries + include path
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" ZLIB_INCLUDE_DIR)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/zlib.lib" ZLIB_LIBRARY_REL)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/zlibd.lib" ZLIB_LIBRARY_DBG)
|
|
|
|
|
2017-04-24 03:05:05 +08:00
|
|
|
# Setup geos libraries + include path
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" GEOS_INCLUDE_DIR)
|
2019-04-01 00:32:29 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/libgeos.lib" GEOS_LIBRARY_REL)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/libgeosd.lib" GEOS_LIBRARY_DBG)
|
|
|
|
else()
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/geos_c.lib" GEOS_LIBRARY_REL)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/geos_cd.lib" GEOS_LIBRARY_DBG)
|
|
|
|
endif()
|
2017-04-24 03:05:05 +08:00
|
|
|
|
2017-04-28 22:54:01 +08:00
|
|
|
# Setup expat libraries + include path
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" EXPAT_INCLUDE_DIR)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/expat.lib" EXPAT_LIBRARY_REL)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/expat.lib" EXPAT_LIBRARY_DBG)
|
|
|
|
|
|
|
|
# Setup curl libraries + include path
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" CURL_INCLUDE_DIR)
|
2017-08-16 22:32:33 +08:00
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/libcurl.lib" CURL_LIBRARY_REL)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/libcurl.lib" CURL_LIBRARY_DBG)
|
2017-04-28 22:54:01 +08:00
|
|
|
|
|
|
|
# Setup sqlite3 libraries + include path
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" SQLITE_INCLUDE_DIR)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/sqlite3.lib" SQLITE_LIBRARY_REL)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/sqlite3.lib" SQLITE_LIBRARY_DBG)
|
|
|
|
|
|
|
|
# Setup PostgreSQL libraries + include path
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" PGSQL_INCLUDE_DIR)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/libpq.lib" PGSQL_LIBRARY_REL)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/libpqd.lib" PGSQL_LIBRARY_DBG)
|
|
|
|
|
2017-04-29 12:38:35 +08:00
|
|
|
# Setup OpenJPEG libraries + include path
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" OPENJPEG_INCLUDE_DIR)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/openjp2.lib" OPENJPEG_LIBRARY_REL)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/openjp2.lib" OPENJPEG_LIBRARY_DBG)
|
|
|
|
|
|
|
|
# Setup WebP libraries + include path
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" WEBP_INCLUDE_DIR)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/webp.lib" WEBP_LIBRARY_REL)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/webpd.lib" WEBP_LIBRARY_DBG)
|
|
|
|
|
|
|
|
# Setup libxml2 libraries + include path
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" XML2_INCLUDE_DIR)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/libxml2.lib" XML2_LIBRARY_REL)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/libxml2.lib" XML2_LIBRARY_DBG)
|
|
|
|
|
|
|
|
# Setup liblzma libraries + include path
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" LZMA_INCLUDE_DIR)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/lzma.lib" LZMA_LIBRARY_REL)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/lzma.lib" LZMA_LIBRARY_DBG)
|
|
|
|
|
2018-10-13 06:12:15 +08:00
|
|
|
if("mysql-libmysql" IN_LIST FEATURES OR "mysql-libmariadb" IN_LIST FEATURES)
|
|
|
|
# Setup MySQL libraries + include path
|
|
|
|
if("mysql-libmysql" IN_LIST FEATURES)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include/mysql" MYSQL_INCLUDE_DIR)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/libmysql.lib" MYSQL_LIBRARY_REL)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/libmysql.lib" MYSQL_LIBRARY_DBG)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if("mysql-libmariadb" IN_LIST FEATURES)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include/mysql" MYSQL_INCLUDE_DIR)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/libmariadb.lib" MYSQL_LIBRARY_REL)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/libmariadb.lib" MYSQL_LIBRARY_DBG)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
list(APPEND NMAKE_OPTIONS MYSQL_INC_DIR=${MYSQL_INCLUDE_DIR})
|
|
|
|
list(APPEND NMAKE_OPTIONS_REL MYSQL_LIB=${MYSQL_LIBRARY_REL})
|
|
|
|
list(APPEND NMAKE_OPTIONS_DBG MYSQL_LIB=${MYSQL_LIBRARY_DBG})
|
|
|
|
endif()
|
|
|
|
|
2019-05-05 09:35:25 +08:00
|
|
|
if ("libspatialite" IN_LIST FEATURES)
|
|
|
|
# Setup spatialite libraries + include path
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include/spatialite" SPATIALITE_INCLUDE_DIR)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/spatialite.lib" SPATIALITE_LIBRARY_REL)
|
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/spatialite.lib" SPATIALITE_LIBRARY_DBG)
|
|
|
|
set(HAVE_SPATIALITE "-DHAVE_SPATIALITE")
|
|
|
|
endif()
|
|
|
|
|
2018-10-13 06:12:15 +08:00
|
|
|
list(APPEND NMAKE_OPTIONS
|
2016-11-24 01:30:50 +08:00
|
|
|
GDAL_HOME=${NATIVE_PACKAGES_DIR}
|
|
|
|
DATADIR=${NATIVE_DATA_DIR}
|
|
|
|
HTMLDIR=${NATIVE_HTML_DIR}
|
2017-04-24 03:05:05 +08:00
|
|
|
GEOS_DIR=${GEOS_INCLUDE_DIR}
|
|
|
|
"GEOS_CFLAGS=-I${GEOS_INCLUDE_DIR} -DHAVE_GEOS"
|
2016-11-24 01:30:50 +08:00
|
|
|
PROJ_INCLUDE=-I${PROJ_INCLUDE_DIR}
|
2017-04-28 22:54:01 +08:00
|
|
|
EXPAT_DIR=${EXPAT_INCLUDE_DIR}
|
|
|
|
EXPAT_INCLUDE=-I${EXPAT_INCLUDE_DIR}
|
|
|
|
CURL_INC=-I${CURL_INCLUDE_DIR}
|
2019-05-05 09:35:25 +08:00
|
|
|
"SQLITE_INC=-I${SQLITE_INCLUDE_DIR} ${HAVE_SPATIALITE}"
|
2017-04-28 22:54:01 +08:00
|
|
|
PG_INC_DIR=${PGSQL_INCLUDE_DIR}
|
2017-04-29 12:38:35 +08:00
|
|
|
OPENJPEG_ENABLED=YES
|
|
|
|
OPENJPEG_CFLAGS=-I${OPENJPEG_INCLUDE_DIR}
|
|
|
|
OPENJPEG_VERSION=20100
|
|
|
|
WEBP_ENABLED=YES
|
|
|
|
WEBP_CFLAGS=-I${WEBP_INCLUDE_DIR}
|
|
|
|
LIBXML2_INC=-I${XML2_INCLUDE_DIR}
|
2017-01-09 18:04:18 +08:00
|
|
|
PNG_EXTERNAL_LIB=1
|
|
|
|
PNGDIR=${PNG_INCLUDE_DIR}
|
2019-05-07 01:44:27 +08:00
|
|
|
ZLIB_INC=-I${ZLIB_INCLUDE_DIR}
|
|
|
|
ZLIB_EXTERNAL_LIB=1
|
2016-11-24 01:30:50 +08:00
|
|
|
MSVC_VER=1900
|
|
|
|
)
|
|
|
|
|
2016-12-06 16:57:58 +08:00
|
|
|
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
2016-11-24 01:30:50 +08:00
|
|
|
list(APPEND NMAKE_OPTIONS WIN64=YES)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
2016-11-30 17:26:18 +08:00
|
|
|
list(APPEND NMAKE_OPTIONS PROJ_FLAGS=-DPROJ_STATIC)
|
2019-03-28 02:47:15 +08:00
|
|
|
list(APPEND NMAKE_OPTIONS CURL_CFLAGS=-DCURL_STATICLIB)
|
2017-04-28 22:54:01 +08:00
|
|
|
else()
|
2016-11-30 17:26:18 +08:00
|
|
|
# Enables PDBs for release and debug builds
|
|
|
|
list(APPEND NMAKE_OPTIONS WITH_PDB=1)
|
2016-11-24 01:30:50 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (VCPKG_CRT_LINKAGE STREQUAL static)
|
|
|
|
set(LINKAGE_FLAGS "/MT")
|
|
|
|
else()
|
|
|
|
set(LINKAGE_FLAGS "/MD")
|
|
|
|
endif()
|
|
|
|
|
2018-10-13 06:12:15 +08:00
|
|
|
list(APPEND NMAKE_OPTIONS_REL
|
|
|
|
${NMAKE_OPTIONS}
|
2016-11-24 01:30:50 +08:00
|
|
|
CXX_CRT_FLAGS=${LINKAGE_FLAGS}
|
|
|
|
PROJ_LIBRARY=${PROJ_LIBRARY_REL}
|
2017-01-09 18:04:18 +08:00
|
|
|
PNG_LIB=${PNG_LIBRARY_REL}
|
2017-04-24 03:05:05 +08:00
|
|
|
GEOS_LIB=${GEOS_LIBRARY_REL}
|
2017-04-28 22:54:01 +08:00
|
|
|
EXPAT_LIB=${EXPAT_LIBRARY_REL}
|
|
|
|
"CURL_LIB=${CURL_LIBRARY_REL} wsock32.lib wldap32.lib winmm.lib"
|
2019-05-05 09:35:25 +08:00
|
|
|
"SQLITE_LIB=${SQLITE_LIBRARY_REL} ${SPATIALITE_LIBRARY_REL}"
|
2017-04-29 12:38:35 +08:00
|
|
|
OPENJPEG_LIB=${OPENJPEG_LIBRARY_REL}
|
|
|
|
WEBP_LIBS=${WEBP_LIBRARY_REL}
|
|
|
|
LIBXML2_LIB=${XML2_LIBRARY_REL}
|
2019-05-07 01:44:27 +08:00
|
|
|
ZLIB_LIB=${ZLIB_LIBRARY_REL}
|
2016-11-24 01:30:50 +08:00
|
|
|
)
|
2019-03-28 02:47:15 +08:00
|
|
|
if(NOT VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
# Static Build does not like PG_LIB
|
|
|
|
list(APPEND NMAKE_OPTIONS_REL PG_LIB=${PGSQL_LIBRARY_REL})
|
|
|
|
endif()
|
2016-11-30 17:26:18 +08:00
|
|
|
|
2018-10-13 06:12:15 +08:00
|
|
|
list(APPEND NMAKE_OPTIONS_DBG
|
|
|
|
${NMAKE_OPTIONS}
|
2016-11-24 01:30:50 +08:00
|
|
|
CXX_CRT_FLAGS="${LINKAGE_FLAGS}d"
|
|
|
|
PROJ_LIBRARY=${PROJ_LIBRARY_DBG}
|
2017-04-24 03:05:05 +08:00
|
|
|
PNG_LIB=${PNG_LIBRARY_DBG}
|
|
|
|
GEOS_LIB=${GEOS_LIBRARY_DBG}
|
2017-04-28 22:54:01 +08:00
|
|
|
EXPAT_LIB=${EXPAT_LIBRARY_DBG}
|
|
|
|
"CURL_LIB=${CURL_LIBRARY_DBG} wsock32.lib wldap32.lib winmm.lib"
|
2019-05-05 09:35:25 +08:00
|
|
|
"SQLITE_LIB=${SQLITE_LIBRARY_DBG} ${SPATIALITE_LIBRARY_DBG}"
|
2017-04-29 12:38:35 +08:00
|
|
|
OPENJPEG_LIB=${OPENJPEG_LIBRARY_DBG}
|
|
|
|
WEBP_LIBS=${WEBP_LIBRARY_DBG}
|
|
|
|
LIBXML2_LIB=${XML2_LIBRARY_DBG}
|
2019-05-07 01:44:27 +08:00
|
|
|
ZLIB_LIB=${ZLIB_LIBRARY_DBG}
|
2016-11-24 01:30:50 +08:00
|
|
|
DEBUG=1
|
|
|
|
)
|
2019-03-28 02:47:15 +08:00
|
|
|
if(NOT VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
# Static Build does not like PG_LIB
|
2019-04-03 01:44:46 +08:00
|
|
|
list(APPEND NMAKE_OPTIONS_DBG PG_LIB=${PGSQL_LIBRARY_DBG})
|
2019-03-28 02:47:15 +08:00
|
|
|
endif()
|
2018-10-04 14:09:42 +08:00
|
|
|
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
################
|
|
|
|
# Release build
|
|
|
|
################
|
|
|
|
message(STATUS "Building ${TARGET_TRIPLET}-rel")
|
|
|
|
vcpkg_execute_required_process(
|
2017-04-28 22:54:01 +08:00
|
|
|
COMMAND ${NMAKE} -f makefile.vc
|
2016-11-24 01:30:50 +08:00
|
|
|
"${NMAKE_OPTIONS_REL}"
|
|
|
|
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
|
|
|
|
LOGNAME nmake-build-${TARGET_TRIPLET}-release
|
2018-10-04 14:09:42 +08:00
|
|
|
)
|
|
|
|
message(STATUS "Building ${TARGET_TRIPLET}-rel done")
|
|
|
|
endif()
|
2016-11-24 01:30:50 +08:00
|
|
|
|
2018-10-04 14:09:42 +08:00
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
################
|
|
|
|
# Debug build
|
|
|
|
################
|
|
|
|
message(STATUS "Building ${TARGET_TRIPLET}-dbg")
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND ${NMAKE} /G -f makefile.vc
|
|
|
|
"${NMAKE_OPTIONS_DBG}"
|
|
|
|
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
|
|
|
|
LOGNAME nmake-build-${TARGET_TRIPLET}-debug
|
|
|
|
)
|
|
|
|
message(STATUS "Building ${TARGET_TRIPLET}-dbg done")
|
|
|
|
endif()
|
2016-11-24 01:30:50 +08:00
|
|
|
|
|
|
|
message(STATUS "Packaging ${TARGET_TRIPLET}")
|
2019-03-28 02:47:15 +08:00
|
|
|
|
|
|
|
if(NOT VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/gdal/html)
|
|
|
|
endif()
|
2016-11-24 01:30:50 +08:00
|
|
|
|
|
|
|
vcpkg_execute_required_process(
|
2017-04-28 22:54:01 +08:00
|
|
|
COMMAND ${NMAKE} -f makefile.vc
|
2016-11-24 01:30:50 +08:00
|
|
|
"${NMAKE_OPTIONS_REL}"
|
|
|
|
"install"
|
|
|
|
"devinstall"
|
|
|
|
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
|
|
|
|
LOGNAME nmake-install-${TARGET_TRIPLET}
|
|
|
|
)
|
|
|
|
|
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
|
|
|
|
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/gdal_i.lib)
|
2018-10-04 14:09:42 +08:00
|
|
|
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
file(COPY ${SOURCE_PATH_RELEASE}/gdal.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
file(COPY ${SOURCE_PATH_DEBUG}/gdal.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
|
|
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gdal.lib ${CURRENT_PACKAGES_DIR}/debug/lib/gdald.lib)
|
|
|
|
endif()
|
2019-03-28 02:47:15 +08:00
|
|
|
|
2016-11-24 01:30:50 +08:00
|
|
|
else()
|
2019-03-13 06:58:40 +08:00
|
|
|
|
|
|
|
set(GDAL_TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools/gdal)
|
|
|
|
file(MAKE_DIRECTORY ${GDAL_TOOL_PATH})
|
|
|
|
|
|
|
|
file(GLOB GDAL_TOOLS ${CURRENT_PACKAGES_DIR}/bin/*.exe)
|
|
|
|
file(COPY ${GDAL_TOOLS} DESTINATION ${GDAL_TOOL_PATH})
|
|
|
|
file(REMOVE_RECURSE ${GDAL_TOOLS})
|
|
|
|
|
|
|
|
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/gdal.lib)
|
2018-10-04 14:09:42 +08:00
|
|
|
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gdal_i.lib ${CURRENT_PACKAGES_DIR}/lib/gdal.lib)
|
|
|
|
endif()
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
file(COPY ${SOURCE_PATH_DEBUG}/gdal${GDAL_VERSION_LIB}.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
|
|
|
|
file(COPY ${SOURCE_PATH_DEBUG}/gdal_i.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
|
|
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gdal_i.lib ${CURRENT_PACKAGES_DIR}/debug/lib/gdald.lib)
|
|
|
|
endif()
|
2016-11-24 01:30:50 +08:00
|
|
|
endif()
|
2016-11-30 17:26:18 +08:00
|
|
|
|
|
|
|
# Copy over PDBs
|
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
|
2016-11-24 01:30:50 +08:00
|
|
|
# Handle copyright
|
2018-10-24 07:00:37 +08:00
|
|
|
configure_file(${SOURCE_PATH_RELEASE}/LICENSE.TXT ${CURRENT_PACKAGES_DIR}/share/gdal/copyright COPYONLY)
|