-
Notifications
You must be signed in to change notification settings - Fork 24
/
conanfile.py
78 lines (65 loc) · 2.59 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
from conan import ConanFile, tools
from conan.tools.cmake import cmake_layout, CMakeDeps, CMakeToolchain, CMake
import re
class sc_machineRecipe(ConanFile):
name = "sc-machine"
package_type = "library"
version = None
author = "OSTIS AI"
license = "https://github.com/ostis-ai/sc-machine/blob/master/COPYING.MIT"
url = "https://github.com/ostis-ai/sc-machine"
description = "Software implementation of semantic memory and its APIs"
exports = ["LICENSE.md"]
exports_sources = "*", "!.venv", "!build", "!.cache", "!kb", "!kb.bin", "!.env", "!ConanPresets.json", "!docs", "!.git"
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 requirements(self):
self.requires("websocketpp/0.8.2", options={"asio": "standalone"})
self.requires("nlohmann_json/3.11.3")
self.requires("glib/2.76.3")
# TODO(FallenChromium): use this instead of thirdparty/antlr4
# self.requires("antlr4-cppruntime/4.9.3")
def build_requirements(self):
self.build_requires("libxml2/2.13.4")
self.test_requires("gtest/1.14.0")
self.test_requires("benchmark/1.9.0")
def layout(self):
cmake_layout(self)
def build(self):
cmake = CMake(self)
cmake.configure() # equivalent to self.run("cmake . <other args>")
cmake.build()
def generate(self):
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
tc.user_presets_path = "ConanPresets.json"
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 set_version(self):
self.version = self.parse_version()
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_info(self):
self.cpp_info.set_property("cmake_find_mode", "none") # Do NOT generate any files
self.cpp_info.builddirs.append("lib/cmake/sc-machine")
self.cpp_info.builddirs.append("build/" + str(self.settings.build_type)) # Provides correct install path for conan editable