Skip to content

Commit

Permalink
(conan-io#23803) hdf5: support cross-building if the version is great…
Browse files Browse the repository at this point in the history
…er than 1.14.4-3
  • Loading branch information
qihao727 committed Jun 13, 2024
1 parent 4a16a60 commit 4791d45
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions recipes/hdf5/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"1.14.4-3":
url: "https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5_1.14.4.3.tar.gz"
sha256: "690c1db7ba0fed4ffac61709236675ffd99d95d191e8920ee79c58d7e7ea3361"
"1.14.3":
url: "https://github.com/HDFGroup/hdf5/archive/hdf5-1_14_3/hdf5-1_14_3.tar.gz"
sha256: "df5ee33c74d5efb59738075ef96f4201588e1f1eeb233f047ac7fd1072dee1f6"
Expand Down
10 changes: 6 additions & 4 deletions recipes/hdf5/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import can_run, check_min_cppstd, valid_min_cppstd
from conan.tools.build import cross_building, check_min_cppstd, valid_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, replace_in_file, rm, rmdir, save
from conan.tools.scm import Version
Expand Down Expand Up @@ -85,9 +85,6 @@ def requirements(self):
self.requires("openmpi/4.1.0")

def validate(self):
if not can_run(self):
# While building it runs some executables like H5detect
raise ConanInvalidConfiguration("Current recipe doesn't support cross-building (yet)")
if self.options.parallel and not self.options.enable_unsupported:
if self.options.enable_cxx:
raise ConanInvalidConfiguration("Parallel and C++ options are mutually exclusive, forcefully allow with enable_unsupported=True")
Expand All @@ -100,6 +97,11 @@ def validate(self):
if self.settings.get_safe("compiler.cppstd"):
check_min_cppstd(self, self._min_cppstd)

def validate_build(self):
if cross_building(self) and Version(self.version) < "1.14.4-3":
# While building it runs some executables like H5detect
raise ConanInvalidConfiguration("Current recipe doesn't support cross-building (yet)")

def build_requirements(self):
if Version(self.version) >= "1.14.0":
self.tool_requires("cmake/[>=3.18 <4]")
Expand Down
2 changes: 2 additions & 0 deletions recipes/hdf5/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"1.14.4-3":
folder: all
"1.14.3":
folder: all
"1.14.2":
Expand Down

0 comments on commit 4791d45

Please sign in to comment.