forked from SlavaMelanko/conan-aws-sdk-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
237 lines (221 loc) · 7.19 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
from conans import ConanFile, CMake, tools
import os
def merge_dicts_for_sdk(a, b):
res = a.copy()
res.update(b)
return res
class AwssdkcppConan(ConanFile):
name = "aws-sdk-cpp"
version = "1.7.212"
license = "Apache 2.0"
url = "https://github.com/kmaragon/conan-aws-sdk-cpp"
description = "Conan Package for aws-sdk-cpp"
short_paths = True
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
requires = "zlib/1.2.11"
exports_sources = ["patch-cmakelists.patch", "patch-c-libs.patch"]
sdks = ("access_management",
"acm",
"alexaforbusiness"
"amplify"
"apigateway",
"application_autoscaling",
"appstream",
"appsync",
"athena",
"autoscaling",
"batch",
"budgets",
"chime",
"cloud9",
"clouddirectory",
"cloudformation",
"cloudfront",
"cloudhsmv2",
"cloudsearch",
"cloudtrail",
"codebuild",
"codecommit",
"codedeploy",
"codepipeline",
"codestar",
"cognito_identity",
"cognito_idp",
"cognito_sync",
"comprehend",
"config",
"cur",
"datapipeline",
"dax",
"devicefarm",
"directconnect",
"discovery",
"dlm",
"dms",
"docdb",
"ds",
"dynamodb",
"dynamodbstreams",
"ec2",
"ecr",
"ecs",
"eks",
"elasticache",
"elasticbeanstalk",
"elasticfilesystem",
"elasticloadbalancing",
"elasticloadbalancingv2",
"elasticmapreduce",
"elastictranscoder",
"email",
"es",
"events",
"firehose",
"fms",
"fsx",
"gamelift",
"glacier",
"globalaccelerator",
"glue",
"greengrass",
"guardduty",
"health",
"iam",
"identity_management",
"importexport",
"inspector",
"iot_data",
"iot_jobs_data",
"iot",
"kafka",
"kinesis",
"kinesisanalytics",
"kinesisvideo",
"kms",
"lambda",
"lex",
"lightsail",
"logs",
"machinelearnings",
"macie",
"marketplace_entitlement",
"marketplacecommerceanalytics",
"mediaconvert",
"medialive",
"mediapackage",
"mediastore",
"mediatailor",
"meteringmarketplace",
"mobileanalytics",
"monitoring",
"mq",
"mturk_requester",
"neptune",
"opsworks",
"opsworkscm",
"organizations",
"pinpoint",
"polly",
"pricing",
"queues",
"quicksight",
"ram",
"rds",
"redshift",
"recognition",
"resource_groups",
"robomaker"
"route53",
"route53domains",
"s3",
"sagemaker",
"sdb",
"serverlessrepo"
"servicecatalog",
"servicediscovery",
"shield",
"signer",
"sms",
"snowball",
"sns",
"sqs",
"ssm",
"states",
"storagegateway",
"sts",
"support",
"swf",
"text_to_speech",
"texttract",
"transcribe",
"transfer",
"translate",
"waf",
"workdocs",
"worklink",
"workmail",
"workspaces",
"xray"
)
options = merge_dicts_for_sdk({"build_" + x: [True, False] for x in sdks}, {
"shared": [True, False],
"min_size": [True, False]
})
default_options = ("shared=False","min_size=False") + tuple("build_" + x + "=False" for x in sdks)
def requirements(self):
if self.settings.os != "Windows":
if self.settings.os != "Macos":
self.requires("openssl/1.1.1d")
self.requires("libcurl/7.66.0@bincrafters/stable")
def source(self):
tools.download("https://github.com/aws/aws-sdk-cpp/archive/%s.tar.gz" % self.version, "aws-sdk-cpp.tar.gz")
tools.unzip("aws-sdk-cpp.tar.gz")
os.unlink("aws-sdk-cpp.tar.gz")
# patch the shipped CMakeLists.txt which builds stuff before even declaring a project
tools.patch(patch_file=os.path.join(self.source_folder, "patch-cmakelists.patch"))
tools.patch(patch_file=os.path.join(self.source_folder, "patch-c-libs.patch"))
# This small hack might be useful to guarantee proper /MT /MD linkage in MSVC
# if the packaged project doesn't have variables to set it properly
tools.replace_in_file("aws-sdk-cpp-%s/CMakeLists.txt" % self.version, "project(\"aws-cpp-sdk-all\" VERSION \"${PROJECT_VERSION}\" LANGUAGES CXX)", '''project(aws-cpp-sdk-all VERSION "${PROJECT_VERSION}" LANGUAGES CXX)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
''')
def build(self):
cmake = CMake(self)
build_only = list([])
for sdk in self.sdks:
if getattr(self.options, "build_" + sdk):
build_only.append(sdk)
cmake.definitions["BUILD_ONLY"] = ";".join(build_only)
cmake.definitions["ENABLE_UNITY_BUILD"] = "ON"
cmake.definitions["ENABLE_TESTING"] = "OFF"
cmake.definitions["AUTORUN_UNIT_TESTS"] = "OFF"
cmake.definitions["MINIMIZE_SIZE"] = "ON" if self.options.min_size else "OFF"
cmake.definitions["BUILD_SHARED_LIBS"] = "ON" if self.options.shared else "OFF"
cmake.definitions["FORCE_SHARED_CRT"] = "ON" if self.options.shared else "OFF"
cmake.configure(source_folder="%s/aws-sdk-cpp-%s" % (self.source_folder, self.version), build_folder=self.build_folder)
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install(build_dir=self.build_folder)
def package_info(self):
libs = list([])
for sdk in self.sdks:
if getattr(self.options, "build_" + sdk):
libs.append("aws-cpp-sdk-" + sdk)
libs.extend(["aws-cpp-sdk-core", "aws-c-event-stream", "aws-c-common", "aws-checksums"])
if self.settings.os == "Windows":
libs.append("winhttp")
libs.append("wininet")
libs.append("bcrypt")
libs.append("userenv")
libs.append("version")
libs.append("ws2_32")
if self.settings.os == "Linux":
libs.append("atomic")
if self.settings.compiler == "clang":
libs.append("-stdlib=libstdc++")
self.cpp_info.libs = libs
self.cpp_info.libdirs = ["lib"]
self.cpp_info.includedirs = ["include"]