Skip to content

Commit

Permalink
(#17125) aws-sdk-cpp: conan v2 support
Browse files Browse the repository at this point in the history
* conan v2 support

* use rm_safe to delete s3-crt option

* use cache_variables

* use preprocessor_definitions

* aws-c-event-stream is always a direct dependency

* disable warnings as errors

* aws-checksums is a direct dependency

* restore compatible versions of dependencies

* restore cmake_minimum_required to satisfy stupid hook

* fix build_modules

* fix requires in package_info()

* fix pulseaudio detection

* Add missing transitive headers, fix cmake modules

* use version range for openssl

* bump libcurl

* add version range for libcurl

---------

Co-authored-by: Luis Caro Campos <3535649+jcar87@users.noreply.github.com>
  • Loading branch information
SpaceIm and jcar87 authored Sep 6, 2023
1 parent a1f99f3 commit 39bad72
Show file tree
Hide file tree
Showing 9 changed files with 171 additions and 142 deletions.
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)

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
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)

0 comments on commit 39bad72

Please sign in to comment.