-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
60 lines (50 loc) · 1.78 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, CMake, tools
import os
class HiredisConan(ConanFile):
name = "hiredis"
version = "0.14.0"
description = "Minimalistic C client for Redis >= 1.2"
topics = ("conan", "hiredis", "redis")
url = "https://github.com/zinnion/conan-hiredis"
homepage = "https://github.com/redis/hiredis"
author = "Zinnion <[email protected]>"
license = "MIT"
exports = ["LICENSE.md"]
exports_sources = ["CMakeLists.txt"]
settings = "os", "compiler", "build_type", "arch"
short_paths = True
generators = "cmake"
source_subfolder = "source_subfolder"
build_subfolder = "build_subfolder"
options = {
"shared": [True, False],
}
default_options = (
"shared=True"
)
def source(self):
self.run("git clone https://github.com/redis/hiredis.git source_subfolder")
def configure(self):
del self.settings.compiler.libcxx
def configure_cmake(self):
cmake = CMake(self)
cmake.configure(source_folder=self.source_subfolder, build_folder=self.build_subfolder)
return cmake
def build(self):
cmake = self.configure_cmake()
cmake.build()
def package(self):
self.copy(src=self.source_subfolder, pattern="*.h", dst="include", keep_path=False)
if self.options.shared:
if self.settings.os == "Macos":
self.copy(pattern="*.dylib", dst="lib", keep_path=False)
else:
self.copy(pattern="*.so*", dst="lib", keep_path=False)
else:
self.copy(pattern="*.a", dst="lib", keep_path=False)
cmake = self.configure_cmake()
cmake.install()
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)