-
Notifications
You must be signed in to change notification settings - Fork 3
/
conanfile.py
73 lines (61 loc) · 2.7 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
"""Conan recipe package for libstyxe
"""
from conans import CMake, ConanFile
from conans.errors import ConanInvalidConfiguration
from conans.model.version import Version
class LibstyxeConan(ConanFile):
name = "libstyxe"
description = "9P2000(.u/.l/.e) file protocol parser implementation"
license = "Apache-2.0"
author = "Ivan Ryabov <[email protected]>"
url = "https://github.com/abbyssoul/%s.git" % name
homepage = "https://github.com/abbyssoul/%s" % name
topics = ("9P", "9P2000", "plan9", "styx", "protocol", "parser", "distributed", "distributed-file-system", "9pfs", "Modern C++")
settings = "os", "compiler", "build_type", "arch"
options = {
"shared": [True, False],
"fPIC": [True, False]
}
default_options = {"shared": False, "fPIC": True}
generators = "cmake"
build_requires = "gtest/1.10.0"
requires = "libsolace/0.4.1@abbyssoul/stable"
scm = {
"type": "git",
"subfolder": name,
"url": "auto",
"revision": "auto"
}
@property
def _supported_cppstd(self):
return ["17", "gnu17", "20", "gnu20"]
@property
def _source_subfolder(self):
return self.name
def config_options(self):
compiler_version = Version(str(self.settings.compiler.version))
if self.settings.os == "Windows":
del self.options.fPIC
# Exclude compilers that claims to support C++17 but do not in practice
if (self.settings.compiler == "gcc" and compiler_version < "7") or \
(self.settings.compiler == "clang" and compiler_version < "5") or \
(self.settings.compiler == "apple-clang" and compiler_version < "9"):
raise ConanInvalidConfiguration("This library requires C++17 or higher support standard. {} {} is not supported".format(self.settings.compiler, self.settings.compiler.version))
if self.settings.compiler.cppstd and not self.settings.compiler.cppstd in self._supported_cppstd:
raise ConanInvalidConfiguration("This library requires c++17 standard or higher. {} required".format(self.settings.compiler.cppstd))
def _configure_cmake(self):
cmake = CMake(self, parallel=True)
cmake.definitions["PKG_CONFIG"] = "OFF"
cmake.configure(source_folder=self._source_subfolder)
return cmake
def build(self):
cmake = self._configure_cmake()
cmake.build()
def package(self):
cmake = self._configure_cmake()
cmake.install()
self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder)
def package_info(self):
self.cpp_info.libs = ["styxe"]
if self.settings.os == "Linux":
self.cpp_info.libs.append("m")