Skip to content

Commit

Permalink
mpdecimal: Fix cxx+shared, remove unnecessary automake dependency (co…
Browse files Browse the repository at this point in the history
…nan-io#25903)

* Fix shared + cxx in 2.5.1+
  • Loading branch information
Ahajha committed Nov 15, 2024
1 parent 7f4906b commit c0d8be4
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions recipes/mpdecimal/2.5.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ class MpdecimalConan(ConanFile):
"cxx": True,
}

@property
def _settings_build(self):
return getattr(self, "setings_build", self.settings)

def export_sources(self):
export_conandata_patches(self)

Expand All @@ -60,20 +56,16 @@ def validate(self):
if is_msvc(self) and self.settings.arch not in ("x86", "x86_64"):
raise ConanInvalidConfiguration(
f"{self.ref} currently does not supported {self.settings.arch}. Contributions are welcomed")
if self.options.get_safe("cxx"):
if self.options.get_safe("cxx") and Version(self.version) < "2.5.1":
if self.options.shared and self.settings.os == "Windows":
raise ConanInvalidConfiguration(
"A shared libmpdec++ is not possible on Windows (due to non-exportable thread local storage)")

def build_requirements(self):
if is_msvc(self):
self.tool_requires("automake/1.16.5")
else:
# required to support windows as a build machine
if self._settings_build.os == "Windows":
self.win_bash = True
if not self.conf.get("tools.microsoft.bash:path", check_type=str):
self.tool_requires("msys2/cci.latest")
if not is_msvc(self) and self.settings_build.os == "Windows":
self.win_bash = True
if not self.conf.get("tools.microsoft.bash:path", check_type=str):
self.tool_requires("msys2/cci.latest")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
Expand Down Expand Up @@ -190,4 +182,4 @@ def package_info(self):
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.components["libmpdecimal++"].system_libs = ["pthread"]
if self.options.shared and Version(self.version) >= "2.5.1":
self.cpp_info.components["libmpdecimal"].defines = ["MPDECIMALXX_DLL"]
self.cpp_info.components["libmpdecimal++"].defines = ["MPDECIMALXX_DLL"]

0 comments on commit c0d8be4

Please sign in to comment.