diff --git a/recipes/libvault/all/conandata.yml b/recipes/libvault/all/conandata.yml index fad4071cba2ec..bfc950b624ab9 100644 --- a/recipes/libvault/all/conandata.yml +++ b/recipes/libvault/all/conandata.yml @@ -1,23 +1,4 @@ sources: - "0.52.0": - url: "https://github.com/abedra/libvault/archive/refs/tags/0.52.0.zip" - sha256: 49058ac9a1d3d1d08ac165f5f7b50e3a2a2ab0d3f9b8bb8194fa7a8de36edcf8 - "0.51.0": - url: "https://github.com/abedra/libvault/archive/refs/tags/0.51.0.zip" - sha256: 570ccc6451cf8e93b1c585bbf6ab5212ff9290b3a9b477752cf0651414b3d026 - "0.48.0": - url: "https://github.com/abedra/libvault/archive/0.48.0.zip" - sha256: 0a42be282ff0aff77b68cb7238014aa762df5c6b62e4d3561878874ca3760489 -patches: - "0.52.0": - - patch_file: "patches/0.52.0-0001-fix-cmake.patch" - patch_type: "conan" - patch_description: "use libcurl from conan center" - "0.51.0": - - patch_file: "patches/0.51.0-0001-fix-cmake.patch" - patch_type: "conan" - patch_description: "use libcurl from conan center" - "0.48.0": - - patch_file: "patches/0.48.0-0001-fix-cmake.patch" - patch_type: "conan" - patch_description: "use libcurl from conan center" + "0.59.0": + url: "https://github.com/abedra/libvault/archive/refs/tags/0.59.0.zip" + sha256: 668e71e1689f6142735387989042945e42fd6e0483f223ce3a08121887a335ce diff --git a/recipes/libvault/all/conanfile.py b/recipes/libvault/all/conanfile.py index 408c16f6dbb3b..98c9c4d3f5c6b 100644 --- a/recipes/libvault/all/conanfile.py +++ b/recipes/libvault/all/conanfile.py @@ -5,7 +5,8 @@ from conan.tools.apple import is_apple_os 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, replace_in_file +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime from conan.tools.scm import Version required_conan_version = ">=1.54.0" @@ -33,8 +34,19 @@ class LibvaultConan(ConanFile): def _mac_os_minimum_required_version(self): return "10.15" - def export_sources(self): - export_conandata_patches(self) + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7.0", + "apple-clang": "12", + } def config_options(self): if self.settings.os == "Windows": @@ -49,29 +61,18 @@ def layout(self): def requirements(self): # public header VaultClient.h includes curl/curl.h and use several functions - self.requires("libcurl/[>=7.78.0 <9]", transitive_headers=True, transitive_libs=True) + self.requires("libcurl/[>=7.78.0 <9]", transitive_headers=True) def validate(self): - compiler = str(self.settings.compiler) - compiler_version = Version(self.settings.compiler.version.value) - - minimum_compiler_version = { - "Visual Studio": "16", - "msvc": "192", - "gcc": "8", - "clang": "7.0", - "apple-clang": "12", - } - - minimum_cpp_standard = 17 - - if compiler in minimum_compiler_version and \ - compiler_version < minimum_compiler_version[compiler]: + 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.name} requires a compiler that supports at least C++{minimum_cpp_standard}. " - f"{compiler} {compiler_version} is not supported.") + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) - if compiler == "clang" and self.settings.compiler.libcxx in ["libstdc++", "libstdc++11"] and self.settings.compiler.version == "11": + if self.settings.compiler == "clang" and self.settings.compiler.libcxx in ["libstdc++", "libstdc++11"] and self.settings.compiler.version == "11": raise ConanInvalidConfiguration("clang 11 with libstdc++ is not supported due to old libstdc++ missing C++17 support") if is_apple_os(self): @@ -80,9 +81,6 @@ def validate(self): raise ConanInvalidConfiguration( "Macos Mojave (10.14) and earlier cannot to be built because C++ standard library too old.") - if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, minimum_cpp_standard) - def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -91,12 +89,24 @@ def generate(self): tc.variables["ENABLE_TEST"] = False tc.variables["ENABLE_INTEGRATION_TEST"] = False tc.variables["ENABLE_COVERAGE"] = False + tc.variables["LINK_CURL"] = True + tc.variables["CMAKE_OSX_DEPLOYMENT_TARGET"] = self._mac_os_minimum_required_version + + if is_msvc(self): + tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + tc = CMakeDeps(self) tc.generate() - deps = CMakeDeps(self) - deps.generate() + + def _patch_sources(self): + # INFO: https://github.com/abedra/libvault/pull/123 + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "target_link_libraries(vault curl)", + "target_link_libraries(vault CURL::libcurl)") def build(self): - apply_conandata_patches(self) + self._patch_sources() cmake = CMake(self) cmake.configure() cmake.build() @@ -112,6 +122,7 @@ def package_info(self): self.cpp_info.libs = ["vault"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version).major == "8": self.cpp_info.system_libs.append("stdc++fs") diff --git a/recipes/libvault/config.yml b/recipes/libvault/config.yml index 327b1962634e5..06bedb729ed91 100644 --- a/recipes/libvault/config.yml +++ b/recipes/libvault/config.yml @@ -1,7 +1,3 @@ versions: - "0.52.0": - folder: "all" - "0.51.0": - folder: "all" - "0.48.0": + "0.59.0": folder: "all"