Skip to content
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

aws-sdk-cpp: conan v2 support #17125

Merged
merged 17 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions recipes/aws-sdk-cpp/all/CMakeLists.txt

This file was deleted.

38 changes: 14 additions & 24 deletions recipes/aws-sdk-cpp/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,19 @@ sources:
sha256: "5dd09baa28d3f6f4fb03fbba1a4269724d79bcca3d47752cd3e15caf97276bda"
patches:
"1.9.234":
- base_path: source_subfolder
patch_file: patches/1.9.234-0001-issue-1816.patch
- base_path: source_subfolder
patch_file: patches/1.9.234-0002-disable-sort-links.patch
- base_path: source_subfolder
patch_file: patches/1.9.100-0002-aws-plugin-conf.patch
- patch_file: patches/1.9.234-0001-issue-1816.patch
- patch_file: patches/1.9.234-0002-disable-sort-links.patch
- patch_file: patches/1.9.100-0002-aws-plugin-conf.patch
- patch_file: patches/1.8.130-0004-improve-pulseaudio-detection.patch
"1.9.100":
- base_path: source_subfolder
patch_file: patches/1.9.100-0001-disable-sort-links.patch
- base_path: source_subfolder
patch_file: patches/1.9.100-0002-aws-plugin-conf.patch
- base_path: source_subfolder
patch_file: patches/1.9.100-0003-issue-1816.patch
- patch_file: patches/1.9.100-0001-disable-sort-links.patch
- patch_file: patches/1.9.100-0002-aws-plugin-conf.patch
- patch_file: patches/1.9.100-0003-issue-1816.patch
- patch_file: patches/1.8.130-0004-improve-pulseaudio-detection.patch
"1.8.130":
- base_path: source_subfolder
patch_file: patches/1.8.130-0001-disable-sort-links.patch
- base_path: source_subfolder
patch_file: patches/1.8.130-0002-force-archive-directory-to-library-directory.patch
- base_path: source_subfolder
patch_file: patches/1.8.130-0003-disable-cmake-install-rpath-use-link-path.patch
- base_path: source_subfolder
patch_file: patches/1.8.130-0004-improve-pulseaudio-detection.patch
- base_path: source_subfolder
patch_file: patches/1.8.130-0005-aws-plugin-conf.patch
- base_path: source_subfolder
patch_file: patches/1.8.130-0006-issue-1816.patch
- patch_file: patches/1.8.130-0001-disable-sort-links.patch
- patch_file: patches/1.8.130-0002-force-archive-directory-to-library-directory.patch
- patch_file: patches/1.8.130-0003-disable-cmake-install-rpath-use-link-path.patch
- patch_file: patches/1.8.130-0004-improve-pulseaudio-detection.patch
- patch_file: patches/1.8.130-0005-aws-plugin-conf.patch
- patch_file: patches/1.8.130-0006-issue-1816.patch
203 changes: 111 additions & 92 deletions recipes/aws-sdk-cpp/all/conanfile.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ index b1054515d5..d1a34ddfc5 100644
message(STATUS "Pulse audio header files have been detected, included pulse audio as a possible sound driver implementation.")
add_definitions("-DPULSE")
- set(PLATFORM_LIBS ${PLATFORM_LIBS} pulse pulse-simple)
+ set(PLATFORM_LIBS ${PLATFORM_LIBS} "CONAN_PKG::pulseaudio")
+ set(PLATFORM_LIBS ${PLATFORM_LIBS} "pulseaudio::pulseaudio")
else()
message(WARNING "We've detected that you are building on linux, but the header files for pulseaudio are not available.\
If you are providing your own audio implementation or you will not be using the text-to-speech library, this is fine.\
11 changes: 4 additions & 7 deletions recipes/aws-sdk-cpp/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
cmake_minimum_required(VERSION 3.1)
project(test_package CXX)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
cmake_minimum_required(VERSION 3.8)
project(test_package LANGUAGES CXX)

find_package(AWSSDK REQUIRED CONFIG)

add_subdirectory(aws-sdk-cpp-plugin)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} aws-sdk-cpp-plugin)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11)
target_link_libraries(${PROJECT_NAME} PRIVATE aws-sdk-cpp-plugin)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.8)

add_project(aws-sdk-cpp-plugin "C++ AWS SDK plugin" AWS::aws-sdk-cpp-s3)
uilianries marked this conversation as resolved.
Show resolved Hide resolved

Expand All @@ -8,7 +8,7 @@ include(GenerateExportHeader)
generate_export_header(${PROJECT_NAME} BASE_NAME aws_sdk_cpp_plugin)
target_include_directories(${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
target_link_libraries(${PROJECT_NAME} PUBLIC ${PROJECT_LIBS})
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)

setup_install()

Expand Down
19 changes: 14 additions & 5 deletions recipes/aws-sdk-cpp/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
from conans import ConanFile, CMake, tools
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"CMakeDeps", "CMakeToolchain"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mpimenov it's not needed this case, because they are declared in generators attribute already. As we don't need to customize anything, but only installing dependencies, using generators is enough for test package. Of course, if you import instead and use generate() method, is not wrong too.

import os


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"

def layout(self):
cmake_layout(self)

def requirements(self):
self.requires(self.tested_reference_str)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(bin_path, env="conanrun")
8 changes: 8 additions & 0 deletions recipes/aws-sdk-cpp/all/test_v1_package/CMakeLists.txt
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(TARGETS)

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package
${CMAKE_CURRENT_BINARY_DIR}/test_package)
17 changes: 17 additions & 0 deletions recipes/aws-sdk-cpp/all/test_v1_package/conanfile.py
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", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)