-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
55 lines (45 loc) · 1.7 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
import os
from conans import ConanFile, CMake, tools
class Gm2calcConan(ConanFile):
name = "GM2Calc"
license = "GPL-3.0"
homepage = "https://github.com/GM2Calc/GM2Calc"
description = "C++ library to calculate the anomalous magnetic moment of the muon in the MSSM"
topics = ("HEP")
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True, "boost:header_only": True}
build_policy = "missing"
exports_sources = ["CMakeLists.txt"]
generators = "cmake"
requires = ("eigen/[>=3.1]")
build_requires = ("boost/1.75.0")
_cmake = None
@property
def _source_subfolder(self):
return "source_subfolder"
@property
def _build_subfolder(self):
return "build_subfolder"
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def source(self):
tools.get(**self.conan_data["sources"][self.version])
os.rename("{}-{}".format(self.name, self.version), self._source_subfolder)
def build(self):
cmake = self._configure_cmake()
cmake.build()
def _configure_cmake(self):
if self._cmake:
return self._cmake
self._cmake = CMake(self)
self._cmake.configure(build_folder=self._build_subfolder)
return self._cmake
def package(self):
self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder)
cmake = self._configure_cmake()
cmake.install()
tools.rmdir(os.path.join(self.package_folder, "share"))
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)