[gdal] Fix static windows builds, fix debug builds (#26457)

* Fix static builds

* Update versions

* Fix Qhull usage

* Update versions
This commit is contained in:
Kai Pastor 2022-08-22 18:33:47 +02:00 committed by GitHub
parent 58df5a8bf7
commit e8f9c3391d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 58 additions and 2 deletions

View File

@ -0,0 +1,45 @@
diff --git a/cmake/helpers/configure.cmake b/cmake/helpers/configure.cmake
index 652edf1..0d1441b 100644
--- a/cmake/helpers/configure.cmake
+++ b/cmake/helpers/configure.cmake
@@ -42,6 +42,10 @@ check_type_size("int" SIZEOF_INT)
check_type_size("unsigned long" SIZEOF_UNSIGNED_LONG)
check_type_size("void*" SIZEOF_VOIDP)
+if(MSVC AND NOT BUILD_SHARED_LIBS)
+ set(CPL_DISABLE_DLL 1)
+endif()
+
if (MSVC)
set(HAVE_VSNPRINTF 1)
diff --git a/cmake/template/cpl_config.h.in b/cmake/template/cpl_config.h.in
index c85d3b0..19d3f0a 100644
--- a/cmake/template/cpl_config.h.in
+++ b/cmake/template/cpl_config.h.in
@@ -177,6 +177,9 @@
/* Define to 1 if the compiler supports -Wzero-as-null-pointer-constant */
#cmakedefine HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT @HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT@
+/* Define if building a static windows lib */
+#cmakedefine CPL_DISABLE_DLL @CPL_DISABLE_DLL@
+
/* Define to 1 if you have the <atlbase.h> header file. */
#cmakedefine HAVE_ATLBASE_H 1
diff --git a/gdal.cmake b/gdal.cmake
index ff1ca7e..7712f1d 100644
--- a/gdal.cmake
+++ b/gdal.cmake
@@ -336,11 +336,6 @@ if (MINGW AND BUILD_SHARED_LIBS)
set_target_properties(${GDAL_LIB_TARGET_NAME} PROPERTIES SUFFIX "-${GDAL_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif ()
-
-if (MSVC AND NOT BUILD_SHARED_LIBS)
- target_compile_definitions(${GDAL_LIB_TARGET_NAME} PUBLIC CPL_DISABLE_DLL=)
-endif ()
-
if (MINGW)
if (TARGET_CPU MATCHES "x86_64")
add_definitions(-m64)

View File

@ -6,6 +6,7 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
find-link-libraries.patch
cpl-disable-dll.patch
)
# `vcpkg clean` stumbles over one subdir
file(REMOVE_RECURSE "${SOURCE_PATH}/autotest")
@ -64,6 +65,8 @@ if(VCPKG_TARGET_IS_ANDROID AND ANRDOID_PLATFORM VERSION_LESS 24 AND (VCPKG_TARGE
list(APPEND FEATURE_OPTIONS -DBUILD_WITHOUT_64BIT_OFFSET=ON)
endif()
string(REPLACE "dynamic" "" qhull_target "Qhull::qhull${VCPKG_LIBRARY_LINKAGE}_r")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
@ -82,6 +85,9 @@ vcpkg_cmake_configure(
-DOGR_BUILD_OPTIONAL_DRIVERS=ON
-DGDAL_CHECK_PACKAGE_NetCDF_NAMES=netCDF
-DGDAL_CHECK_PACKAGE_NetCDF_TARGETS=netCDF::netcdf
-DGDAL_CHECK_PACKAGE_QHULL_NAMES=Qhull
"-DGDAL_CHECK_PACKAGE_QHULL_TARGETS=${qhull_target}"
"-DQHULL_LIBRARY=${qhull_target}"
OPTIONS_RELEASE
${FEATURE_OPTIONS_RELEASE}
OPTIONS_DEBUG

View File

@ -1,7 +1,7 @@
{
"name": "gdal",
"version-semver": "3.5.1",
"port-version": 5,
"port-version": 6,
"description": "The Geographic Data Abstraction Library for reading and writing geospatial raster and vector data",
"homepage": "https://gdal.org",
"license": null,

View File

@ -2482,7 +2482,7 @@
},
"gdal": {
"baseline": "3.5.1",
"port-version": 5
"port-version": 6
},
"gdcm": {
"baseline": "3.0.12",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "548d8ee81b0b34493dc57b3610fb19db2403bb50",
"version-semver": "3.5.1",
"port-version": 6
},
{
"git-tree": "e875fbb6dc288ea2719e00a6b71b4834b8814640",
"version-semver": "3.5.1",