FindAWSGameLiftServerSDK.cmake.Windows 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #
  2. # All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
  3. # its licensors.
  4. #
  5. # For complete copyright and license terms please see the LICENSE at the root of this
  6. # distribution (the "License"). All use of this software is governed by the License,
  7. # or, if provided, by the license below or the license accompanying this file. Do not
  8. # remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
  9. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. #
  11. set(TARGET_WITH_NAMESPACE "3rdParty::AWSGameLiftServerSDK")
  12. if (TARGET ${TARGET_WITH_NAMESPACE})
  13. return()
  14. endif()
  15. set(LIB_NAME "AWSGameLiftServerSDK")
  16. set(${LIB_NAME}_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/${LIB_NAME}/include)
  17. set(${LIB_NAME}_BIN_DIR ${CMAKE_CURRENT_LIST_DIR}/${LIB_NAME}/bin)
  18. set(${LIB_NAME}_LIBS_DIR ${CMAKE_CURRENT_LIST_DIR}/${LIB_NAME}/lib)
  19. if (LY_MONOLITHIC_GAME)
  20. # Import libs path
  21. set(AWSGAMELIFTSERVERSDK_LIB_PATH ${${LIB_NAME}_LIBS_DIR}/$<IF:$<CONFIG:Debug>,Debug,Release>)
  22. else()
  23. # Static libs path
  24. set(AWSGAMELIFTSERVERSDK_LIB_PATH ${${LIB_NAME}_BIN_DIR}/$<IF:$<CONFIG:Debug>,Debug,Release>)
  25. endif()
  26. set(AWSGAMELIFTSERVERSDK_LIBS
  27. ${AWSGAMELIFTSERVERSDK_LIB_PATH}/aws-cpp-sdk-gamelift-server.lib
  28. )
  29. set(AWSGAMELIFTSERVERSDK_COMPILE_DEFINITIONS
  30. AWS_CUSTOM_MEMORY_MANAGEMENT
  31. BUILD_GAMELIFT_SERVER
  32. PLATFORM_SUPPORTS_AWS_NATIVE_SDK
  33. GAMELIFT_USE_STD
  34. )
  35. if (NOT LY_MONOLITHIC_GAME)
  36. # Add 'USE_IMPORT_EXPORT' for external linkage
  37. LIST(APPEND AWSGAMELIFTSERVERSDK_COMPILE_DEFINITIONS USE_IMPORT_EXPORT)
  38. # Runtime dependencies
  39. set(AWSGAMELIFTSERVERSDK_RUNTIME_DEPENDENCIES ${AWSGAMELIFTSERVERSDK_LIB_PATH}/aws-cpp-sdk-gamelift-server.dll)
  40. endif()
  41. # Declare target
  42. add_library(${TARGET_WITH_NAMESPACE} INTERFACE IMPORTED GLOBAL)
  43. # Add include folder
  44. ly_target_include_system_directories(TARGET ${TARGET_WITH_NAMESPACE} INTERFACE ${${LIB_NAME}_INCLUDE_DIR})
  45. # Add link libs
  46. target_link_libraries(${TARGET_WITH_NAMESPACE} INTERFACE ${AWSGAMELIFTSERVERSDK_LIBS})
  47. # Add runtime dependencies if defined
  48. if(DEFINED AWSGAMELIFTSERVERSDK_RUNTIME_DEPENDENCIES)
  49. ly_add_dependencies(${TARGET_WITH_NAMESPACE} ${AWSGAMELIFTSERVERSDK_RUNTIME_DEPENDENCIES})
  50. endif()
  51. # Set compile definitions
  52. target_compile_definitions(${TARGET_WITH_NAMESPACE} INTERFACE ${AWSGAMELIFTSERVERSDK_COMPILE_DEFINITIONS})
  53. set(${LIB_NAME}_FOUND True)