2
0

FindAWSNativeSDK.cmake.Linux 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. #
  2. # Copyright (c) Contributors to the Open 3D Engine Project.
  3. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. #
  5. # SPDX-License-Identifier: Apache-2.0 OR MIT
  6. #
  7. include(CMakeParseArguments)
  8. set(AWSNATIVESDK_PACKAGE_NAME AWSNativeSDK)
  9. set(AWS_BASE_PATH ${CMAKE_CURRENT_LIST_DIR}/${AWSNATIVESDK_PACKAGE_NAME})
  10. # Include Path
  11. set(AWSNATIVESDK_INCLUDE_PATH ${AWS_BASE_PATH}/include)
  12. # Determine the lib path
  13. if(LY_MONOLITHIC_GAME)
  14. # Monolithic builds uses the static libraries
  15. set(AWSNATIVE_SDK_LIB_PATH ${AWS_BASE_PATH}/lib)
  16. else()
  17. # Non-monolithic builds uses the shared libraries
  18. set(AWSNATIVE_SDK_LIB_PATH ${AWS_BASE_PATH}/bin)
  19. endif()
  20. # AWS Compile Definitions
  21. set(AWSNATIVESDK_COMPILE_DEFINITIONS AWS_CUSTOM_MEMORY_MANAGEMENT PLATFORM_SUPPORTS_AWS_NATIVE_SDK)
  22. # Helper function to define individual AWSNativeSDK Libraries
  23. function(ly_declare_aws_library)
  24. set(options)
  25. set(oneValueArgs NAME LIB_FILE)
  26. set(multiValueArgs BUILD_DEPENDENCIES)
  27. cmake_parse_arguments(ly_declare_aws_library "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
  28. set(TARGET_WITH_NAMESPACE "3rdParty::${AWSNATIVESDK_PACKAGE_NAME}::${ly_declare_aws_library_NAME}")
  29. if (NOT TARGET ${TARGET_WITH_NAMESPACE})
  30. add_library(${TARGET_WITH_NAMESPACE} INTERFACE IMPORTED GLOBAL)
  31. ly_target_include_system_directories(TARGET ${TARGET_WITH_NAMESPACE} INTERFACE ${AWSNATIVESDK_INCLUDE_PATH})
  32. if (ly_declare_aws_library_LIB_FILE)
  33. if (LY_MONOLITHIC_GAME)
  34. target_link_libraries(${TARGET_WITH_NAMESPACE}
  35. INTERFACE
  36. ${AWSNATIVE_SDK_LIB_PATH}/${CMAKE_STATIC_LIBRARY_PREFIX}${ly_declare_aws_library_LIB_FILE}${CMAKE_STATIC_LIBRARY_SUFFIX}
  37. ${AWSNATIVESDK_BUILD_DEPENDENCIES}
  38. ${ly_declare_aws_library_BUILD_DEPENDENCIES}
  39. )
  40. else()
  41. target_link_libraries(${TARGET_WITH_NAMESPACE}
  42. INTERFACE
  43. ${AWSNATIVE_SDK_LIB_PATH}/${CMAKE_STATIC_LIBRARY_PREFIX}${ly_declare_aws_library_LIB_FILE}${CMAKE_SHARED_LIBRARY_SUFFIX}
  44. ${AWSNATIVESDK_BUILD_DEPENDENCIES}
  45. ${ly_declare_aws_library_BUILD_DEPENDENCIES}
  46. )
  47. ly_add_dependencies(${TARGET_WITH_NAMESPACE} ${AWSNATIVE_SDK_LIB_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${ly_declare_aws_library_LIB_FILE}${CMAKE_SHARED_LIBRARY_SUFFIX}
  48. ${ly_declare_aws_library_BUILD_DEPENDENCIES})
  49. endif()
  50. elseif (ly_declare_aws_library_BUILD_DEPENDENCIES)
  51. target_link_libraries(${TARGET_WITH_NAMESPACE}
  52. INTERFACE
  53. ${ly_declare_aws_library_BUILD_DEPENDENCIES}
  54. )
  55. endif()
  56. target_link_options(${TARGET_WITH_NAMESPACE} INTERFACE ${AWSNATIVESDK_LINK_OPTIONS})
  57. target_compile_definitions(${TARGET_WITH_NAMESPACE} INTERFACE ${AWSNATIVESDK_COMPILE_DEFINITIONS})
  58. endif()
  59. endfunction()
  60. #### Core ####
  61. set(CORE_STATIC_LIBS
  62. ${AWSNATIVE_SDK_LIB_PATH}/libaws-crt-cpp.a
  63. ${AWSNATIVE_SDK_LIB_PATH}/libaws-c-s3.a
  64. ${AWSNATIVE_SDK_LIB_PATH}/libaws-c-auth.a
  65. ${AWSNATIVE_SDK_LIB_PATH}/libaws-c-mqtt.a
  66. ${AWSNATIVE_SDK_LIB_PATH}/libaws-c-http.a
  67. ${AWSNATIVE_SDK_LIB_PATH}/libaws-c-event-stream.a
  68. ${AWSNATIVE_SDK_LIB_PATH}/libaws-c-io.a
  69. ${AWSNATIVE_SDK_LIB_PATH}/libaws-checksums.a
  70. ${AWSNATIVE_SDK_LIB_PATH}/libaws-c-compression.a
  71. ${AWSNATIVE_SDK_LIB_PATH}/libaws-c-cal.a
  72. ${AWSNATIVE_SDK_LIB_PATH}/libaws-c-common.a
  73. ${AWSNATIVE_SDK_LIB_PATH}/libaws-c-sdkutils.a
  74. ${AWSNATIVE_SDK_LIB_PATH}/libs2n.a
  75. ${AWSNATIVE_SDK_LIB_PATH}/libcurl.a
  76. )
  77. if(LY_MONOLITHIC_GAME)
  78. ly_declare_aws_library(
  79. NAME
  80. Core
  81. LIB_FILE
  82. aws-cpp-sdk-core
  83. BUILD_DEPENDENCIES
  84. ${CORE_STATIC_LIBS}
  85. )
  86. else()
  87. ly_declare_aws_library(
  88. NAME
  89. Core
  90. LIB_FILE
  91. aws-cpp-sdk-core
  92. curl
  93. )
  94. endif()
  95. #### AccessManagement ####
  96. ly_declare_aws_library(
  97. NAME
  98. AccessManagement
  99. LIB_FILE
  100. aws-cpp-sdk-access-management
  101. BUILD_DEPENDENCIES
  102. # Even though AWS Core is a sibling module, make sure it's linked in first because this module depends on it.
  103. 3rdParty::AWSNativeSDK::Core
  104. )
  105. #### BedrockRuntime ####
  106. ly_declare_aws_library(
  107. NAME
  108. BedrockRuntime
  109. LIB_FILE
  110. aws-cpp-sdk-bedrock-runtime
  111. BUILD_DEPENDENCIES
  112. # Even though AWS Core is a sibling module, make sure it's linked in first because this module depends on it.
  113. 3rdParty::AWSNativeSDK::Core
  114. )
  115. #### CognitoIdentity ####
  116. ly_declare_aws_library(
  117. NAME
  118. CognitoIdentity
  119. LIB_FILE
  120. aws-cpp-sdk-cognito-identity
  121. BUILD_DEPENDENCIES
  122. # Even though AWS Core is a sibling module, make sure it's linked in first because this module depends on it.
  123. 3rdParty::AWSNativeSDK::Core
  124. )
  125. #### CognitoIdp ####
  126. ly_declare_aws_library(
  127. NAME
  128. CognitoIdp
  129. LIB_FILE
  130. aws-cpp-sdk-cognito-idp
  131. BUILD_DEPENDENCIES
  132. # Even though AWS Core is a sibling module, make sure it's linked in first because this module depends on it.
  133. 3rdParty::AWSNativeSDK::Core
  134. )
  135. #### DeviceFarm ####
  136. ly_declare_aws_library(
  137. NAME
  138. DeviceFarm
  139. LIB_FILE
  140. aws-cpp-sdk-devicefarm
  141. BUILD_DEPENDENCIES
  142. # Even though AWS Core is a sibling module, make sure it's linked in first because this module depends on it.
  143. 3rdParty::AWSNativeSDK::Core
  144. )
  145. #### DynamoDB ####
  146. ly_declare_aws_library(
  147. NAME
  148. DynamoDB
  149. LIB_FILE
  150. aws-cpp-sdk-dynamodb
  151. BUILD_DEPENDENCIES
  152. # Even though AWS Core is a sibling module, make sure it's linked in first because this module depends on it.
  153. 3rdParty::AWSNativeSDK::Core
  154. )
  155. #### GameLift ####
  156. ly_declare_aws_library(
  157. NAME
  158. GameLift
  159. LIB_FILE
  160. aws-cpp-sdk-gamelift
  161. BUILD_DEPENDENCIES
  162. # Even though AWS Core is a sibling module, make sure it's linked in first because this module depends on it.
  163. 3rdParty::AWSNativeSDK::Core
  164. )
  165. #### IdentityManagement ####
  166. ly_declare_aws_library(
  167. NAME
  168. IdentityManagement
  169. LIB_FILE
  170. aws-cpp-sdk-identity-management
  171. BUILD_DEPENDENCIES
  172. # Even though AWS Core is a sibling module, make sure it's linked in first because this module depends on it.
  173. 3rdParty::AWSNativeSDK::Core
  174. )
  175. #### Kinesis ####
  176. ly_declare_aws_library(
  177. NAME
  178. Kinesis
  179. LIB_FILE
  180. aws-cpp-sdk-kinesis
  181. BUILD_DEPENDENCIES
  182. # Even though AWS Core is a sibling module, make sure it's linked in first because this module depends on it.
  183. 3rdParty::AWSNativeSDK::Core
  184. )
  185. #### Lambda ####
  186. ly_declare_aws_library(
  187. NAME
  188. Lambda
  189. LIB_FILE
  190. aws-cpp-sdk-lambda
  191. BUILD_DEPENDENCIES
  192. # Even though AWS Core is a sibling module, make sure it's linked in first because this module depends on it.
  193. 3rdParty::AWSNativeSDK::Core
  194. )
  195. #### MobileAnalytics ####
  196. # MobileAnalytics library no longer exists and should be replaced with AWS PinPoint or other equivalent API
  197. #### Queues ####
  198. ly_declare_aws_library(
  199. NAME
  200. Queues
  201. LIB_FILE
  202. aws-cpp-sdk-queues
  203. BUILD_DEPENDENCIES
  204. # Even though AWS Core is a sibling module, make sure it's linked in first because this module depends on it.
  205. 3rdParty::AWSNativeSDK::Core
  206. )
  207. #### S3 ####
  208. ly_declare_aws_library(
  209. NAME
  210. S3
  211. LIB_FILE
  212. aws-cpp-sdk-s3
  213. BUILD_DEPENDENCIES
  214. # Even though AWS Core is a sibling module, make sure it's linked in first because this module depends on it.
  215. 3rdParty::AWSNativeSDK::Core
  216. )
  217. #### SNS ####
  218. ly_declare_aws_library(
  219. NAME
  220. SNS
  221. LIB_FILE
  222. aws-cpp-sdk-sns
  223. BUILD_DEPENDENCIES
  224. # Even though AWS Core is a sibling module, make sure it's linked in first because this module depends on it.
  225. 3rdParty::AWSNativeSDK::Core
  226. )
  227. #### SQS ####
  228. ly_declare_aws_library(
  229. NAME
  230. SQS
  231. LIB_FILE
  232. aws-cpp-sdk-sqs
  233. BUILD_DEPENDENCIES
  234. # Even though AWS Core is a sibling module, make sure it's linked in first because this module depends on it.
  235. 3rdParty::AWSNativeSDK::Core
  236. )
  237. #### STS ####
  238. ly_declare_aws_library(
  239. NAME
  240. STS
  241. LIB_FILE
  242. aws-cpp-sdk-sts
  243. BUILD_DEPENDENCIES
  244. # Even though AWS Core is a sibling module, make sure it's linked in first because this module depends on it.
  245. 3rdParty::AWSNativeSDK::Core
  246. )
  247. #### Transfer ####
  248. ly_declare_aws_library(
  249. NAME
  250. Transfer
  251. LIB_FILE
  252. aws-cpp-sdk-transfer
  253. BUILD_DEPENDENCIES
  254. # Even though AWS Core is a sibling module, make sure it's linked in first because this module depends on it.
  255. 3rdParty::AWSNativeSDK::Core
  256. )
  257. #########
  258. ######### Grouping Definitions #########
  259. #########
  260. #### GameLiftClient ####
  261. ly_declare_aws_library(
  262. NAME
  263. GameLiftClient
  264. BUILD_DEPENDENCIES
  265. 3rdParty::AWSNativeSDK::GameLift
  266. 3rdParty::AWSNativeSDK::Core
  267. )
  268. #### AWSClientAuth ####
  269. ly_declare_aws_library(
  270. NAME
  271. AWSClientAuth
  272. BUILD_DEPENDENCIES
  273. 3rdParty::AWSNativeSDK::CognitoIdentity
  274. 3rdParty::AWSNativeSDK::CognitoIdp
  275. 3rdParty::AWSNativeSDK::IdentityManagement
  276. 3rdParty::AWSNativeSDK::STS
  277. 3rdParty::AWSNativeSDK::Core
  278. )
  279. #### AWSCore ####
  280. ly_declare_aws_library(
  281. NAME
  282. AWSCore
  283. BUILD_DEPENDENCIES
  284. 3rdParty::AWSNativeSDK::DynamoDB
  285. 3rdParty::AWSNativeSDK::Lambda
  286. 3rdParty::AWSNativeSDK::S3
  287. 3rdParty::AWSNativeSDK::Core
  288. )