-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
68 lines (56 loc) · 2.39 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration
from conans.model.version import Version
class RedisClientConan(ConanFile):
name = "redis-client"
url = " https://github.com/cblauvelt/redis-client"
homepage = url
author = "Christopher Blauvelt"
description = "A C++ REDIS library."
license = "MIT"
topics = ("redis", "asio")
exports = ["LICENSE"]
exports_sources = ["CMakeLists.txt", "conan.cmake",
"conanfile.py", "redis/*", "test/*"]
generators = "cmake"
settings = "os", "arch", "compiler", "build_type"
requires = "cpool/main_23c5e65a0f9b", "boost/1.78.0", "openssl/1.1.1m", "fmt/8.1.1"
build_requires = "gtest/cci.20210126"
options = {"cxx_standard": [20], "build_testing": [
True, False], "trace_logging": [True, False]}
default_options = {"cxx_standard": 20,
"build_testing": True, "trace_logging": False}
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def configure(self):
if self.settings.os == "Windows" and \
self.settings.compiler == "Visual Studio" and \
Version(self.settings.compiler.version.value) < "16":
raise ConanInvalidConfiguration(
"redis-client does not support MSVC < 16")
def sanitize_tag(self, version):
return re.sub(r'^v', '', version)
def sanitize_branch(self, branch):
return re.sub(r'/', '_', branch)[:12]
def set_version(self):
git = tools.Git(folder=self.recipe_folder)
self.version = self.sanitize_tag(git.get_tag()) if git.get_tag(
) else "%s_%s" % (self.sanitize_branch(git.get_branch()), git.get_revision()[:12])
def build(self):
cmake = CMake(self)
cmake.definitions["CMAKE_CXX_STANDARD"] = self.options.cxx_standard
cmake.definitions["BUILD_TESTING"] = self.options.build_testing
cmake.definitions["CPOOL_TRACE_LOGGING"] = self.options.trace_logging
cmake.configure()
cmake.build()
cmake.test()
def package(self):
self.copy("LICENSE", dst="licenses")
self.copy("*.hpp", dst="include/redis", src="redis")
self.copy("*.a", dst="lib", keep_path=False)
def package_info(self):
self.cpp_info.libs = ["redis_client"]