forked from libcpr/cpr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
57 lines (48 loc) · 1.55 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
from conans import ConanFile, tools, CMake
import os
class cprConan(ConanFile):
name = "cpr"
version = "1.3.0"
license = "MIT"
url = "https://github.com/whoshuu/cpr"
description = "C++ Requests: Curl for People, a spiritual port of Python Requests"
settings = "os", "compiler", "build_type", "arch"
exports_sources = "*"
requires = "libcurl/7.56.1@bincrafters/stable", "OpenSSL/1.0.2@conan/stable"
generators = "cmake"
options = {
"shared" : [True, False],
"enable_ssl" : [True, False],
"enable_system_curl" : [True, False]
}
default_options = (
"shared=False",
"enable_ssl=True",
"enable_system_curl=True"
)
def optionBool(self, b):
if b:
return "ON"
else:
return "OFF"
def parseOptionsToCMake(self):
cmakeOpts = {
"BUILD_CPR_TESTS" : "OFF"
}
cmakeOpts["BUILD_SHARED_LIBS"] = self.optionBool(self.options.shared)
cmakeOpts["USE_SYSTEM_CURL"] = self.optionBool(self.options.enable_system_curl)
return cmakeOpts
def config(self):
pass
def build(self):
cmake = CMake(self)
os.makedirs("./buildit")
cmake.configure(defs=self.parseOptionsToCMake(), build_dir="./buildit")
cmake.build()
cmake.install()
def package(self):
# nothing to do here now
pass
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
self.cpp_info.includedirs = ["include"]