-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconanfile.py
61 lines (51 loc) · 1.98 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
from conans import CMake, ConanFile
import os
class NaiveTsearchConan(ConanFile):
name = "naive-tsearch"
description = "A simple tsearch() implementation for platforms without one"
topics = ("tsearch", "tfind", "tdelete", "twalk")
homepage = "https://github.com/kulp/naive-tsearch"
url = "https://github.com/kulp/naive-tsearch"
license = "MIT"
exports_sources = "CMakeLists.txt", "create_release.py", "Changelog.md", "distfiles.yml", "README.md", "NAIVETSEARCH_VERSION", \
"*.c", "*.h", "*.in", "*.inc", "LICENSE", "tests/**"
exports = "LICENSE"
no_copy_source = True
settings = "os", "arch", "compiler", "build_type"
requires = "boost/1.73.0"
generators = "cmake"
options = {
"header_only": [True, False],
}
default_options = {
"header_only": True,
}
def set_version(self):
self.version = open(os.path.join(self.recipe_folder, "NAIVETSEARCH_VERSION")).read().strip()
_cmake = None
def configure(self):
del self.settings.compiler.cppstd
del self.settings.compiler.libcxx
def _configure_cmake(self):
if self._cmake:
return self._cmake
self._cmake = CMake(self)
self._cmake.definitions["NAIVE_TSEARCH_INSTALL"] = True
self._cmake.definitions["NAIVE_TSEARCH_TESTS"] = True
self._cmake.definitions["Boost_USE_STATIC_LIBS"] = not self.options["boost"].shared
self._cmake.configure()
return self._cmake
def build(self):
cmake = self._configure_cmake()
cmake.build()
def package(self):
cmake = self._configure_cmake()
cmake.install()
def package_id(self):
del self.info.options.header_only
def package_info(self):
if self.options.header_only:
self.cpp_info.libs = ["naive-tsearch"]
else:
self.cpp_info.defines = ["NAIVE_TSEARCH_HDRONLY"]
self.cpp_info.includedirs.append(os.path.join("include", "naive-tsearch"))