Skip to content

Commit

Permalink
wip: move aws-sdk-cpp to root of repo
Browse files Browse the repository at this point in the history
  • Loading branch information
aliddell committed May 14, 2024
1 parent 69cfb11 commit 65d44fa
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 53 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "acquire-common"]
path = acquire-common
url = ../acquire-common.git
[submodule "src/3rdParty/aws-sdk-cpp"]
path = src/3rdParty/aws-sdk-cpp
[submodule "aws-sdk-cpp"]
path = aws-sdk-cpp
url = https://github.com/aws/aws-sdk-cpp.git
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include(cmake/ide.cmake)
include(cmake/install-prefix.cmake)
include(cmake/wsl.cmake)
include(cmake/simd.cmake)
#include(cmake/aws.cmake)
include(cmake/aws.cmake)

set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 20)
Expand Down
50 changes: 21 additions & 29 deletions cmake/aws.cmake
Original file line number Diff line number Diff line change
@@ -1,35 +1,27 @@
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../src/3rdParty/aws-sdk-cpp/lib/cmake/AWSSDK")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/../src/3rdParty/aws-sdk-cpp")
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}")
#message(STATUS "CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}")
set(AWSSDK_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../src/3rdParty/aws-sdk-cpp")

# Use the MSVC variable to determine if this is a Windows build.
set(WINDOWS_BUILD ${MSVC})

if (WINDOWS_BUILD) # Set the location where CMake can find the installed libraries for the AWS SDK.
string(REPLACE ";" "/aws-cpp-sdk-all;" SYSTEM_MODULE_PATH "${CMAKE_SYSTEM_PREFIX_PATH}/aws-cpp-sdk-all")
list(APPEND CMAKE_PREFIX_PATH ${SYSTEM_MODULE_PATH})
endif ()
set(SERVICE_COMPONENTS s3)

# Find the AWS SDK for C++ package.
find_package(AWSSDK REQUIRED COMPONENTS ${SERVICE_COMPONENTS})

if (WINDOWS_BUILD)
set(AWS_SDK_DIR "${CMAKE_CURRENT_LIST_DIR}/../aws-sdk-cpp")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/aws-sdk-cpp-build)
set(MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" "${AWS_SDK_DIR}"
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/aws-sdk-cpp-install
-DBUILD_ONLY=${SERVICE_COMPONENTS}
-DENABLE_TESTING=OFF
-DMSVC_RUNTIME_LIBRARY=${MSVC_RUNTIME_LIBRARY}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/aws-sdk-cpp-build
)
execute_process(COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/aws-sdk-cpp-build --config ${CMAKE_BUILD_TYPE} --target install
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/aws-sdk-cpp-build
)

list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_BINARY_DIR}/aws-sdk-cpp-install")
find_package(AWSSDK REQUIRED COMPONENTS s3)
if (MSVC)
# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.

set(BIN_SUB_DIR "/Debug") # if you are building from the command line you may need to uncomment this
# set(BIN_SUB_DIR "/Debug") # if you are building from the command line you may need to uncomment this
# and set the proper subdirectory to the executables' location.

AWSSDK_CPY_DYN_LIBS(SERVICE_COMPONENTS "" ${CMAKE_CURRENT_BINARY_DIR}${BIN_SUB_DIR})
endif ()

message(STATUS "Found AWS SDK for C++ version ${AWSSDK_VERSION}")
message(STATUS "AWS link libraries ${AWSSDK_LINK_LIBRARIES}")

#add_executable(${PROJECT_NAME}
# hello_s3.cpp)
#
#target_link_libraries(${PROJECT_NAME}
# ${AWSSDK_LINK_LIBRARIES})
AWSSDK_CPY_DYN_LIBS(SERVICE_COMPONENTS "" ${CMAKE_CURRENT_BINARY_DIR}/tests)
endif ()
13 changes: 0 additions & 13 deletions src/3rdParty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,2 @@
add_subdirectory(cblosc)
add_subdirectory(json)


# see: https://sdk.amazonaws.com/cpp/api/LATEST/root/html/md_docs_2_c_make___external___project.html
ExternalProject_Add(
aws-sdk-cpp
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/aws-sdk-cpp
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/aws-sdk-cpp
LIST_SEPARATOR "|" # this is needed to separate targets specified in -DBUILD_ONLY below
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/aws-sdk-cpp-install
-DBUILD_ONLY=core|s3
-DENABLE_TESTING=OFF
)
10 changes: 2 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ if (NOT TARGET acquire-core-logger)
add_subdirectory(../acquire-common/acquire-core-libs ${CMAKE_CURRENT_BINARY_DIR}/acquire-core-libs)
endif ()

ExternalProject_Get_Property(aws-sdk-cpp INSTALL_DIR)
SET(AWS_OUTPUT_DIR ${INSTALL_DIR}/../aws-sdk-cpp-install)
INCLUDE_DIRECTORIES(${AWS_OUTPUT_DIR}/include)
LINK_DIRECTORIES(${AWS_OUTPUT_DIR}/lib)


set(tgt acquire-driver-zarr)
add_library(${tgt} MODULE
common.hh
Expand All @@ -35,7 +29,7 @@ add_library(${tgt} MODULE
zarr.v3.cpp
zarr.driver.c
)
add_dependencies(${tgt} acquire-core-logger acquire-core-platform acquire-device-kit acquire-device-properties cblosc json aws-sdk-cpp)
add_dependencies(${tgt} acquire-core-logger acquire-core-platform acquire-device-kit acquire-device-properties cblosc json) # aws-sdk-cpp)
target_enable_simd(${tgt})
target_link_libraries(${tgt} PRIVATE
acquire-core-logger
Expand All @@ -44,7 +38,7 @@ target_link_libraries(${tgt} PRIVATE
acquire-device-properties
cblosc
json
# ${AWSSDK_LINK_LIBRARIES}
${AWSSDK_LINK_LIBRARIES}
)

set_target_properties(${tgt} PROPERTIES
Expand Down

0 comments on commit 65d44fa

Please sign in to comment.