Repository navigation
Expand file tree
/
Copy pathconanfile.py
More file actions
82 lines (73 loc) · 2.62 KB
/
Copy pathconanfile.py
File metadata and controls
82 lines (73 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import os
from conan import ConanFile, tools
from conan.tools.files import copy, get
from conan.tools.cmake import CMake
from conan.tools.env import VirtualBuildEnv, VirtualRunEnv
class H5CppConan(ConanFile):
name = "h5cpp"
version = "0.8.0"
license = "LGPL-2.1"
url = "https://github.com/ess-dmsc/h5cpp"
description = "C++ wrapper for the HDF5 C-library"
settings = "os", "compiler", "build_type", "arch"
options = {
"shared": [True, False],
"fPIC": [True, False],
"with_mpi": [True, False],
"with_boost": [True, False],
"install_prefix": [None, "ANY"]
}
default_options = {
"shared": True,
"fPIC": True,
"with_mpi": False,
"with_boost": False,
"hdf5/*:hl": True,
"hdf5/*:enable_cxx": False,
"hdf5/*:shared": True,
"install_prefix": None
}
generators = "CMakeToolchain", "CMakeDeps"
def configure(self):
if self.options.get_safe("with_mpi", False):
self.options["hdf5"].parallel = True
def build_requirements(self):
self.build_requires("catch2/3.3.2")
self.build_requires("ninja/1.12.1")
self.build_requires("zlib/1.3.1")
if self.settings.os == "Windows":
self.tool_requires("b2/5.2.1")
def requirements(self):
self.requires("hdf5/1.14.5")
self.requires("catch2/3.3.2")
self.requires("zlib/1.3.1")
self.requires("szip/2.1.1")
self.requires("bzip2/1.0.8")
if self.options.with_boost:
self.requires("boost/1.86.0")
if self.options.with_mpi:
self.requires("openmpi/4.1.0")
def source(self):
data = self.conan_data["sources"][self.version]
get(self, **data, strip_root=True)
def build(self):
cmake = CMake(self)
build_env = VirtualBuildEnv(self).vars()
run_env = VirtualRunEnv(self).vars()
with build_env.apply(), run_env.apply():
variables = {
"H5CPP_CONAN": "MANUAL",
"H5CPP_WITH_MPI": self.options.with_mpi,
"H5CPP_WITH_BOOST": self.options.with_boost
}
if self.options.install_prefix:
variables["CMAKE_INSTALL_PREFIX"] = self.options.install_prefix
cmake.configure(variables=variables)
cmake.build()
cmake.install()
def package(self):
cmake = CMake(self)
cmake.install()
copy(self, "LICENSE*", self.source_folder, os.path.join(self.package_folder, "licenses"), keep_path=False)
def package_info(self):
self.cpp_info.libs = ["h5cpp"]