From 04b8fe99667c1181e4403c192dc4f1382e34e0af Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jul 2023 23:24:02 +0300 Subject: [PATCH 01/21] kealib: migrate to Conan v2 --- recipes/kealib/all/CMakeLists.txt | 7 -- recipes/kealib/all/conandata.yml | 2 - recipes/kealib/all/conanfile.py | 85 ++++++++++--------- .../kealib/all/test_package/CMakeLists.txt | 9 +- recipes/kealib/all/test_package/conanfile.py | 21 +++-- .../kealib/all/test_package/test_package.cpp | 30 +++---- .../kealib/all/test_v1_package/CMakeLists.txt | 8 ++ .../kealib/all/test_v1_package/conanfile.py | 17 ++++ 8 files changed, 105 insertions(+), 74 deletions(-) delete mode 100644 recipes/kealib/all/CMakeLists.txt create mode 100644 recipes/kealib/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/kealib/all/test_v1_package/conanfile.py diff --git a/recipes/kealib/all/CMakeLists.txt b/recipes/kealib/all/CMakeLists.txt deleted file mode 100644 index fd2f93f3b4298..0000000000000 --- a/recipes/kealib/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/kealib/all/conandata.yml b/recipes/kealib/all/conandata.yml index f812df3cfab60..0083f00df86e1 100644 --- a/recipes/kealib/all/conandata.yml +++ b/recipes/kealib/all/conandata.yml @@ -8,7 +8,5 @@ sources: patches: "1.4.14": - patch_file: "patches/fix-cmake-1.4.14.patch" - base_path: "source_subfolder" "1.4.13": - patch_file: "patches/fix-export-symbols-and-cmake.patch" - base_path: "source_subfolder" diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index 292c817544c7d..8f28be0f70646 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -1,32 +1,34 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.32.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get + +required_conan_version = ">=1.53.0" class KealibConan(ConanFile): name = "kealib" description = "C++ library providing complete access to the KEA image format." license = "MIT" - topics = ("conan", "kealib", "image", "raster") - homepage = "https://github.com/ubarsc/kealib" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - - _cmake = None + homepage = "https://github.com/ubarsc/kealib" + topics = ("image", "raster") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -34,41 +36,46 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") self.options["hdf5"].enable_cxx = True self.options["hdf5"].hl = True + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): - self.requires("hdf5/1.12.0") + self.requires("hdf5/1.14.1", transitive_headers=True) def validate(self): - if not (self.options["hdf5"].enable_cxx and self.options["hdf5"].hl): + hdf5_opts = self.dependencies["hdf5"].options + if not (hdf5_opts.enable_cxx and hdf5_opts.hl): raise ConanInvalidConfiguration("kealib requires hdf5 with cxx and hl enabled.") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("{0}-{0}-{1}".format(self.name, self.version), self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["HDF5_USE_STATIC_LIBRARIES"] = not self.options["hdf5"].shared - self._cmake.definitions["HDF5_PREFER_PARALLEL"] = False # TODO: rely on self.options["hdf5"].parallel when implemented in hdf5 recipe - self._cmake.definitions["LIBKEA_WITH_GDAL"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["HDF5_USE_STATIC_LIBRARIES"] = not self.dependencies["hdf5"].options.shared + tc.variables["HDF5_PREFER_PARALLEL"] = self.dependencies["hdf5"].options.parallel + tc.variables["LIBKEA_WITH_GDAL"] = False + tc.generate() + + tc = CMakeDeps(self) + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["kea"] diff --git a/recipes/kealib/all/test_package/CMakeLists.txt b/recipes/kealib/all/test_package/CMakeLists.txt index 196188113685c..1dfadc520209f 100644 --- a/recipes/kealib/all/test_package/CMakeLists.txt +++ b/recipes/kealib/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(kealib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE kealib::kealib) diff --git a/recipes/kealib/all/test_package/conanfile.py b/recipes/kealib/all/test_package/conanfile.py index ea57a464900be..ef5d7042163ec 100644 --- a/recipes/kealib/all/test_package/conanfile.py +++ b/recipes/kealib/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/kealib/all/test_package/test_package.cpp b/recipes/kealib/all/test_package/test_package.cpp index ed6447aec5e35..4a9b2a79bfb1a 100644 --- a/recipes/kealib/all/test_package/test_package.cpp +++ b/recipes/kealib/all/test_package/test_package.cpp @@ -7,23 +7,23 @@ * * This file is part of LibKEA. * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, - * merge, publish, distribute, sublicense, and/or sell copies of the - * Software, and to permit persons to whom the Software is furnished + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, + * merge, publish, distribute, sublicense, and/or sell copies of the + * Software, and to permit persons to whom the Software is furnished * to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be + * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ @@ -42,7 +42,7 @@ int main() try { kealib::KEAImageIO io; - H5::H5File *h5file = kealib::KEAImageIO::createKEAImage("bob.kea", + H5::H5File *h5file = kealib::KEAImageIO::createKEAImage("bob.kea", kealib::kea_8uint, IMG_XSIZE, IMG_YSIZE, 1); io.openKEAImageHeader(h5file); @@ -52,7 +52,7 @@ int main() { pData[i] = rand() % 255; } - io.writeImageBlock2Band(1, pData, 0, 0, IMG_XSIZE, IMG_YSIZE, + io.writeImageBlock2Band(1, pData, 0, 0, IMG_XSIZE, IMG_YSIZE, IMG_XSIZE, IMG_YSIZE, kealib::kea_8uint); free(pData); diff --git a/recipes/kealib/all/test_v1_package/CMakeLists.txt b/recipes/kealib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/kealib/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/kealib/all/test_v1_package/conanfile.py b/recipes/kealib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..84ee68733e516 --- /dev/null +++ b/recipes/kealib/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os + +from conans import ConanFile, CMake, tools + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 4388934f9411d2cf59d49e91a9887294db413e8b Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 21 Sep 2023 20:25:08 +0300 Subject: [PATCH 02/21] kealib: transitive_libs=True --- recipes/kealib/all/conanfile.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index 8f28be0f70646..7cc335731e763 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -44,7 +44,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("hdf5/1.14.1", transitive_headers=True) + self.requires("hdf5/1.14.1", transitive_headers=True, transitive_libs=True) def validate(self): hdf5_opts = self.dependencies["hdf5"].options @@ -56,9 +56,9 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["HDF5_USE_STATIC_LIBRARIES"] = not self.dependencies["hdf5"].options.shared - tc.variables["HDF5_PREFER_PARALLEL"] = self.dependencies["hdf5"].options.parallel - tc.variables["LIBKEA_WITH_GDAL"] = False + tc.cache_variables["HDF5_USE_STATIC_LIBRARIES"] = not self.dependencies["hdf5"].options.shared + tc.cache_variables["HDF5_PREFER_PARALLEL"] = self.dependencies["hdf5"].options.parallel + tc.cache_variables["LIBKEA_WITH_GDAL"] = False tc.generate() tc = CMakeDeps(self) From 3f8567c38a263f94a70699281261c85f6be90990 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 21 Sep 2023 20:31:59 +0300 Subject: [PATCH 03/21] kealib: simplify patch --- recipes/kealib/all/patches/fix-cmake-1.4.14.patch | 9 --------- 1 file changed, 9 deletions(-) diff --git a/recipes/kealib/all/patches/fix-cmake-1.4.14.patch b/recipes/kealib/all/patches/fix-cmake-1.4.14.patch index 40e8ed0c1a606..6a457e47e5bc1 100644 --- a/recipes/kealib/all/patches/fix-cmake-1.4.14.patch +++ b/recipes/kealib/all/patches/fix-cmake-1.4.14.patch @@ -1,14 +1,5 @@ --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt -@@ -30,7 +30,7 @@ source_group("include_kea" FILES ${LIBKEA_H}) - ############################################################################### - # Build, link and install library - add_library(${LIBKEA_LIB_NAME} ${LIBKEA_CPP} ${LIBKEA_H} ) --target_link_libraries(${LIBKEA_LIB_NAME} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}) -+target_link_libraries(${LIBKEA_LIB_NAME} ${CONAN_LIBS}) - - include(GenerateExportHeader) - generate_export_header(${LIBKEA_LIB_NAME} @@ -63,8 +63,6 @@ target_link_libraries(Kealib INTERFACE "${LIBKEA_LIB_NAME}") ############################################################################### # Testing From c67d1dce7881223018d027931834c1ae0fc42c7d Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 21 Sep 2023 20:38:07 +0300 Subject: [PATCH 04/21] kealib: add v1.5.1 --- recipes/kealib/all/conandata.yml | 5 +++-- recipes/kealib/all/conanfile.py | 3 ++- recipes/kealib/all/patches/fix-cmake-1.4.14.patch | 11 ----------- recipes/kealib/config.yml | 2 ++ 4 files changed, 7 insertions(+), 14 deletions(-) delete mode 100644 recipes/kealib/all/patches/fix-cmake-1.4.14.patch diff --git a/recipes/kealib/all/conandata.yml b/recipes/kealib/all/conandata.yml index 0083f00df86e1..4578d87064051 100644 --- a/recipes/kealib/all/conandata.yml +++ b/recipes/kealib/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.5.1": + url: "https://github.com/ubarsc/kealib/archive/refs/tags/kealib-1.5.1.tar.gz" + sha256: "3341812e7880a701254d66ad2860d89bbc056a3ba431ccac094e57511a417c58" "1.4.14": url: "https://github.com/ubarsc/kealib/archive/kealib-1.4.14.tar.gz" sha256: "b3f73104acebe5304ecce5c19c1560def66fd5c448ce251e9486494baeb141bc" @@ -6,7 +9,5 @@ sources: url: "https://github.com/ubarsc/kealib/archive/kealib-1.4.13.tar.gz" sha256: "2a254eb557a4ec20638a5134ed549a16b7f64977f37de3cf3853a206c8d82199" patches: - "1.4.14": - - patch_file: "patches/fix-cmake-1.4.14.patch" "1.4.13": - patch_file: "patches/fix-export-symbols-and-cmake.patch" diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index 7cc335731e763..579c464ff6876 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -3,7 +3,7 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir required_conan_version = ">=1.53.0" @@ -76,6 +76,7 @@ def package(self): src=self.source_folder) cmake = CMake(self) cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.libs = ["kea"] diff --git a/recipes/kealib/all/patches/fix-cmake-1.4.14.patch b/recipes/kealib/all/patches/fix-cmake-1.4.14.patch deleted file mode 100644 index 6a457e47e5bc1..0000000000000 --- a/recipes/kealib/all/patches/fix-cmake-1.4.14.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -63,8 +63,6 @@ target_link_libraries(Kealib INTERFACE "${LIBKEA_LIB_NAME}") - ############################################################################### - # Testing - # exe needs to be in 'src' otherwise it doesn't work --add_executable (test1 ${PROJECT_SOURCE_DIR}/src/tests/test1.cpp) --target_link_libraries (test1 ${LIBKEA_LIB_NAME}) - ############################################################################### - - ############################################################################### diff --git a/recipes/kealib/config.yml b/recipes/kealib/config.yml index 46b5f6a142b86..94c2b0fd41b53 100644 --- a/recipes/kealib/config.yml +++ b/recipes/kealib/config.yml @@ -1,4 +1,6 @@ versions: + "1.5.1": + folder: all "1.4.14": folder: all "1.4.13": From bbf7d554efc873efd0a4df2b7661ae05402de2d8 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 6 Nov 2023 17:05:11 +0200 Subject: [PATCH 05/21] kealib: bump hdf5 --- recipes/kealib/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index 579c464ff6876..7c6902eb837ef 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -44,7 +44,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("hdf5/1.14.1", transitive_headers=True, transitive_libs=True) + self.requires("hdf5/1.14.2", transitive_headers=True, transitive_libs=True) def validate(self): hdf5_opts = self.dependencies["hdf5"].options From a94505f3ba517b9730928ca73e71a641bd5b100e Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 6 Nov 2023 17:07:07 +0200 Subject: [PATCH 06/21] kealib: add min cppstd check --- recipes/kealib/all/conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index 7c6902eb837ef..78b54bda852ec 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -2,6 +2,7 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir @@ -47,6 +48,8 @@ def requirements(self): self.requires("hdf5/1.14.2", transitive_headers=True, transitive_libs=True) def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) hdf5_opts = self.dependencies["hdf5"].options if not (hdf5_opts.enable_cxx and hdf5_opts.hl): raise ConanInvalidConfiguration("kealib requires hdf5 with cxx and hl enabled.") From 2657a54ef90aa8ecd5cde6da034af7c81fdfe39c Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 6 Nov 2023 17:19:36 +0200 Subject: [PATCH 07/21] kealib: require GCC 6+ --- recipes/kealib/all/conanfile.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index 78b54bda852ec..52b359cb47ac3 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -5,6 +5,7 @@ from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.scm import Version required_conan_version = ">=1.53.0" @@ -28,6 +29,16 @@ class KealibConan(ConanFile): "fPIC": True, } + @property + def _min_cppstd(self): + return 11 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "6", + } + def export_sources(self): export_conandata_patches(self) @@ -49,7 +60,12 @@ def requirements(self): def validate(self): if self.settings.compiler.cppstd: - check_min_cppstd(self, 11) + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) hdf5_opts = self.dependencies["hdf5"].options if not (hdf5_opts.enable_cxx and hdf5_opts.hl): raise ConanInvalidConfiguration("kealib requires hdf5 with cxx and hl enabled.") From 5db300864510e9d8c2a424ba37f9fa57a4f2544c Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 16 Nov 2023 19:59:42 +0200 Subject: [PATCH 08/21] kealib: drop v1.4.13 --- recipes/kealib/all/conandata.yml | 6 - recipes/kealib/all/conanfile.py | 6 +- .../fix-export-symbols-and-cmake.patch | 219 ------------------ recipes/kealib/config.yml | 2 - 4 files changed, 1 insertion(+), 232 deletions(-) delete mode 100644 recipes/kealib/all/patches/fix-export-symbols-and-cmake.patch diff --git a/recipes/kealib/all/conandata.yml b/recipes/kealib/all/conandata.yml index 4578d87064051..b289899469d63 100644 --- a/recipes/kealib/all/conandata.yml +++ b/recipes/kealib/all/conandata.yml @@ -5,9 +5,3 @@ sources: "1.4.14": url: "https://github.com/ubarsc/kealib/archive/kealib-1.4.14.tar.gz" sha256: "b3f73104acebe5304ecce5c19c1560def66fd5c448ce251e9486494baeb141bc" - "1.4.13": - url: "https://github.com/ubarsc/kealib/archive/kealib-1.4.13.tar.gz" - sha256: "2a254eb557a4ec20638a5134ed549a16b7f64977f37de3cf3853a206c8d82199" -patches: - "1.4.13": - - patch_file: "patches/fix-export-symbols-and-cmake.patch" diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index 52b359cb47ac3..579990e1260b4 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -4,7 +4,7 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.files import copy, get, rmdir from conan.tools.scm import Version required_conan_version = ">=1.53.0" @@ -39,9 +39,6 @@ def _compilers_minimum_version(self): "gcc": "6", } - def export_sources(self): - export_conandata_patches(self) - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -84,7 +81,6 @@ def generate(self): tc.generate() def build(self): - apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() diff --git a/recipes/kealib/all/patches/fix-export-symbols-and-cmake.patch b/recipes/kealib/all/patches/fix-export-symbols-and-cmake.patch deleted file mode 100644 index 0107ba1879496..0000000000000 --- a/recipes/kealib/all/patches/fix-export-symbols-and-cmake.patch +++ /dev/null @@ -1,219 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -52,14 +52,7 @@ set (LIBKEA_PACKAGE_BUGREPORT "petebunting@mac.com") - set (LIBKEA_PACKAGE "LibKEA") - set (LIBKEA_COPYRIGHT_YEAR 2013) - --if(MSVC) -- # set Name of C++ library -- # this forces it to be libkea on Windows with VC -- set(LIBKEA_LIB_NAME libkea) --else() -- # set Name of C++ library -- set(LIBKEA_LIB_NAME kea) --endif() -+set(LIBKEA_LIB_NAME kea) - - include(CMakeDependentOption) - # CMake global option valiable -@@ -195,11 +188,11 @@ endif(MSVC) - - ############################################################################### - # Setup configure file --configure_file ( "${PROJECT_HEADER_DIR}/kea-config.h.in" "${CMAKE_BINARY_DIR}/${PROJECT_HEADER_DIR}/libkea/kea-config.h" ) -+configure_file ( "${PROJECT_HEADER_DIR}/kea-config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/include/libkea/kea-config.h" ) - if(MSVC) -- configure_file ( "${PROJECT_TOOLS_DIR}/kea-config.bat.in" "${CMAKE_BINARY_DIR}/${PROJECT_BINARY_DIR}/kea-config.bat" ) -+ configure_file ( "${PROJECT_TOOLS_DIR}/kea-config.bat.in" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_BINARY_DIR}/kea-config.bat" ) - else() -- configure_file ( "${PROJECT_TOOLS_DIR}/kea-config.in" "${CMAKE_BINARY_DIR}/${PROJECT_BINARY_DIR}/kea-config" ) -+ configure_file ( "${PROJECT_TOOLS_DIR}/kea-config.in" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_BINARY_DIR}/kea-config" ) - endif(MSVC) - ############################################################################### - -@@ -213,7 +206,7 @@ endif(MSVC) - # Build library - - include_directories ("${PROJECT_HEADER_DIR}") --include_directories ("${CMAKE_BINARY_DIR}/${PROJECT_HEADER_DIR}") -+include_directories ("${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_HEADER_DIR}") - include_directories(${HDF5_INCLUDE_DIRS}) - add_subdirectory ("${PROJECT_SOURCE_DIR}") - if (LIBKEA_WITH_GDAL) -@@ -234,7 +227,7 @@ if(MSVC) - else() - install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_BINARY_DIR}/kea-config" DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - endif(MSVC) --install (FILES "${CMAKE_BINARY_DIR}/${PROJECT_HEADER_DIR}/libkea/kea-config.h" DESTINATION include/libkea) -+install (FILES "${CMAKE_CURRENT_BINARY_DIR}/include/libkea/kea-config.h" DESTINATION include/libkea) - ############################################################################### - - ############################################################################### ---- a/include/libkea/KEAAttributeTable.h -+++ b/include/libkea/KEAAttributeTable.h -@@ -98,7 +98,7 @@ namespace kealib{ - void *p; - } VarLenFieldHDF; - -- class DllExport KEAAttributeTable -+ class KEA_EXPORT KEAAttributeTable - { - public: - KEAAttributeTable(KEAATTType keaAttType); ---- a/include/libkea/KEAAttributeTableFile.h -+++ b/include/libkea/KEAAttributeTableFile.h -@@ -43,7 +43,7 @@ - - namespace kealib{ - -- class DllExport KEAAttributeTableFile : public KEAAttributeTable -+ class KEA_EXPORT KEAAttributeTableFile : public KEAAttributeTable - { - public: - KEAAttributeTableFile(H5::H5File *keaImgIn, const std::string &bandPathBaseIn, size_t numRowsIn, size_t chunkSizeIn, unsigned int deflateIn=KEA_DEFLATE); ---- a/include/libkea/KEAAttributeTableInMem.h -+++ b/include/libkea/KEAAttributeTableInMem.h -@@ -43,7 +43,7 @@ - - namespace kealib{ - -- class DllExport KEAAttributeTableInMem : public KEAAttributeTable -+ class KEA_EXPORT KEAAttributeTableInMem : public KEAAttributeTable - { - public: - KEAAttributeTableInMem(); ---- a/include/libkea/KEACommon.h -+++ b/include/libkea/KEACommon.h -@@ -38,15 +38,7 @@ - - #include "H5Cpp.h" - --// mark all exported classes/functions with DllExport to have --// them exported by Visual Studio --#ifndef DllExport -- #ifdef _MSC_VER -- #define DllExport __declspec( dllexport ) -- #else -- #define DllExport -- #endif --#endif -+#include "libkea/kea_export.h" - - // MSVC 2008 uses different names.... - #ifdef _MSC_VER ---- a/include/libkea/KEAException.h -+++ b/include/libkea/KEAException.h -@@ -37,7 +37,7 @@ - - namespace kealib - { -- class DllExport KEAException : public std::exception -+ class KEA_EXPORT KEAException : public std::exception - { - public: - KEAException() : exception() {msgs = "A KEAException has been created.";}; -@@ -49,7 +49,7 @@ namespace kealib - std::string msgs; - }; - -- class DllExport KEAIOException : public KEAException -+ class KEA_EXPORT KEAIOException : public KEAException - { - public: - KEAIOException() : KEAException("KEAIOException has been created."){}; -@@ -58,7 +58,7 @@ namespace kealib - ~KEAIOException() throw() {}; - }; - -- class DllExport KEAATTException : public KEAException -+ class KEA_EXPORT KEAATTException : public KEAException - { - public: - KEAATTException() : KEAException("KEAATTException has been created."){}; ---- a/include/libkea/KEAImageIO.h -+++ b/include/libkea/KEAImageIO.h -@@ -45,7 +45,7 @@ - - namespace kealib{ - -- class DllExport KEAImageIO -+ class KEA_EXPORT KEAImageIO - { - public: - KEAImageIO(); -@@ -171,7 +171,7 @@ namespace kealib{ - } - - // returns the current KEA version as a double --extern "C" DllExport double get_kealibversion(); -+extern "C" KEA_EXPORT double get_kealibversion(); - - #endif - ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -30,34 +30,37 @@ source_group("include_kea" FILES ${LIBKEA_H}) - ############################################################################### - # Build, link and install library - add_library(${LIBKEA_LIB_NAME} ${LIBKEA_CPP} ${LIBKEA_H} ) --target_link_libraries(${LIBKEA_LIB_NAME} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}) -+target_link_libraries(${LIBKEA_LIB_NAME} ${CONAN_LIBS}) - --if(BUILD_SHARED_LIBS) -- SET_TARGET_PROPERTIES(${LIBKEA_LIB_NAME} -- PROPERTIES -- SOVERSION ${LIBKEA_VERSION_MAJOR}.${LIBKEA_VERSION_MINOR} -- VERSION ${LIBKEA_VERSION} -- CLEAN_DIRECT_OUTPUT 1) --else() -- SET_TARGET_PROPERTIES(${LIBKEA_LIB_NAME} -- PROPERTIES -- OUTPUT_NAME "${LIBKEA_LIB_NAME}" -- PREFIX "lib" -- VERSION ${LIBKEA_VERSION} -- CLEAN_DIRECT_OUTPUT 1) -+include(GenerateExportHeader) -+generate_export_header(${LIBKEA_LIB_NAME} -+ EXPORT_MACRO_NAME KEA_EXPORT -+ EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/include/libkea/kea_export.h -+) -+target_include_directories(${LIBKEA_LIB_NAME} PUBLIC -+ $ -+ $ -+ $ -+) -+set_target_properties(${LIBKEA_LIB_NAME} -+ PROPERTIES -+ CXX_VISIBILITY_PRESET hidden -+ VISIBILITY_INLINES_HIDDEN 1 -+ PREFIX "lib" -+ IMPORT_PREFIX "lib" -+ SOVERSION ${LIBKEA_VERSION_MAJOR}.${LIBKEA_VERSION_MINOR} -+ VERSION ${LIBKEA_VERSION} -+) -+if(MSVC AND NOT BUILD_SHARED_LIBS) -+ set_target_properties(${LIBKEA_LIB_NAME} PROPERTIES OUTPUT_NAME "libkea") - endif() - add_library(Kealib INTERFACE) - target_link_libraries(Kealib INTERFACE "${LIBKEA_LIB_NAME}") --target_include_directories(Kealib INTERFACE -- $ -- $) - ############################################################################### - - ############################################################################### - # Testing - # exe needs to be in 'src' otherwise it doesn't work --add_executable (test1 ${CMAKE_SOURCE_DIR}/src/tests/test1.cpp) --target_link_libraries (test1 ${LIBKEA_LIB_NAME}) - - ############################################################################### - # Set target properties -@@ -76,5 +79,6 @@ install (TARGETS ${LIBKEA_LIB_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) --install (FILES ${LIBKEA_H} DESTINATION include/libkea) -+install (FILES ${LIBKEA_H} ${CMAKE_CURRENT_BINARY_DIR}/include/libkea/kea_export.h -+ DESTINATION include/libkea) - ############################################################################### diff --git a/recipes/kealib/config.yml b/recipes/kealib/config.yml index 94c2b0fd41b53..2447c67044793 100644 --- a/recipes/kealib/config.yml +++ b/recipes/kealib/config.yml @@ -3,5 +3,3 @@ versions: folder: all "1.4.14": folder: all - "1.4.13": - folder: all From b487b9baffeb54649a10d752737544784bee7cea Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 4 Dec 2023 09:52:47 +0200 Subject: [PATCH 09/21] kealib: bump to 1.5.2 --- recipes/kealib/all/conandata.yml | 6 +++--- recipes/kealib/config.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/kealib/all/conandata.yml b/recipes/kealib/all/conandata.yml index b289899469d63..4aeaf1ebada6f 100644 --- a/recipes/kealib/all/conandata.yml +++ b/recipes/kealib/all/conandata.yml @@ -1,7 +1,7 @@ sources: - "1.5.1": - url: "https://github.com/ubarsc/kealib/archive/refs/tags/kealib-1.5.1.tar.gz" - sha256: "3341812e7880a701254d66ad2860d89bbc056a3ba431ccac094e57511a417c58" + "1.5.2": + url: "https://github.com/ubarsc/kealib/archive/refs/tags/kealib-1.5.2.tar.gz" + sha256: "f16a51007ab7612aa598de6ee2cac0aa4421040894777c8e57cb4a50ea552ab1" "1.4.14": url: "https://github.com/ubarsc/kealib/archive/kealib-1.4.14.tar.gz" sha256: "b3f73104acebe5304ecce5c19c1560def66fd5c448ce251e9486494baeb141bc" diff --git a/recipes/kealib/config.yml b/recipes/kealib/config.yml index 2447c67044793..9a988f8e59091 100644 --- a/recipes/kealib/config.yml +++ b/recipes/kealib/config.yml @@ -1,5 +1,5 @@ versions: - "1.5.1": + "1.5.2": folder: all "1.4.14": folder: all From c562ba26f758690c5ff260645898b4c4b1e3b3db Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 4 Dec 2023 09:54:00 +0200 Subject: [PATCH 10/21] kealib: bump to 1.4.15 --- recipes/kealib/all/conandata.yml | 3 +++ recipes/kealib/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/kealib/all/conandata.yml b/recipes/kealib/all/conandata.yml index 4aeaf1ebada6f..d999ff7ca194b 100644 --- a/recipes/kealib/all/conandata.yml +++ b/recipes/kealib/all/conandata.yml @@ -2,6 +2,9 @@ sources: "1.5.2": url: "https://github.com/ubarsc/kealib/archive/refs/tags/kealib-1.5.2.tar.gz" sha256: "f16a51007ab7612aa598de6ee2cac0aa4421040894777c8e57cb4a50ea552ab1" + "1.4.15": + url: "https://github.com/ubarsc/kealib/archive/kealib-1.4.15.tar.gz" + sha256: "fc7bd049663985e9528acd894724f0c730c84a3408d5bff3c0c0f01d7c6cd172" "1.4.14": url: "https://github.com/ubarsc/kealib/archive/kealib-1.4.14.tar.gz" sha256: "b3f73104acebe5304ecce5c19c1560def66fd5c448ce251e9486494baeb141bc" diff --git a/recipes/kealib/config.yml b/recipes/kealib/config.yml index 9a988f8e59091..d8de052a2b5a1 100644 --- a/recipes/kealib/config.yml +++ b/recipes/kealib/config.yml @@ -1,5 +1,7 @@ versions: "1.5.2": folder: all + "1.4.15": + folder: all "1.4.14": folder: all From 32b5c48ee077070e656bbdd028bb74805438cce1 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 4 Dec 2023 09:56:37 +0200 Subject: [PATCH 11/21] kealib: fix MSVC lib name --- recipes/kealib/all/conanfile.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index 579990e1260b4..cd9f79f7b613d 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -5,6 +5,7 @@ from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, rmdir +from conan.tools.microsoft import is_msvc from conan.tools.scm import Version required_conan_version = ">=1.53.0" @@ -94,4 +95,7 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.libs = ["kea"] + if is_msvc(self): + self.cpp_info.libs = ["libkea"] + else: + self.cpp_info.libs = ["kea"] From 3a9fcfc5e1975ef2023a9a5099da2b147ccfc791 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 7 Dec 2023 20:17:09 +0200 Subject: [PATCH 12/21] kealib: bump hdf5 --- recipes/kealib/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index cd9f79f7b613d..0227848634276 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -54,7 +54,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("hdf5/1.14.2", transitive_headers=True, transitive_libs=True) + self.requires("hdf5/1.14.3", transitive_headers=True, transitive_libs=True) def validate(self): if self.settings.compiler.cppstd: From 3f3e6dab3b3657a34a3654d2e97fac4b71efbf52 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 7 Dec 2023 20:38:43 +0200 Subject: [PATCH 13/21] kealib: fix MSVC library names --- recipes/kealib/all/conanfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index 0227848634276..551a5bd64a536 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -96,6 +96,9 @@ def package(self): def package_info(self): if is_msvc(self): - self.cpp_info.libs = ["libkea"] + if not self.options.shared and Version(self.version) <= "1.4.14": + self.cpp_info.libs = ["liblibkea"] + else: + self.cpp_info.libs = ["libkea"] else: self.cpp_info.libs = ["kea"] From 6947b229b68ff7474523e59105ac0be4a2031361 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 7 Dec 2023 20:39:17 +0200 Subject: [PATCH 14/21] kealib: set HDF5_THREADSAFE based on hdf5 option --- recipes/kealib/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index 551a5bd64a536..b545fc665b8c4 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -75,6 +75,7 @@ def generate(self): tc = CMakeToolchain(self) tc.cache_variables["HDF5_USE_STATIC_LIBRARIES"] = not self.dependencies["hdf5"].options.shared tc.cache_variables["HDF5_PREFER_PARALLEL"] = self.dependencies["hdf5"].options.parallel + tc.cache_variables["HDF5_THREADSAFE"] = self.dependencies["hdf5"].options.get_safe("threadsafe", False) tc.cache_variables["LIBKEA_WITH_GDAL"] = False tc.generate() From 66c82c72ee023065ab43e50a06197a0cd6fc3460 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 13 Dec 2023 13:28:20 +0200 Subject: [PATCH 15/21] kealib: restore GCC 5 support Co-authored-by: Uilian Ries --- recipes/kealib/all/conanfile.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index b545fc665b8c4..cccfe4f031584 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -35,10 +35,6 @@ def _min_cppstd(self): return 11 @property - def _compilers_minimum_version(self): - return { - "gcc": "6", - } def config_options(self): if self.settings.os == "Windows": @@ -59,11 +55,6 @@ def requirements(self): def validate(self): if self.settings.compiler.cppstd: check_min_cppstd(self, self._min_cppstd) - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if minimum_version and Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration( - f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." - ) hdf5_opts = self.dependencies["hdf5"].options if not (hdf5_opts.enable_cxx and hdf5_opts.hl): raise ConanInvalidConfiguration("kealib requires hdf5 with cxx and hl enabled.") @@ -77,6 +68,8 @@ def generate(self): tc.cache_variables["HDF5_PREFER_PARALLEL"] = self.dependencies["hdf5"].options.parallel tc.cache_variables["HDF5_THREADSAFE"] = self.dependencies["hdf5"].options.get_safe("threadsafe", False) tc.cache_variables["LIBKEA_WITH_GDAL"] = False + # INFO: kealib uses C++11 but does not configure in cmake: https://github.com/ubarsc/kealib/pull/48 + tc.variables["CMAKE_CXX_STANDARD"] = self.settings.get_safe("compiler.cppstd", self._min_cppstd) tc.generate() tc = CMakeDeps(self) From 997e48409eb3aecfd56c62f53c5bee5a1e8bc400 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 1 Jan 2024 02:13:33 +0200 Subject: [PATCH 16/21] kealib: fix a recipe bug --- recipes/kealib/all/conanfile.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index cccfe4f031584..a354478596b82 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -34,8 +34,6 @@ class KealibConan(ConanFile): def _min_cppstd(self): return 11 - @property - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC From dedf40a0e258fc0af5db5cbb594315d5d4523c9f Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Tue, 16 Jan 2024 14:59:10 +0200 Subject: [PATCH 17/21] kealib: add CMAKE_POLICY_DEFAULT_CMP0077 --- recipes/kealib/all/conanfile.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index a354478596b82..86782842a9e74 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -62,12 +62,13 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - tc.cache_variables["HDF5_USE_STATIC_LIBRARIES"] = not self.dependencies["hdf5"].options.shared - tc.cache_variables["HDF5_PREFER_PARALLEL"] = self.dependencies["hdf5"].options.parallel - tc.cache_variables["HDF5_THREADSAFE"] = self.dependencies["hdf5"].options.get_safe("threadsafe", False) - tc.cache_variables["LIBKEA_WITH_GDAL"] = False + tc.variables["HDF5_USE_STATIC_LIBRARIES"] = not self.dependencies["hdf5"].options.shared + tc.variables["HDF5_PREFER_PARALLEL"] = self.dependencies["hdf5"].options.parallel + tc.variables["HDF5_THREADSAFE"] = self.dependencies["hdf5"].options.get_safe("threadsafe", False) + tc.variables["LIBKEA_WITH_GDAL"] = False # INFO: kealib uses C++11 but does not configure in cmake: https://github.com/ubarsc/kealib/pull/48 tc.variables["CMAKE_CXX_STANDARD"] = self.settings.get_safe("compiler.cppstd", self._min_cppstd) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() tc = CMakeDeps(self) From 7ca37b58eeff64f53990b5d59dab081bf71c8ff7 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Tue, 16 Jan 2024 14:59:53 +0200 Subject: [PATCH 18/21] kealib: use valid_min_cppstd() --- recipes/kealib/all/conanfile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index 86782842a9e74..017647ae4baa3 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -2,7 +2,7 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.build import check_min_cppstd +from conan.tools.build import check_min_cppstd, valid_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, rmdir from conan.tools.microsoft import is_msvc @@ -67,7 +67,8 @@ def generate(self): tc.variables["HDF5_THREADSAFE"] = self.dependencies["hdf5"].options.get_safe("threadsafe", False) tc.variables["LIBKEA_WITH_GDAL"] = False # INFO: kealib uses C++11 but does not configure in cmake: https://github.com/ubarsc/kealib/pull/48 - tc.variables["CMAKE_CXX_STANDARD"] = self.settings.get_safe("compiler.cppstd", self._min_cppstd) + if not valid_min_cppstd(self, self._min_cppstd): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() From 29c7ac376d64ad798ef6bddc5b38ca71fe4006e7 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Tue, 16 Jan 2024 16:31:56 +0200 Subject: [PATCH 19/21] kealib: add cxx_std_11 to test_package --- recipes/kealib/all/test_package/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/kealib/all/test_package/CMakeLists.txt b/recipes/kealib/all/test_package/CMakeLists.txt index 1dfadc520209f..0d6f2bcf3918c 100644 --- a/recipes/kealib/all/test_package/CMakeLists.txt +++ b/recipes/kealib/all/test_package/CMakeLists.txt @@ -5,3 +5,4 @@ find_package(kealib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE kealib::kealib) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) From 7fb3236754c61e03ce62ab09df3a8e6e6a33381d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Rinc=C3=B3n=20Blanco?= Date: Mon, 20 May 2024 15:51:54 +0200 Subject: [PATCH 20/21] Add missing system lib in windows --- recipes/kealib/all/conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index 017647ae4baa3..cfc37b9b2b2cd 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -96,3 +96,6 @@ def package_info(self): self.cpp_info.libs = ["libkea"] else: self.cpp_info.libs = ["kea"] + + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("shlwapi") From 44367d8f55b90358beeba67f4eb8549173bef839 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Wed, 12 Jun 2024 13:29:42 +0200 Subject: [PATCH 21/21] Improve invalid config message. --- recipes/kealib/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index cfc37b9b2b2cd..fb6eebf5cc31b 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -55,7 +55,7 @@ def validate(self): check_min_cppstd(self, self._min_cppstd) hdf5_opts = self.dependencies["hdf5"].options if not (hdf5_opts.enable_cxx and hdf5_opts.hl): - raise ConanInvalidConfiguration("kealib requires hdf5 with cxx and hl enabled.") + raise ConanInvalidConfiguration(f"{self.ref} requires dependencies options -o 'hdf5/*:enable_cxx=True' -o 'hdf5/*:hl=True'") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True)