-
Notifications
You must be signed in to change notification settings - Fork 24
/
conanfile.py
85 lines (69 loc) · 2.55 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
from conan import ConanFile, tools
from conan.tools.cmake import cmake_layout, CMakeDeps, CMakeToolchain, CMake
import re
def get_version():
try:
content = tools.load("CMakeLists.txt")
version = re.search(r"project\([^\)]+VERSION (\d+\.\d+\.\d+)[^\)]*\)", content).group(1)
return version.strip()
except Exception:
return None
class sc_machineRecipe(ConanFile):
name = "sc-machine"
package_type = "library"
version = get_version()
author = "OSTIS AI"
license = "https://github.com/ostis-ai/sc-machine/blob/master/LICENSE"
url = "https://github.com/ostis-ai/sc-machine"
description = "Software implementation of semantic network storage"
exports = ["LICENSE.md"]
exports_sources = "*", "!.venv", "!build", "!.cache", "!kb", "!kb.bin", "!.env", "!ConanPresets.json", "!docs"
settings = "os", "compiler", "build_type", "arch"
requires = ()
options = {"shared": [True], "fPIC": [True, False]}
default_options = {
"shared": True,
"fPIC": True,
}
@property
def _run_tests(self):
return tools.get_env("CONAN_RUN_TESTS", False)
def build_requirements(self):
self.build_requires("websocketpp/0.8.2")
self.build_requires("nlohmann_json/3.11.3")
self.build_requires("glib/2.78.3")
self.build_requires("antlr4-cppruntime/4.9.3")
def layout(self):
cmake_layout(self)
def build(self):
cmake = CMake(self)
cmake.configure() # equivalent to self.run("cmake . <other args>")
cmake.build()
def test_requirements(self):
if self._run_tests:
self.build_requires("gtest/1.14.0")
def generate(self):
deps = CMakeDeps(self)
# deps.build_context_activated = ["my_tool"]
deps.generate()
tc = CMakeToolchain(self)
tc.generate()
def package(self):
cmake = CMake(self)
cmake.install()
def package_id(self):
del self.info.settings.os
del self.info.settings.compiler
del self.info.settings.build_type
def parse_version(self):
content = tools.files.load(self, self.recipe_folder + "/CMakeLists.txt")
version = re.search(r"project\([^\)]+VERSION (\d+\.\d+\.\d+)[^\)]*\)", content).group(1)
return version.strip()
def package(self):
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.libs = ['new-project']
# uncomment for a header-only library
# def package_id(self):
# self.info.header_only()