-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add aws-sdk-cpp/1.7.299 recipe #1146
Changes from all commits
7a9de2d
cc18f97
ff023bc
42d1b21
72523c9
1b20a51
403a12a
2474deb
7abb581
babeaec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(cmake_wrapper) | ||
|
||
include(conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
add_subdirectory(source_subfolder) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"1.8.34": | ||
url: "https://github.com/aws/aws-sdk-cpp/archive/1.8.34.tar.gz" | ||
sha256: "d036f51b61e86473af289ff18f758a02bc04aede5296d9aac8b81a501d71a87d" |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,133 @@ | ||||||||||
from conans import CMake, ConanFile, tools | ||||||||||
import os | ||||||||||
import string | ||||||||||
|
||||||||||
|
||||||||||
class AwsSdkCppConan(ConanFile): | ||||||||||
name = "aws-sdk-cpp" | ||||||||||
description = "The AWS SDK for C++ provides a modern C++ (version C++ 11 or later) interface for Amazon Web Services (AWS)." | ||||||||||
topics = ("conan", "aws", "amazon", "cloud", ) | ||||||||||
url = "https://github.com/conan-io/conan-center-index" | ||||||||||
homepage = "https://github.com/aws/aws-sdk-cpp" | ||||||||||
license = "Apache-2.0", | ||||||||||
exports_sources = "CMakeLists.txt", | ||||||||||
generators = "cmake", "cmake_find_package" | ||||||||||
settings = "os", "arch", "compiler", "build_type" | ||||||||||
short_paths = True | ||||||||||
options = { | ||||||||||
"shared": [True, False], | ||||||||||
"fPIC": [True, False], | ||||||||||
"with_rtti": [True, False], | ||||||||||
"use_virtual_operations": [True, False], | ||||||||||
"with_curl": [True, False], | ||||||||||
"enable_curl_logging": [True, False], | ||||||||||
} | ||||||||||
default_options = { | ||||||||||
"shared": False, | ||||||||||
"fPIC": True, | ||||||||||
"with_rtti": True, | ||||||||||
"use_virtual_operations": True, | ||||||||||
"with_curl": True, | ||||||||||
"enable_curl_logging": False, | ||||||||||
} | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
_cmake = None | ||||||||||
|
||||||||||
@property | ||||||||||
def _source_subfolder(self): | ||||||||||
return "source_subfolder" | ||||||||||
|
||||||||||
def config_options(self): | ||||||||||
if self.settings.os == "Windows": | ||||||||||
del self.options.fPIC | ||||||||||
|
||||||||||
def configure(self): | ||||||||||
if self.options.shared: | ||||||||||
del self.options.fPIC | ||||||||||
if self.settings.compiler.cppstd: | ||||||||||
tools.check_min_cppstd(self, 2003) | ||||||||||
Comment on lines
+47
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why 2003? Don't you mean 11 (looking at There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering myself. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep 11. 2003 it's not listed as default cppstd in setting.yml. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll make the change to 11. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Btw, using 98,11,14,17 and 20 will cause a new y2k-kind problem in less then 80 years. 🤣 |
||||||||||
if not self.options.with_curl: | ||||||||||
del self.options.enable_curl_logging | ||||||||||
|
||||||||||
def requirements(self): | ||||||||||
self.requires("aws-c-common/0.4.25") | ||||||||||
self.requires("aws-c-event-stream/0.1.5") | ||||||||||
self.requires("openssl/1.1.1g") | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
self.requires("zlib/1.2.11") | ||||||||||
if self.options.with_curl: | ||||||||||
self.requires("libcurl/7.71.1") | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
@property | ||||||||||
def _cmake_cpp_standard(self): | ||||||||||
return ''.join(c for c in str(self.settings.compiler.cppstd) if c in string.digits) | ||||||||||
|
||||||||||
def source(self): | ||||||||||
tools.get(**self.conan_data["sources"][self.version]) | ||||||||||
extracted_folder = "aws-sdk-cpp-{}".format(self.version) | ||||||||||
os.rename(extracted_folder, self._source_subfolder) | ||||||||||
|
||||||||||
def _configure_cmake(self): | ||||||||||
if self._cmake: | ||||||||||
return self._cmake | ||||||||||
self._cmake = CMake(self) | ||||||||||
|
||||||||||
if not self.settings.compiler.cppstd: | ||||||||||
self._cmake.definitions["CMAKE_CXX_STANDARD"] = 11 | ||||||||||
self._cmake.definitions["BUILD_DEPS"] = False | ||||||||||
self._cmake.definitions["ENABLE_UNITY_BUILD"] = True | ||||||||||
self._cmake.definitions["ENABLE_RTTI"] = self.options.with_rtti | ||||||||||
self._cmake.definitions["FORCE_CURL"] = self.options.with_curl | ||||||||||
self._cmake.definitions["ENABLE_CURL_LOGGING"] = self.options.get_safe("enable_curl_logging") | ||||||||||
if self.settings.compiler.cppstd: | ||||||||||
self._cmake.definitions["CPP_STANDARD"] = self._cmake_cpp_standard | ||||||||||
|
||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
self._cmake.definitions["ENABLE_TESTING"] = False | ||||||||||
self._cmake.definitions["SIMPLE_INSTALL"] = True | ||||||||||
if self.settings.compiler == "Visual Studio": | ||||||||||
self._cmake.definitions["FORCE_SHARED_CRT"] = "MD" in str(self.settings.compiler.runtime) | ||||||||||
|
||||||||||
self._cmake.definitions["AUTORUN_UNIT_TESTS"] = False | ||||||||||
|
||||||||||
self._cmake.definitions["ANDROID_BUILD_CURL"] = False | ||||||||||
self._cmake.definitions["ANDROID_BUILD_OPENSSL"] = False | ||||||||||
self._cmake.definitions["ANDROID_BUILD_ZLIB"] = False | ||||||||||
|
||||||||||
self._cmake.configure() | ||||||||||
return self._cmake | ||||||||||
|
||||||||||
def _patch_sources(self): | ||||||||||
tools.replace_in_file(os.path.join(self._source_subfolder, "cmake", "sdks.cmake"), | ||||||||||
"sort_links(EXPORTS)", "# sort_links(EXPORTS)") | ||||||||||
for root, _, _ in os.walk(self._source_subfolder): | ||||||||||
cmakelists = os.path.join(root, "CMakeLists.txt") | ||||||||||
repl = "AWS::aws-c-event-stream" | ||||||||||
if os.path.isfile(cmakelists) and repl in tools.load(cmakelists): | ||||||||||
tools.replace_in_file(cmakelists, repl, "CONAN_PKG::aws-c-event-stream", strict=False) | ||||||||||
Comment on lines
+101
to
+105
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't be required anymore, imported target in |
||||||||||
|
||||||||||
@property | ||||||||||
def _cpu_count(self): | ||||||||||
try: | ||||||||||
cpus = int(tools.cpu_count()) | ||||||||||
return min((cpus, 2)) | ||||||||||
except ValueError: | ||||||||||
return 2 | ||||||||||
|
||||||||||
def build(self): | ||||||||||
self._patch_sources() | ||||||||||
cmake = self._configure_cmake() | ||||||||||
# Reduce parallelism to avoid out-of-memory on limited memory build systems | ||||||||||
with tools.environment_append({"CONAN_CPU_COUNT": str(self._cpu_count)}): | ||||||||||
cmake.build() | ||||||||||
|
||||||||||
def package(self): | ||||||||||
self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) | ||||||||||
cmake = self._configure_cmake() | ||||||||||
cmake.install() | ||||||||||
|
||||||||||
tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why delete this? I, as a consumer, prefer the library's cmake config script, if available, rather than conan's generated one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's cci policy to remove these. @danimtb @uilianries @SpaceIm @jgsogo I feel cci should allow those cmake scripts that play by the book and are fully relocatable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that the other AWS packages don't delete this folder, e.g.
|
||||||||||
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) | ||||||||||
|
||||||||||
def package_info(self): | ||||||||||
self.cpp_info.libs = tools.collect_libs(self) | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as there are inter-dependencies between components (e.g. many depend on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it needs a similar approach as my boost components pr (#2097) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wow, you have a lot going on |
||||||||||
self.cpp_info.names["cmake_find_package"] = "AWSSDK" | ||||||||||
self.cpp_info.names["cmake_find_package_multi"] = "AWSSDK" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <aws/core/Aws.h> | ||
|
||
|
||
int main(void) | ||
{ | ||
Aws::SDKOptions options; | ||
Aws::InitAPI(options); | ||
Aws::ShutdownAPI(options); | ||
return EXIT_SUCCESS; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"1.8.34": | ||
folder: all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.