Skip to content

Commit

Permalink
(#9111) expat: add 2.4.4 + relocatable shared lib on macOS
Browse files Browse the repository at this point in the history
* relocatable shared lib on macOS

* handle compiler=msvc

* add expat/2.4.4
  • Loading branch information
SpaceIm authored Feb 2, 2022
1 parent c5c475e commit 9f6c8af
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions recipes/expat/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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")
3 changes: 3 additions & 0 deletions recipes/expat/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
11 changes: 9 additions & 2 deletions recipes/expat/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from conan.tools.microsoft import msvc_runtime_flag
from conans import ConanFile, CMake, tools
import os

Expand Down Expand Up @@ -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, []):
Expand Down Expand Up @@ -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"
Expand All @@ -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

Expand Down
2 changes: 2 additions & 0 deletions recipes/expat/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"2.4.4":
folder: all
"2.4.3":
folder: all
"2.4.2":
Expand Down

0 comments on commit 9f6c8af

Please sign in to comment.