Skip to content

Commit a641f7d

Browse files
gdal: Add version 3.12 and some fixes (conan-io#28957)
* Simplified cmake/ConanFindPackage.cmake, avoid using arrow patch and added gdal/3.12.0 * typo * typo * Using libtiff as version range
1 parent a362fbc commit a641f7d

14 files changed

+75
-284
lines changed

recipes/gdal/config.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
versions:
2+
"3.12.0":
3+
folder: "post_3.5.0"
24
"3.10.3":
35
folder: "post_3.5.0"
46
"3.8.3":
57
folder: "post_3.5.0"
6-
"3.7.3":
7-
folder: "post_3.5.0"
8-
"3.5.3":
9-
folder: "post_3.5.0"
108
"3.4.3":
119
folder: "pre_3.5.0"
1210
"3.4.1":
Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
function(define_find_package2 pkgname include_file library_name)
22
endfunction()
33
function(find_package2 pkgname)
4-
# Remove args unsupported by find_package()
5-
list(REMOVE_ITEM ARGN OUT_DEPENDENCY _find_dependency)
6-
# Force CONFIG mode
7-
list(REMOVE_ITEM ARGN MODULE NO_CONFIG NO_MODULE)
8-
string(TOUPPER ${pkgname} key)
9-
if(DEFINED GDAL_USE_${key} AND NOT GDAL_USE_${key})
10-
set(${pkgname}_FOUND)
11-
set(${key}_FOUND)
12-
return()
13-
endif()
14-
find_package(${pkgname} ${ARGN}
4+
find_package(${pkgname}
155
QUIET
166
CONFIG
177
GLOBAL
@@ -26,23 +16,12 @@ function(find_package2 pkgname)
2616
list(APPEND targets ${lib})
2717
endif()
2818
endforeach()
29-
# Add upper-case variables
30-
set(${key}_DEFINITIONS "${${pkgname}_DEFINITIONS}" CACHE STRING "")
31-
set(${key}_FOUND ${${pkgname}_FOUND} CACHE BOOL "")
32-
set(${key}_INCLUDE_DIR "${${pkgname}_INCLUDE_DIR}" CACHE STRING "")
33-
set(${key}_INCLUDE_DIRS "${${pkgname}_INCLUDE_DIRS}" CACHE STRING "")
34-
set(${key}_LIBRARIES "${${pkgname}_LIBRARIES}" CACHE STRING "")
35-
set(${key}_LIBRARY "${${pkgname}_LIBRARIES}" CACHE STRING "")
36-
set(${key}_TARGET "${targets}" CACHE STRING "")
37-
set(${key}_VERSION ${${pkgname}_VERSION} CACHE BOOL "")
38-
39-
# Add as cache vars for global visibility
19+
set(${pkgname}_DEFINITIONS "${${pkgname}_DEFINITIONS}" CACHE STRING "")
4020
set(${pkgname}_FOUND ${${pkgname}_FOUND} CACHE BOOL "")
21+
set(${pkgname}_INCLUDE_DIR "${${pkgname}_INCLUDE_DIR}" CACHE STRING "")
22+
set(${pkgname}_INCLUDE_DIRS "${${pkgname}_INCLUDE_DIRS}" CACHE STRING "")
23+
set(${pkgname}_LIBRARIES "${${pkgname}_LIBRARIES}" CACHE STRING "")
24+
set(${pkgname}_LIBRARY "${${pkgname}_LIBRARIES}" CACHE STRING "")
4125
set(${pkgname}_TARGET "${targets}" CACHE STRING "")
42-
set(${pkgname}_VERSION ${${pkgname}_VERSION_STRING} CACHE BOOL "")
43-
44-
message(STATUS "Found ${pkgname}: ${${pkgname}_FOUND}")
45-
message(STATUS " ${key}_TARGET: ${${key}_TARGET}")
46-
message(STATUS " ${key}_LIBRARIES: ${${key}_LIBRARIES}")
47-
message(STATUS " ${key}_INCLUDE_DIRS: ${${key}_INCLUDE_DIRS}")
26+
set(${pkgname}_VERSION ${${pkgname}_VERSION_STRING} CACHE STRING "")
4827
endfunction()
Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,22 @@
11
sources:
2+
"3.12.0":
3+
url: "https://github.com/OSGeo/gdal/releases/download/v3.12.0/gdal-3.12.0.tar.gz"
4+
sha256: "44c95baabe6c1a047c1ebe5043e38dd73e4936bc4c481db14efbfd03342eab73"
25
"3.10.3":
36
url: "https://github.com/OSGeo/gdal/releases/download/v3.10.3/gdal-3.10.3.tar.gz"
47
sha256: "e4bf7f104acbcb3e2d16c97fd1af2b92b28d0ba59d17d976e3ef08b794f4153b"
58
"3.8.3":
69
url: "https://github.com/OSGeo/gdal/releases/download/v3.8.3/gdal-3.8.3.tar.gz"
710
sha256: "f7a30387a8239e9da26200f787a02136df2ee6473e86b36d05ad682761a049ea"
8-
"3.7.3":
9-
url: "https://github.com/OSGeo/gdal/releases/download/v3.7.3/gdal-3.7.3.tar.gz"
10-
sha256: "f66161e10b8b89a8a541cd760cd36d490114ed3f020a26db1489a6154db5d2be"
11-
"3.5.3":
12-
url: "https://github.com/OSGeo/gdal/releases/download/v3.5.3/gdal-3.5.3.tar.gz"
13-
sha256: "a9ea0300d17e35bab71df4f16e62bb2fb8081caf994ab3ee0502ce4cf0d4e593"
1411
patches:
12+
"3.12.0":
13+
- patch_file: "patches/3.12.x/0-replace-find-package.patch"
14+
- patch_file: "patches/3.12.x/2-allow-cycles-in-cmake-targets.patch"
1515
"3.10.3":
1616
- patch_file: "patches/3.10.3/0-replace-find-package.patch"
17-
patch_description: "Use custom version of find_package() for Conan deps"
18-
patch_type: "conan"
1917
- patch_file: "patches/3.10.3/1-do-not-force-private-linking.patch"
20-
patch_description: "Fix private linking not working for some Conan dependencies"
21-
patch_type: "conan"
2218
- patch_file: "patches/3.10.3/2-allow-cycles-in-cmake-targets.patch"
23-
patch_description: "Fix CMake failure due to cyclical dependencies in CMakeDeps targets"
24-
patch_type: "conan"
25-
- patch_file: "patches/3.10.3/3-use-arrow-version-for-parquet.patch"
26-
patch_description: "Use Arrow version output from find_package() for Parquet and ArrowDataset"
27-
patch_type: "conan"
2819
"3.8.3":
29-
- patch_file: "patches/3.8.1/0-replace-find-package.patch"
30-
patch_description: "Use custom version of find_package() for Conan deps"
31-
patch_type: "conan"
32-
- patch_file: "patches/3.7.3/1-do-not-force-private-linking.patch"
33-
patch_description: "Fix private linking not working for some Conan dependencies"
34-
patch_type: "conan"
35-
- patch_file: "patches/3.7.3/2-use-arrow-version-for-parquet.patch"
36-
patch_description: "Use Arrow version output from find_package() for Parquet and ArrowDataset"
37-
patch_type: "conan"
38-
- patch_file: "patches/3.5.3/2-allow-cycles-in-cmake-targets.patch"
39-
patch_description: "Fix CMake failure due to cyclical dependencies in CMakeDeps targets"
40-
patch_type: "conan"
41-
"3.7.3":
42-
- patch_file: "patches/3.7.3/0-replace-find-package.patch"
43-
patch_description: "Use custom version of find_package() for Conan deps"
44-
patch_type: "conan"
45-
- patch_file: "patches/3.7.3/1-do-not-force-private-linking.patch"
46-
patch_description: "Fix private linking not working for some Conan dependencies"
47-
patch_type: "conan"
48-
- patch_file: "patches/3.7.3/2-use-arrow-version-for-parquet.patch"
49-
patch_description: "Use Arrow version output from find_package() for Parquet and ArrowDataset"
50-
patch_type: "conan"
51-
- patch_file: "patches/3.5.3/2-allow-cycles-in-cmake-targets.patch"
52-
patch_description: "Fix CMake failure due to cyclical dependencies in CMakeDeps targets"
53-
patch_type: "conan"
54-
"3.5.3":
55-
- patch_file: "patches/3.5.3/0-replace-find-package.patch"
56-
patch_description: "Use custom version of find_package() for Conan deps"
57-
patch_type: "conan"
58-
- patch_file: "patches/3.5.3/1-do-not-force-private-linking.patch"
59-
patch_description: "Fix private linking not working for some Conan dependencies"
60-
patch_type: "conan"
61-
- patch_file: "patches/3.5.3/2-allow-cycles-in-cmake-targets.patch"
62-
patch_description: "Fix CMake failure due to cyclical dependencies in CMakeDeps targets"
63-
patch_type: "conan"
20+
- patch_file: "patches/3.8.3/0-replace-find-package.patch"
21+
- patch_file: "patches/3.8.3/1-do-not-force-private-linking.patch"
22+
- patch_file: "patches/3.8.3/2-allow-cycles-in-cmake-targets.patch"

recipes/gdal/post_3.5.0/conanfile.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def layout(self):
180180
def requirements(self):
181181
self.requires("json-c/0.17")
182182
self.requires("libgeotiff/1.7.1")
183-
self.requires("libtiff/4.6.0")
183+
self.requires("libtiff/[>=4.6.0 <5]")
184184
self.requires("proj/9.3.1")
185185
# Used in a public header here:
186186
# https://github.com/OSGeo/gdal/blob/v3.7.1/port/cpl_minizip_ioapi.h#L26
@@ -335,6 +335,7 @@ def validate(self):
335335

336336
def source(self):
337337
get(self, **self.conan_data["sources"][self.version], strip_root=True)
338+
self._patch_sources()
338339

339340
def generate(self):
340341
tc = CMakeToolchain(self)
@@ -439,8 +440,13 @@ def generate(self):
439440
tc.cache_variables["GDAL_USE_ZLIB_INTERNAL"] = False
440441
tc.cache_variables["GDAL_USE_ZSTD"] = self.options.with_zstd
441442

442-
tc.cache_variables["Parquet_FOUND"] = self.options.with_arrow and self.dependencies["arrow"].options.parquet
443-
tc.cache_variables["ArrowDataset_FOUND"] = self.options.with_arrow and self.dependencies["arrow"].options.dataset_modules
443+
if self.options.with_arrow:
444+
# Let's avoid using a patch to set this variables
445+
arrow_version = str(self.dependencies["arrow"].ref.version)
446+
tc.cache_variables["Parquet_FOUND"] = self.dependencies["arrow"].options.parquet
447+
tc.cache_variables["ArrowDataset_FOUND"] = self.dependencies["arrow"].options.dataset_modules
448+
tc.cache_variables["Parquet_VERSION"] = arrow_version
449+
tc.cache_variables["ArrowDataset_VERSION"] = arrow_version
444450

445451
# General workaround for try_compile() tests in the project
446452
# https://github.com/conan-io/conan/issues/12180
@@ -641,7 +647,6 @@ def _patch_sources(self):
641647
"gdal_check_package(ArrowDataset", "# gdal_check_package(ArrowDataset")
642648

643649
def build(self):
644-
self._patch_sources()
645650
cmake = CMake(self)
646651
cmake.configure(build_script_folder=self.source_path.parent)
647652
cmake.build()

recipes/gdal/post_3.5.0/patches/3.10.3/3-use-arrow-version-for-parquet.patch

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
--- cmake/helpers/CheckDependentLibrariesCommon.cmake
2+
+++ cmake/helpers/CheckDependentLibrariesCommon.cmake
3+
@@ -11,7 +11,7 @@
4+
include(CheckFunctionExists)
5+
include(CMakeDependentOption)
6+
include(FeatureSummary)
7+
-include(DefineFindPackage2)
8+
+include(ConanFindPackage)
9+
include(CheckSymbolExists)
10+
11+
option(
12+
@@ -109,9 +109,8 @@
13+
string(TOUPPER ${name} key)
14+
set(_find_dependency "")
15+
set(_find_dependency_args "")
16+
- if(FIND_PACKAGE2_${name}_ENABLED)
17+
- find_package2(${name} QUIET OUT_DEPENDENCY _find_dependency)
18+
- else()
19+
+ find_package2(${name} QUIET)
20+
+ if(FALSE)
21+
set(_find_package_args)
22+
# For some reason passing the HDF5 version requirement cause a linking error of the libkea driver on Conda Windows builds...
23+
if (_GCP_VERSION AND NOT ("${name}" STREQUAL "TileDB") AND NOT ("${name}" STREQUAL "HDF5"))
24+
--- cmake/helpers/CheckDependentLibraries.cmake
25+
+++ cmake/helpers/CheckDependentLibraries.cmake
26+
@@ -176,8 +176,8 @@
27+
NAMES json-c
28+
TARGETS json-c::json-c JSONC::JSONC
29+
)
30+
-gdal_internal_library(JSONC REQUIRED)
31+
-if(TARGET json-c::json-c)
32+
+find_package2(JSONC REQUIRED)
33+
+if(FALSE)
34+
get_target_property(include_dirs json-c::json-c INTERFACE_INCLUDE_DIRECTORIES)
35+
find_path(GDAL_JSON_INCLUDE_DIR NAMES json.h PATHS ${include_dirs} PATH_SUFFIXES json-c NO_DEFAULT_PATH)
36+
list(APPEND include_dirs "${GDAL_JSON_INCLUDE_DIR}")
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/cmake/helpers/GdalGenerateConfig.cmake b/cmake/helpers/GdalGenerateConfig.cmake
2+
index debddd7..688b870 100644
3+
--- a/cmake/helpers/GdalGenerateConfig.cmake
4+
+++ b/cmake/helpers/GdalGenerateConfig.cmake
5+
@@ -38,6 +38,7 @@ function(gdal_flatten_link_libraries _result _is_debug_build)
6+
# new target
7+
get_target_property(_link_libraries ${_lib} INTERFACE_LINK_LIBRARIES)
8+
get_target_property(_type ${_lib} TYPE)
9+
+ list(REMOVE_ITEM _link_libraries ${_lib})
10+
if(_link_libraries AND NOT TYPE STREQUAL "SHARED_LIBRARY")
11+
gdal_flatten_link_libraries(_libs "${_is_debug_build}" ${_link_libraries})
12+
endif()

recipes/gdal/post_3.5.0/patches/3.5.3/0-replace-find-package.patch

Lines changed: 0 additions & 74 deletions
This file was deleted.

recipes/gdal/post_3.5.0/patches/3.5.3/1-do-not-force-private-linking.patch

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)