From 9f6c8af879848b13622bb088d15367da82a04ae0 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 2 Feb 2022 20:37:01 +0100 Subject: [PATCH] (#9111) expat: add 2.4.4 + relocatable shared lib on macOS * relocatable shared lib on macOS * handle compiler=msvc * add expat/2.4.4 --- recipes/expat/all/CMakeLists.txt | 4 ++-- recipes/expat/all/conandata.yml | 3 +++ recipes/expat/all/conanfile.py | 11 +++++++++-- recipes/expat/config.yml | 2 ++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/recipes/expat/all/CMakeLists.txt b/recipes/expat/all/CMakeLists.txt index 1848ca5a77c35..61f3d3b039e2b 100644 --- a/recipes/expat/all/CMakeLists.txt +++ b/recipes/expat/all/CMakeLists.txt @@ -1,7 +1,7 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.1) project(cmake_wrapper) include(conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(KEEP_RPATHS) add_subdirectory("source_subfolder") diff --git a/recipes/expat/all/conandata.yml b/recipes/expat/all/conandata.yml index 3a20841db5591..884f280ff104d 100644 --- a/recipes/expat/all/conandata.yml +++ b/recipes/expat/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.4.4": + sha256: "b5d25d6e373351c2ed19b562b4732d01d2589ac8c8e9e7962d8df1207cc311b8" + url: "https://github.com/libexpat/libexpat/releases/download/R_2_4_4/expat-2.4.4.tar.xz" "2.4.3": sha256: "b1f9f1b1a5ebb0acaa88c9ff79bfa4e145823b78aa5185e5c5d85f060824778a" url: "https://github.com/libexpat/libexpat/releases/download/R_2_4_3/expat-2.4.3.tar.xz" diff --git a/recipes/expat/all/conanfile.py b/recipes/expat/all/conanfile.py index bb39a1299227c..d8eaec3a449dc 100644 --- a/recipes/expat/all/conanfile.py +++ b/recipes/expat/all/conanfile.py @@ -1,3 +1,4 @@ +from conan.tools.microsoft import msvc_runtime_flag from conans import ConanFile, CMake, tools import os @@ -35,6 +36,10 @@ def _source_subfolder(self): def _build_subfolder(self): return "build_subfolder" + @property + def _is_msvc(self): + return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def export_sources(self): self.copy("CMakeLists.txt") for patch in self.conan_data.get("patches", {}).get(self.version, []): @@ -69,6 +74,8 @@ def _configure_cmake(self): self._cmake.definitions["BUILD_shared"] = self.options.shared self._cmake.definitions["BUILD_tests"] = "Off" self._cmake.definitions["BUILD_tools"] = "Off" + # Generate a relocatable shared lib on Macos + self._cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" else: # These options were renamed in 2.2.8 to be more consistent self._cmake.definitions["EXPAT_BUILD_DOCS"] = "Off" @@ -78,8 +85,8 @@ def _configure_cmake(self): self._cmake.definitions["EXPAT_BUILD_TOOLS"] = "Off" # EXPAT_CHAR_TYPE was added in 2.2.8 self._cmake.definitions["EXPAT_CHAR_TYPE"] = self.options.char_type - if self.settings.compiler == "Visual Studio": - self._cmake.definitions["EXPAT_MSVC_STATIC_CRT"] = "MT" in self.settings.compiler.runtime + if self._is_msvc: + self._cmake.definitions["EXPAT_MSVC_STATIC_CRT"] = "MT" in msvc_runtime_flag(self) if tools.Version(self.version) >= "2.2.10": self._cmake.definitions["EXPAT_BUILD_PKGCONFIG"] = False diff --git a/recipes/expat/config.yml b/recipes/expat/config.yml index 8c47ddb2ae40d..dd3036a112cd8 100644 --- a/recipes/expat/config.yml +++ b/recipes/expat/config.yml @@ -1,4 +1,6 @@ versions: + "2.4.4": + folder: all "2.4.3": folder: all "2.4.2":