CMakeLists.txt 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. #
  2. # Copyright 2009-2017 Alibaba Cloud All rights reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. configure_file(src/Config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/include/alibabacloud/core/Config.h @ONLY)
  17. set(core_public_header
  18. include/alibabacloud/core/AlibabaCloud.h
  19. include/alibabacloud/core/AsyncCallerContext.h
  20. include/alibabacloud/core/ClientConfiguration.h
  21. include/alibabacloud/core/CommonClient.h
  22. include/alibabacloud/core/CommonRequest.h
  23. include/alibabacloud/core/CommonResponse.h
  24. include/alibabacloud/core/Config.h
  25. include/alibabacloud/core/CoreClient.h
  26. include/alibabacloud/core/CoreExport.h
  27. include/alibabacloud/core/Credentials.h
  28. include/alibabacloud/core/CredentialsProvider.h
  29. include/alibabacloud/core/EndpointProvider.h
  30. include/alibabacloud/core/Error.h
  31. include/alibabacloud/core/Global.h
  32. include/alibabacloud/core/HmacSha1Signer.h
  33. include/alibabacloud/core/HttpClient.h
  34. include/alibabacloud/core/HttpMessage.h
  35. include/alibabacloud/core/HttpResponse.h
  36. include/alibabacloud/core/HttpRequest.h
  37. include/alibabacloud/core/InstanceProfileCredentialsProvider.h
  38. include/alibabacloud/core/NetworkProxy.h
  39. include/alibabacloud/core/Outcome.h
  40. include/alibabacloud/core/Runnable.h
  41. include/alibabacloud/core/RoaServiceClient.h
  42. include/alibabacloud/core/RoaServiceRequest.h
  43. include/alibabacloud/core/RpcServiceClient.h
  44. include/alibabacloud/core/RpcServiceRequest.h
  45. include/alibabacloud/core/ServiceRequest.h
  46. include/alibabacloud/core/ServiceResult.h
  47. include/alibabacloud/core/Signer.h
  48. include/alibabacloud/core/SimpleCredentialsProvider.h
  49. include/alibabacloud/core/StsAssumeRoleCredentialsProvider.h
  50. include/alibabacloud/core/Url.h
  51. )
  52. set(core_public_header_location
  53. include/alibabacloud/core/location/LocationClient.h
  54. include/alibabacloud/core/location/LocationRequest.h
  55. )
  56. set(core_public_header_location_model
  57. include/alibabacloud/core/location/model/DescribeEndpointsRequest.h
  58. include/alibabacloud/core/location/model/DescribeEndpointsResult.h
  59. )
  60. set(core_public_header_sts
  61. include/alibabacloud/core/sts/StsClient.h
  62. include/alibabacloud/core/sts/StsRequest.h
  63. )
  64. set(core_public_header_sts_model
  65. include/alibabacloud/core/sts/model/AssumeRoleRequest.h
  66. include/alibabacloud/core/sts/model/AssumeRoleResult.h
  67. include/alibabacloud/core/sts/model/GetCallerIdentityRequest.h
  68. include/alibabacloud/core/sts/model/GetCallerIdentityResult.h
  69. )
  70. set(core_src
  71. src/AlibabaCloud.cc
  72. src/AsyncCallerContext.cc
  73. src/ClientConfiguration.cc
  74. src/CommonClient.cc
  75. src/CommonRequest.cc
  76. src/CommonResponse.cc
  77. src/CoreClient.cc
  78. src/Credentials.cc
  79. src/CredentialsProvider.cc
  80. src/CurlHttpClient.h
  81. src/CurlHttpClient.cc
  82. src/EcsMetadataFetcher.cc
  83. src/EcsMetadataFetcher.h
  84. src/EndpointProvider.cc
  85. src/Error.cc
  86. src/Executor.cc
  87. src/Executor.h
  88. src/HmacSha1Signer.cc
  89. src/HttpClient.cc
  90. src/HttpMessage.cc
  91. src/HttpResponse.cc
  92. src/HttpRequest.cc
  93. src/InstanceProfileCredentialsProvider.cc
  94. src/NetworkProxy.cc
  95. src/Outcome.cc
  96. src/Runnable.cc
  97. src/RoaServiceClient.cc
  98. src/RoaServiceRequest.cc
  99. src/RpcServiceClient.cc
  100. src/RpcServiceRequest.cc
  101. src/ServiceRequest.cc
  102. src/ServiceResult.cc
  103. src/Signer.cc
  104. src/SimpleCredentialsProvider.cc
  105. src/StsAssumeRoleCredentialsProvider.cc
  106. src/Url.cc
  107. src/Utils.h
  108. src/Utils.cc
  109. src/location/LocationClient.cc
  110. src/location/LocationRequest.cc
  111. src/location/model/DescribeEndpointsRequest.cc
  112. src/location/model/DescribeEndpointsResult.cc
  113. src/sts/StsClient.cc
  114. src/sts/StsRequest.cc
  115. src/sts/model/AssumeRoleRequest.cc
  116. src/sts/model/AssumeRoleResult.cc
  117. src/sts/model/GetCallerIdentityRequest.cc
  118. src/sts/model/GetCallerIdentityResult.cc
  119. )
  120. add_library(core ${LIB_TYPE}
  121. ${core_public_header}
  122. ${core_public_header_location}
  123. ${core_public_header_location_model}
  124. ${core_public_header_sts}
  125. ${core_public_header_sts_model}
  126. ${core_src})
  127. set_target_properties(core
  128. PROPERTIES
  129. LINKER_LANGUAGE CXX
  130. ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
  131. LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
  132. RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
  133. OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}core
  134. )
  135. if(${LIB_TYPE} STREQUAL "SHARED")
  136. set_target_properties(core
  137. PROPERTIES
  138. DEFINE_SYMBOL ALIBABACLOUD_CORE_LIBRARY)
  139. endif()
  140. target_include_directories(core
  141. PRIVATE include )
  142. if(CMAKE_HOST_WIN32)
  143. ExternalProject_Get_Property(curl INSTALL_DIR)
  144. set(curl_install_dir ${INSTALL_DIR})
  145. ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
  146. set(jsoncpp_install_dir ${INSTALL_DIR})
  147. add_dependencies(core
  148. curl
  149. jsoncpp )
  150. target_include_directories(core
  151. PRIVATE ${curl_install_dir}/include
  152. ${jsoncpp_install_dir}/include
  153. ${tinyxml2_install_dir}/include)
  154. target_link_libraries(core
  155. Crypt32
  156. Rpcrt4
  157. Ws2_32
  158. ${jsoncpp_install_dir}/lib/jsoncpp.lib
  159. debug ${curl_install_dir}/lib/libcurl-d.lib
  160. optimized ${curl_install_dir}/lib/libcurl.lib
  161. )
  162. target_compile_definitions(core
  163. PRIVATE CURL_STATICLIB
  164. _CRT_SECURE_NO_WARNINGS)
  165. else()
  166. target_include_directories(core
  167. PRIVATE /usr/include/jsoncpp)
  168. target_link_libraries(core
  169. crypto
  170. curl
  171. jsoncpp
  172. uuid )
  173. endif()
  174. install(FILES ${core_public_header}
  175. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/core)
  176. install(FILES ${core_public_header_location}
  177. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/core/location)
  178. install(FILES ${core_public_header_location_model}
  179. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/core/location/model)
  180. install(FILES ${core_public_header_sts}
  181. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/core/sts)
  182. install(FILES ${core_public_header_sts_model}
  183. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/core/sts/model)
  184. install(TARGETS core
  185. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  186. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  187. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  188. )