forked from liblogicalaccess/liblogicalaccess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
182 lines (162 loc) · 7.35 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
from conans import ConanFile, CMake, tools
class LLAConan(ConanFile):
name = "LogicalAccess"
version = "2.4.0"
license = "https://github.com/islog/liblogicalaccess/blob/develop/LICENSE"
url = "https://github.com/islog/liblogicalaccess"
description = "ISLOG RFID library"
settings = "os", "compiler", "build_type", "arch"
requires = 'boost/1.79.0', 'openssl/1.1.1n', 'nlohmann_json/3.9.1', 'zlib/1.2.12'
generators = "cmake"
options = {'LLA_BUILD_IKS': [True, False],
'LLA_BUILD_PKCS': [True, False],
'LLA_BUILD_UNITTEST': [True, False],
'LLA_BUILD_RFIDEAS': [True, False],
'LLA_BUILD_LIBUSB': [True, False]}
revision_mode = "scm"
exports_sources = "plugins*", "src*", "include*", "CMakeLists.txt", "cmake*", "liblogicalaccess.config", "tests*", "samples*"
if tools.os_info.is_windows:
default_options = '''
openssl:shared=True
boost:shared=False
gtest:shared=True
LLA_BUILD_IKS=False
LLA_BUILD_PKCS=True
LLA_BUILD_RFIDEAS=False
LLA_BUILD_UNITTEST=False
LLA_BUILD_LIBUSB=False'''
else:
default_options = '''
openssl:shared=True
boost:shared=True
gtest:shared=True
LLA_BUILD_IKS=False
LLA_BUILD_PKCS=True
LLA_BUILD_UNITTEST=False
LLA_BUILD_LIBUSB=False'''
def configure(self):
if self.settings.os != 'Windows':
# This options is not used on Linux
del self.options.LLA_BUILD_RFIDEAS
def requirements(self):
if self.settings.os == 'Windows' and self.options.LLA_BUILD_RFIDEAS:
self.requires('rfideas/7.1.5@islog/stable')
if self.options.LLA_BUILD_IKS:
self.requires('grpc/1.39.1')
if self.options.LLA_BUILD_UNITTEST:
self.requires('gtest/1.11.0')
if self.options.LLA_BUILD_PKCS:
self.requires('cppkcs11/1.1')
if self.options.LLA_BUILD_LIBUSB:
self.requires('libusb/1.0.24')
def imports(self):
if tools.os_info.is_windows:
self.copy("*.dll", "bin", "bin")
def configure_cmake(self):
cmake = CMake(self, build_type=self.settings.build_type)
if self.settings.os == 'Android':
# Workaround to avoid conan passing -stdlib=libc++
# to compiler. See https://github.com/conan-io/conan/issues/2856
cmake.definitions['CONAN_LIBCXX'] = ''
cmake.definitions['LLA_BOOST_ASIO_HAS_STD_STRING_VIEW'] = 1
if self.options.LLA_BUILD_IKS:
cmake.definitions['LLA_BUILD_IKS'] = True
else:
cmake.definitions['LLA_BUILD_IKS'] = False
if self.options.LLA_BUILD_PKCS:
cmake.definitions['LLA_BUILD_PKCS'] = True
else:
cmake.definitions['LLA_BUILD_PKCS'] = False
if self.options.LLA_BUILD_UNITTEST:
cmake.definitions['LLA_BUILD_UNITTEST'] = True
else:
cmake.definitions['LLA_BUILD_UNITTEST'] = False
if 'LLA_BUILD_RFIDEAS' in self.options and self.options.LLA_BUILD_RFIDEAS:
cmake.definitions['LLA_BUILD_RFIDEAS'] = True
else:
cmake.definitions['LLA_BUILD_RFIDEAS'] = False
if self.options.LLA_BUILD_LIBUSB:
cmake.definitions['LLA_BUILD_LIBUSB'] = True
else:
cmake.definitions['LLA_BUILD_LIBUSB'] = False
cmake.definitions['LIBLOGICALACCESS_VERSION_STRING'] = self.version
cmake.definitions['LIBLOGICALACCESS_WINDOWS_VERSION'] = self.version.replace('.', ',') + ',0'
cmake.definitions['TARGET_ARCH'] = self.settings.arch
if tools.os_info.is_windows:
# For MSVC we need to restrict configuration type to avoid issues.
cmake.definitions['CMAKE_CONFIGURATION_TYPES'] = self.settings.build_type
cmake.configure()
return cmake
def build(self):
cmake = self.configure_cmake()
cmake.build()
def package(self):
cmake = self.configure_cmake()
cmake.install()
def package_info(self):
if self.settings.os == 'Android':
# For Android we only package a subsets of libraries.
self.cpp_info.libs.append('logicalaccess')
self.cpp_info.libs.append('llacommon')
self.cpp_info.libs.append('logicalaccess-cryptolib')
self.cpp_info.libs.append('iso7816readers')
self.cpp_info.libs.append('desfirecards')
self.cpp_info.libs.append('mifarecards')
self.cpp_info.libs.append('iso7816cards')
self.cpp_info.libs.append('samav2cards')
self.cpp_info.libs.append('epasscards')
self.cpp_info.libs.append('seoscards')
return
if self.settings.os == 'Windows':
# Those are some windows specific stuff.
self.cpp_info.libs.append('keyboardreaders')
if self.options.LLA_BUILD_RFIDEAS:
self.cpp_info.libs.append('rfideasreaders')
if self.settings.arch == 'x86_64':
self.cpp_info.libs.append('islogkbdhooklib64')
else:
self.cpp_info.libs.append('islogkbdhooklib32')
# Linux / Windows common plugins.
self.cpp_info.libs.append('llacommon')
self.cpp_info.libs.append('logicalaccess-cryptolib')
self.cpp_info.libs.append('cps3cards')
self.cpp_info.libs.append('deisterreaders')
self.cpp_info.libs.append('desfirecards')
self.cpp_info.libs.append('elatecreaders')
self.cpp_info.libs.append('em4102cards')
self.cpp_info.libs.append('em4135cards')
self.cpp_info.libs.append('felicacards')
self.cpp_info.libs.append('generictagcards')
self.cpp_info.libs.append('gunneboreaders')
self.cpp_info.libs.append('icode1cards')
self.cpp_info.libs.append('icode2cards')
self.cpp_info.libs.append('indalacards')
self.cpp_info.libs.append('infineonmydcards')
self.cpp_info.libs.append('iso15693cards')
self.cpp_info.libs.append('iso7816cards')
self.cpp_info.libs.append('iso7816readers')
self.cpp_info.libs.append('legicprimecards')
if self.options.LLA_BUILD_LIBUSB:
self.cpp_info.libs.append('libusbreaders')
self.cpp_info.libs.append('logicalaccess')
self.cpp_info.libs.append('mifarecards')
self.cpp_info.libs.append('mifarepluscards')
self.cpp_info.libs.append('mifareultralightcards')
self.cpp_info.libs.append('ok5553readers')
self.cpp_info.libs.append('osdpreaders')
self.cpp_info.libs.append('pcscreaders')
self.cpp_info.libs.append('proxcards')
self.cpp_info.libs.append('proxlitecards')
self.cpp_info.libs.append('samav2cards')
self.cpp_info.libs.append('seoscards')
self.cpp_info.libs.append('smartframecards')
self.cpp_info.libs.append('stidstrreaders')
self.cpp_info.libs.append('stmlri512cards')
self.cpp_info.libs.append('tagitcards')
self.cpp_info.libs.append('topazcards')
self.cpp_info.libs.append('twiccards')
self.cpp_info.libs.append('epasscards')
self.cpp_info.libs.append('yubikeycards')
def package_id(self):
self.info.requires["boost"].full_package_mode()
self.info.requires["openssl"].full_package_mode()