-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathconanfile.py
More file actions
68 lines (52 loc) · 2.11 KB
/
conanfile.py
File metadata and controls
68 lines (52 loc) · 2.11 KB
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
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout, CMakeDeps, CMakeToolchain
class InfluxdbCppRestConan(ConanFile):
name = "influxdb-cpp-rest"
version = "1.0.2"
license = "MPL-2.0"
author = "Dmitry Ledentsov"
url = "https://github.com/d-led/influxdb-cpp-rest"
description = "A C++ client library for InfluxDB using C++ REST SDK"
topics = ("influxdb", "cpprest", "http", "client")
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}
# Export source files needed for building
exports_sources = "CMakeLists.txt", "src/*"
def config_options(self):
if self.settings.os == "Windows":
self.options.rm_safe("fPIC")
def configure(self):
if self.options.shared:
self.options["cpprestsdk"].shared = True
def requirements(self):
self.requires("cpprestsdk/2.10.19")
self.requires("rxcpp/4.1.1")
def build_requirements(self):
# Only for tests - not linked to the library
self.test_requires("catch2/3.11.0")
def layout(self):
cmake_layout(self)
def generate(self):
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
tc.generate()
def build(self):
cmake = CMake(self)
# Disable tests and demo for packaging
cmake.configure(variables={"BUILD_TESTING": "OFF", "BUILD_DEMO": "OFF"})
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.set_property("cmake_file_name", "influxdb-cpp-rest")
self.cpp_info.set_property("cmake_target_name", "influxdb-cpp-rest::influxdb-cpp-rest")
# Libraries to link
self.cpp_info.libs = ["influxdb-cpp-rest"]
# Include directories
self.cpp_info.includedirs = ["include"]
# System dependencies (if any)
if self.settings.os == "Linux":
self.cpp_info.system_libs = ["pthread"]