-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
82 lines (69 loc) · 2.47 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
class JsonRpcRecipe(ConanFile):
""" Conan recipe for jsonrpc-cpp-lib """
name = "jsonrpc-cpp-lib"
version = "1.0.0"
license = "MIT"
author = "Shou-Li Hsu <[email protected]>"
url = "https://github.com/hankhsu1996/jsonrpc-cpp-lib"
description = (
"Welcome to the JSON-RPC 2.0 Modern C++ Library! "
"This library provides a lightweight, modern C++ implementation of "
"JSON-RPC 2.0 servers and clients. It is designed to be flexible, allowing "
"integration with various transport layers. This library makes it easy to "
"register methods and notifications, binding them to client logic efficiently."
)
topics = ("json-rpc", "rpc", "json", "modern-c++", "networking")
# Binary configuration
settings = "os", "compiler", "build_type", "arch"
# Declare package dependencies
requires = [
"nlohmann_json/3.11.3",
"spdlog/1.14.1",
"bshoshany-thread-pool/4.1.0",
"asio/1.28.2"
]
tool_requires = [
"ninja/1.12.1",
"ccache/4.10"
]
test_requires = [
"catch2/3.6.0"
]
# Define options for building examples and tests
options = {
"build_examples": [True, False],
"build_tests": [True, False]
}
default_options = {
"build_examples": False,
"build_tests": False
}
exports_sources = "CMakeLists.txt", "src/*", "include/*", "LICENSE", "README.md"
def layout(self):
""" Define the layout of the project """
cmake_layout(self)
def generate(self):
""" Generate the CMake toolchain and dependencies files """
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
tc.user_presets_path = 'ConanPresets.json'
tc.cache_variables["USE_CONAN"] = "ON"
tc.cache_variables["BUILD_EXAMPLES"] = self.options.build_examples
tc.cache_variables["BUILD_TESTS"] = self.options.build_tests
tc.generator = "Ninja"
tc.generate()
def build(self):
""" Build the project """
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
""" Package the project """
cmake = CMake(self)
cmake.install()
def package_info(self):
""" Define package information for consumers """
self.cpp_info.libs = ["jsonrpc-cpp-lib"]