-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconanfile.py
101 lines (83 loc) · 3.57 KB
/
conanfile.py
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration
import os
required_conan_version = ">=1.32.0"
class CubicInterpolationConan(ConanFile):
name = "cubicinterpolation"
homepage = "https://github.com/MaxSac/cubic_interpolation"
license = "MIT"
url = "https://github.com/conan-io/conan-center-index"
description = "Leightweight interpolation library based on boost and eigen."
topics = ("interpolation", "splines", "cubic", "bicubic", "boost", "eigen3")
settings = "os", "compiler", "build_type", "arch"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": True,
"fPIC": True
}
exports_sources = "*"
generators = "cmake_find_package", "cmake_paths"
_cmake = None
# def config_options(self):
# if self.settings.os == "Windows":
# del self.options.fPIC
# def configure(self):
# if self.options.shared:
# del self.options.fPIC
def requirements(self):
self.requires("boost/1.72.0")
self.requires("eigen/3.3.9")
@property
def _minimum_compilers_version(self):
return {
"Visual Studio": "16",
"gcc": "5",
"clang": "5",
"apple-clang": "5.1",
}
@property
def _required_boost_components(self):
return ["filesystem", "math", "serialization"]
def validate(self):
miss_boost_required_comp = any(getattr(self.options["boost"], "without_{}".format(boost_comp), True) for boost_comp in self._required_boost_components)
if self.options["boost"].header_only or miss_boost_required_comp:
raise ConanInvalidConfiguration("{0} requires non header-only boost with these components: {1}".format(self.name, ", ".join(self._required_boost_components)))
if self.settings.compiler.cppstd:
tools.check_min_cppstd(self, "14")
minimum_version = self._minimum_compilers_version.get(
str(self.settings.compiler), False
)
if not minimum_version:
self.output.warn(
"CubicInterpolation requires C++14. Your compiler is unknown. Assuming it supports C++14."
)
elif tools.Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
"CubicInterpolation requires C++14, which your compiler does not support."
)
if self.settings.compiler == "Visual Studio" and self.options.shared:
raise ConanInvalidConfiguration("cubicinterpolation shared is not supported with Visual Studio")
def _configure_cmake(self):
if self._cmake:
return self._cmake
self._cmake = CMake(self)
self._cmake.definitions["BUILD_EXAMPLE"] = False
self._cmake.definitions["BUILD_DOCUMENTATION"] = False
self._cmake.configure()
return self._cmake
def build(self):
cmake = self._configure_cmake()
cmake.build()
def package(self):
self.copy("LICENSE", dst="licenses" )
cmake = self._configure_cmake()
cmake.install()
tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
def package_info(self):
self.cpp_info.names["cmake_find_package"] = "CubicInterpolation"
self.cpp_info.names["cmake_find_package_multi"] = "CubicInterpolation"
self.cpp_info.libs = ["CubicInterpolation"]
self.cpp_info.requires = ["boost::headers", "boost::filesystem", "boost::math", "boost::serialization", "eigen::eigen"]