-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconanfile.py
97 lines (83 loc) · 2.98 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
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.microsoft import check_min_vs, is_msvc
from conan.tools.scm import Git, Version
class ScipPlusPlus(ConanFile):
name = "scippp"
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps"
exports_sources = "CMakeLists.txt", "source/*", "include/*"
description = "SCIP++ is a C++ wrapper for SCIP's C interface"
package_type = "library"
topics = ("mip", "solver", "linear", "programming")
license = "Apache-2.0"
homepage = "https://github.com/scipopt/SCIPpp"
options = {
"with_tests": [True, False],
"with_utils": [True, False],
"shared": [True, False],
"fPIC": [True, False]
}
default_options = {
"with_tests": False,
"with_utils": False,
"shared": False,
"fPIC": True
}
@property
def _min_cppstd(self):
return 17
@property
def _compilers_minimum_version(self):
return {
"gcc": "8",
"clang": "7",
"apple-clang": "11",
"msvc": "192"
}
def validate(self):
if self.settings.compiler.cppstd:
check_min_cppstd(self, self._min_cppstd)
check_min_vs(self, 192)
if not is_msvc(self):
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
def set_version(self):
if self.version is None:
git = Git(self, folder=self.recipe_folder)
try:
self.version = git.run("describe --tags --dirty=-d").strip()
except:
self.version = "1.3.0-alpha"
def layout(self):
cmake_layout(self)
def requirements(self):
self.requires("scip/9.2.0", transitive_headers=True)
if self.options.with_tests:
self.requires("boost/[>=1.84.0 <2]") # required only for tests
def generate(self):
tc = CMakeToolchain(self)
tc.variables[self.name + "_version"] = self.version
tc.variables["BUILD_TESTS"] = self.options.with_tests
tc.variables["BUILD_UTILS"] = self.options.with_utils
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.libs = ["ScipPP"]