-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconanfile.py
More file actions
72 lines (61 loc) · 2.39 KB
/
Copy pathconanfile.py
File metadata and controls
72 lines (61 loc) · 2.39 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
68
69
70
71
72
import os
from conan import ConanFile
from conan.tools.build import cross_building
class Recipe(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps", "CMakeToolchain"
# Make sure grpc build and tool requirements use the same options so it won't be built twice (to save time)
grpc_options = {
"csharp_ext": "False",
"csharp_plugin": "False",
"node_plugin": "False",
"objective_c_plugin": "False",
"otel_plugin": "False",
"php_plugin": "False",
"python_plugin": "False",
"ruby_plugin": "False",
}
def requirements(self):
# These requirements are linked to the product binary
self.requires("grpc/1.82.0", options=self.grpc_options, run=True)
if not cross_building(self):
# Needed for protoc only, auto-picks the version req'd by grpc
self.requires("protobuf/[^6.0.0]", run=True)
def build_requirements(self):
# These requirements are tools or for testing and therefore are not part of the product
if cross_building(self):
self.tool_requires("grpc/1.82.0", options=self.grpc_options)
# Needed for protoc only, auto-picks the version req'd by grpc
self.tool_requires("protobuf/[^6.0.0]")
# gtest for testing
self.test_requires("gtest/[^1.13]")
def layout(self):
# Defines the directory structure
if self.settings.os == "Windows":
self.folders.generators = os.path.join(
"out",
"conan",
str(self.settings.os),
str(self.settings.build_type),
"generators",
)
self.folders.build = os.path.join(
"out", "build", str(self.settings.os), str(self.settings.build_type)
)
else:
# Linux: also distinguish architecture
self.folders.generators = os.path.join(
"out",
"conan",
str(self.settings.os),
str(self.settings.arch),
str(self.settings.build_type),
"generators",
)
self.folders.build = os.path.join(
"out",
"build",
str(self.settings.os),
str(self.settings.arch),
str(self.settings.build_type),
)