forked from eclipse-uprotocol/up-cpp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconanfile.py
61 lines (53 loc) · 2.13 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
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir
import os
class UpCpp(ConanFile):
name = "up-cpp"
package_type = "library"
license = "Apache-2.0 license"
homepage = "https://github.com/eclipse-uprotocol"
url = "https://github.com/conan-io/conan-center-index"
description = "This module contains the data model structures as well as core functionality for building uProtocol"
topics = ("utransport sdk", "transport")
# Binary configuration
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
conan_version = None
generators = "CMakeDeps", "PkgConfigDeps", "VirtualRunEnv", "VirtualBuildEnv"
version = "0.1.1-dev"
exports_sources = "CMakeLists.txt", "up-core-api/*", "include/*" ,"src/*" , "test/*", "cmake/*"
options = {
"shared": [True, False],
"fPIC": [True, False],
"build_testing": [True, False],
"build_unbundled": [True, False],
"build_cross_compiling": [True, False],
}
default_options = {
"shared": False,
"fPIC": False,
"build_testing": False,
"build_unbundled": False,
"build_cross_compiling": False,
}
def requirements(self):
self.requires("protobuf/3.21.12" + ("@cross/cross" if self.options.build_cross_compiling else ""))
self.requires("spdlog/1.13.0")
if self.options.build_testing:
self.requires("gtest/1.14.0")
def generate(self):
tc = CMakeToolchain(self)
tc.variables["BUILD_TESTING"] = self.options.build_testing
tc.variables["BUILD_UNBUNDLED"] = self.options.build_unbundled
tc.variables["BUILD_SHARED_LIBS"] = self.options.shared
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.libs = ["up-cpp"]