Skip to content

Commit 1af76aa

Browse files
authored
fix: CMake Fixes to Make it Compatible with Latest Aws-c-common (#812)
* latest crt-cpp and sdk-cpp version * update macos runners
1 parent 42f7af6 commit 1af76aa

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

.github/workflows/osx.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ jobs:
1111

1212
strategy:
1313
matrix:
14-
os: [macos-11, macos-latest]
14+
# macos-latest-large is the latest intel based runner
15+
os: [macos-13, macos-latest-large]
1516
openssl_version: [[email protected]]
1617

1718
steps:
@@ -48,17 +49,17 @@ jobs:
4849
mkdir -p build-aws-sdk-cpp || true
4950
mkdir -p install || true
5051
cd build-aws-sdk-cpp
51-
cmake -G Xcode -DTARGET_ARCH="APPLE" -DBUILD_SHARED_LIBS=ON -DBUILD_ONLY="kms" -DENABLE_UNITY_BUILD=ON ../aws-sdk-cpp
52+
cmake -G Xcode -DTARGET_ARCH="APPLE" -DBUILD_SHARED_LIBS=ON -DBUILD_ONLY="kms" -DENABLE_UNITY_BUILD=ON -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install -DCMAKE_PREFIX_PATH=${{github.workspace}}/install ../aws-sdk-cpp
5253
xcodebuild -target ALL_BUILD
5354
xcodebuild -target install
5455
5556
- name: Build C-ESDK
5657
env:
5758
OPENSSL_VERSION: ${{ matrix.openssl_version }}
58-
# TODO-RS: Figure out how to safely add AWS credentials and add -DAWS_ENC_SDK_END_TO_END_TESTS=ON and -DAWS_ENC_SDK_KNOWN_GOOD_TESTS=ON
59+
# TODO-RS: Figure out how to safely add AWS credentials and add -DAWS_ENC_SDK_END_TO_END_TESTS=ON and -DAWS_ENC_SDK_KNOWN_GOOD_TESTS=ON
5960
run: |
6061
mkdir build-aws-encryption-sdk-c || true
6162
cd build-aws-encryption-sdk-c
62-
cmake -G Xcode -DBUILD_SHARED_LIBS=ON -DOPENSSL_ROOT_DIR="/usr/local/opt/${OPENSSL_VERSION}" ../
63+
cmake -G Xcode -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install -DCMAKE_PREFIX_PATH=${{github.workspace}}/install -DOPENSSL_ROOT_DIR="/usr/local/opt/${OPENSSL_VERSION}" ../
6364
xcodebuild -target ALL_BUILD
6465
xcodebuild -scheme RUN_TESTS

CMakeLists.txt

+3-6
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,13 @@
1515
cmake_minimum_required (VERSION 3.9)
1616
project (aws-encryption-sdk LANGUAGES C)
1717

18-
if (UNIX AND NOT APPLE)
19-
include(GNUInstallDirs)
20-
elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
21-
set(CMAKE_INSTALL_LIBDIR "lib")
22-
endif()
23-
18+
include(GNUInstallDirs)
2419
include(CTest)
2520

2621
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
2722

23+
# This was required for older versions of aws-c-common and fixed in the latest versions.
24+
# Remove this hack, after updating our CodeBuild tests to use the latest version of aws-c-common.
2825
# Make sure we can pick up Cmake modules installed by dependencies
2926
# both when they are in the CMAKE_INSTALL_PREFIX directory
3027
# and in the CMAKE_PREFIX_PATH list.

cmake/InstallLogic.cmake

+7-8
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,16 @@ function(aws_install_target)
4242
endforeach(HEADER_SRCPATH)
4343

4444
install(TARGETS ${AWS_INSTALL_TARGET} EXPORT ${AWS_INSTALL_TARGET}-targets
45-
ARCHIVE DESTINATION "${LIBRARY_DIRECTORY}"
46-
LIBRARY DESTINATION "${LIBRARY_DIRECTORY}"
47-
RUNTIME DESTINATION "${RUNTIME_DIRECTORY}")
48-
45+
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
46+
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
47+
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
48+
4949
configure_file("${PROJECT_SOURCE_DIR}/cmake/${AWS_INSTALL_TARGET}-config.cmake"
5050
"${CMAKE_CURRENT_BINARY_DIR}/${AWS_INSTALL_TARGET}-config.cmake" @ONLY)
51-
52-
install(EXPORT "${AWS_INSTALL_TARGET}-targets" DESTINATION "${LIBRARY_DIRECTORY}/${AWS_INSTALL_TARGET}/cmake/"
51+
install(EXPORT "${AWS_INSTALL_TARGET}-targets" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${AWS_INSTALL_TARGET}/cmake/"
5352
NAMESPACE AWS::
5453
)
55-
54+
5655
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${AWS_INSTALL_TARGET}-config.cmake"
57-
DESTINATION "${LIBRARY_DIRECTORY}/${AWS_INSTALL_TARGET}/cmake/")
56+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/${AWS_INSTALL_TARGET}/cmake/")
5857
endfunction(aws_install_target)

0 commit comments

Comments
 (0)