forked from joakimono/conan-clapack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
75 lines (62 loc) · 2.4 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
from os.path import join
from conan import ConanFile
from conan.tools.files import get, copy
from conan.tools.files import apply_conandata_patches, export_conandata_patches
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.microsoft.visual import is_msvc
required_conan_version = ">=1.53.0"
class ClapackConan(ConanFile):
name = "clapack"
version = "3.2.1"
license = "BSD 3-Clause"
url = "https://github.com/sintef-ocean/conan-clapack"
author = "SINTEF Ocean"
homepage = "http://www.netlib.org/clapack/"
description = \
"CLAPACK's goal is to provide LAPACK for someone who does " \
"not have access to a Fortran compiler"
topics = ("LAPACK", "Port to C", "Numerical linear algebra")
settings = "os", "compiler", "build_type", "arch"
package_type = "static-library"
options = {
"fPIC": [True, False],
}
default_options = {
"fPIC": True,
}
def export_sources(self):
export_conandata_patches(self)
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def configure(self):
self.settings.rm_safe("compiler.libcxx")
self.settings.rm_safe("compiler.cppstd")
def layout(self):
cmake_layout(self, src_folder="src")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
tc = CMakeToolchain(self)
tc.generate()
def build(self):
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()
copy(self, "COPYING", self.source_folder,
join(self.package_folder, "licenses"))
def package_info(self):
self.cpp_info.set_property("cmake_find_mode", "both")
self.cpp_info.set_property("cmake_file_name", "CLAPACK")
self.cpp_info.set_property("cmake_target_name", "CLAPACK::CLAPACK")
if is_msvc(self) or (self.settings.os == "Windows" and self.settings.compiler == "clang"):
self.cpp_info.libs = ["libf2c", "blas", "lapack"]
if self.settings.build_type == "Debug":
for i in range(len(self.cpp_info.libs)):
self.cpp_info.libs[i] += 'd'
else:
self.cpp_info.libs = ["lapack", "blas", "f2c"]