CMakeLists.txt 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. #
  8. # Currently we are in the Code folder: ${CMAKE_CURRENT_LIST_DIR}
  9. # Get the platform specific folder ${pal_dir} for the current folder: ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}
  10. # Note: o3de_pal_dir will take care of the details for us, as this may be a restricted platform
  11. # in which case it will see if that platform is present here or in the restricted folder.
  12. # i.e. It could here in our gem : Gems/${gem_name}/Code/Platform/<platorm_name> or
  13. # <restricted_folder>/<platform_name>/Gems/${gem_name}/Code
  14. o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_name}")
  15. # Now that we have the platform abstraction layer (PAL) folder for this folder, that's where we will find the
  16. # traits for this platform. Traits for a platform are defines for things like whether or not something in this gem
  17. # is supported by this platform.
  18. include(${pal_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
  19. # Add the ${gem_name}.Private.Static target
  20. # Note: We include the common files and the platform specific files which are set in remotetools_common_files.cmake
  21. # and in ${pal_dir}/remotetools_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
  22. ly_add_target(
  23. NAME ${gem_name}.Private.Static STATIC
  24. NAMESPACE Gem
  25. FILES_CMAKE
  26. remotetools_files.cmake
  27. remotetools_autogen_files.cmake
  28. ${pal_dir}/remotetools_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
  29. TARGET_PROPERTIES
  30. O3DE_PRIVATE_TARGET TRUE
  31. INCLUDE_DIRECTORIES
  32. PRIVATE
  33. Source
  34. BUILD_DEPENDENCIES
  35. PUBLIC
  36. AZ::AzCore
  37. AZ::AzFramework
  38. AZ::AzNetworking
  39. AUTOGEN_RULES
  40. *.AutoPackets.xml,AutoPackets_Header.jinja,$path/$fileprefix.AutoPackets.h
  41. *.AutoPackets.xml,AutoPackets_Inline.jinja,$path/$fileprefix.AutoPackets.inl
  42. *.AutoPackets.xml,AutoPackets_Source.jinja,$path/$fileprefix.AutoPackets.cpp
  43. *.AutoPackets.xml,AutoPacketDispatcher_Header.jinja,$path/$fileprefix.AutoPacketDispatcher.h
  44. *.AutoPackets.xml,AutoPacketDispatcher_Inline.jinja,$path/$fileprefix.AutoPacketDispatcher.inl
  45. )
  46. # Here add ${gem_name} target, it depends on the ${gem_name}.Private.Static
  47. ly_add_target(
  48. NAME ${gem_name} ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
  49. NAMESPACE Gem
  50. FILES_CMAKE
  51. remotetools_shared_files.cmake
  52. ${pal_dir}/remotetools_shared_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
  53. INCLUDE_DIRECTORIES
  54. PRIVATE
  55. Source
  56. BUILD_DEPENDENCIES
  57. PRIVATE
  58. Gem::${gem_name}.Private.Static
  59. )
  60. # Inject the gem name into the Module source file
  61. ly_add_source_properties(
  62. SOURCES
  63. Source/RemoteToolsModule.cpp
  64. PROPERTY COMPILE_DEFINITIONS
  65. VALUES
  66. O3DE_GEM_NAME=${gem_name}
  67. O3DE_GEM_VERSION=${gem_version})
  68. # By default, we will specify that the above target RemoteTools would be used by
  69. # Client, Server and Tools type targets when this gem is enabled. If you don't want it
  70. # active in Clients, Servers and Tools by default, delete one or all of the following lines:
  71. ly_create_alias(NAME ${gem_name}.Clients NAMESPACE Gem TARGETS Gem::${gem_name})
  72. ly_create_alias(NAME ${gem_name}.Servers NAMESPACE Gem TARGETS Gem::${gem_name})
  73. ly_create_alias(NAME ${gem_name}.Unified NAMESPACE Gem TARGETS Gem::${gem_name})
  74. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  75. ly_create_alias(NAME ${gem_name}.Tools NAMESPACE Gem TARGETS Gem::${gem_name})
  76. ly_create_alias(NAME ${gem_name}.LuaTools NAMESPACE Gem TARGETS Gem::${gem_name})
  77. endif()
  78. ################################################################################
  79. # Tests
  80. ################################################################################
  81. # See if globally, tests are supported
  82. if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  83. # We globally support tests, see if we support tests on this platform for ${gem_name}.Tests
  84. if(PAL_TRAIT_REMOTETOOLS_TEST_SUPPORTED)
  85. # We support ${gem_name}.Tests on this platform, add ${gem_name}.Tests target which depends on ${gem_name}.Private.Static
  86. ly_add_target(
  87. NAME ${gem_name}.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  88. NAMESPACE Gem
  89. FILES_CMAKE
  90. remotetools_tests_files.cmake
  91. INCLUDE_DIRECTORIES
  92. PRIVATE
  93. Tests
  94. Source
  95. BUILD_DEPENDENCIES
  96. PRIVATE
  97. AZ::AzCoreTestCommon
  98. AZ::AzTest
  99. AZ::AzFramework
  100. Gem::${gem_name}.Private.Static
  101. )
  102. # Add ${gem_name}.Tests to googletest
  103. ly_add_googletest(
  104. NAME Gem::${gem_name}.Tests
  105. LABELS REQUIRES_tiaf
  106. )
  107. endif()
  108. endif()