-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathconanfile.py
65 lines (51 loc) · 1.89 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
from conans import ConanFile, CMake, tools
import os, re
class Package(ConanFile):
license = "BSD"
description = "This is a C++ library for MARitime NAVigation purposes."
url = "https://github.com/mariokonrad/marnav"
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False]}
default_options = {"shared": False}
exports_sources = [
'LICENSE',
'CMakeLists.txt',
'README.md',
'include/*',
'src/*',
'cmake/*',
'doc/*'
]
__cmake = None
def __cmake_info(self):
cmakelists = tools.load(os.path.join(self.recipe_folder, 'CMakeLists.txt'))
result = re.search(r'project\s*\(\s*([a-zA-Z0-9-_]+)\s+\bVERSION\b\s+(\d+\.\d+\.\d+)(.|\s)*\)',
cmakelists)
return result.group(1), result.group(2)
def __setup_cmake(self):
if not self.__cmake:
self.__cmake = CMake(self)
self.__cmake.definitions['ENABLE_PROFILING'] = "FALSE"
self.__cmake.definitions['ENABLE_BENCHMARK'] = "FALSE"
self.__cmake.definitions['ENABLE_SANITIZER'] = "FALSE"
self.__cmake.definitions['ENABLE_EXAMPLES'] = "FALSE"
self.__cmake.definitions['ENABLE_TESTS'] = "FALSE"
self.__cmake.definitions['ENABLE_TOOLS'] = "FALSE"
self.__cmake.definitions['ENABLE_IWYU'] = "FALSE"
return self.__cmake
def set_name(self):
name, version = self.__cmake_info()
self.name = name
def set_version(self):
name, version = self.__cmake_info()
self.version = version
def build(self):
cmake = self.__setup_cmake()
cmake.configure()
cmake.build()
def package(self):
cmake = self.__setup_cmake()
cmake.configure()
cmake.install()
def package_info(self):
self.cpp_info.libs = [self.name]