-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconanfile.py
76 lines (70 loc) · 2.26 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
from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake
class Conan(ConanFile):
name = "liba"
version = "0.1.15"
license = "MPL-2.0"
topics = ["algorithm"]
author = "tqfx tqfx@tqfx.org"
homepage = url = "https://github.com/tqfx/liba"
description = "An algorithm library based on C/C++"
settings = "os", "compiler", "build_type", "arch"
options = {
"pkgconfig": [0, 1],
"symlink": [0, 1],
"shared": [0, 1],
"real": [4, 8],
"ipo": [0, 1],
}
default_options = {
"pkgconfig": 1,
"symlink": 0,
"shared": 0,
"real": 8,
"ipo": 0,
}
exports_sources = [
"include/a.cmake.h.in",
"include/a/*.h*",
"CMakeLists.txt",
"cmake/*.cmake",
"src/*.[ch]*",
"LICENSE.txt",
"README.md",
]
def generate(self):
cmake = CMakeToolchain(self)
cmake.variables["BUILD_TESTING"] = 0
if self.options.shared:
cmake.variables["LIBA_INSTALL"] = "shared"
else:
cmake.variables["LIBA_INSTALL"] = "static"
if self.options.real != 8:
cmake.variables["LIBA_REAL"] = self.options.real
cmake.variables["LIBA_SYMLINK"] = self.options.symlink
cmake.variables["LIBA_PKGCONFIG"] = self.options.pkgconfig
if self.settings.build_type != "Debug":
cmake.variables["LIBA_IPO"] = self.options.ipo
else:
cmake.variables["LIBA_IPO"] = 0
cmake.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 = ["a"]
if self.settings.os != "Windows":
self.cpp_info.system_libs = ["m"]
if self.options.shared:
if self.settings.os == "Windows":
self.cpp_info.libs = ["liba"]
self.cpp_info.defines = ["A_IMPORTS"]
self.cpp_info.set_property("cmake_target_name", "liba")
else:
self.cpp_info.set_property("cmake_target_name", "alib")
if self.options.pkgconfig:
self.cpp_info.set_property("pkg_config_name", "liba")