CMakeLists.txt 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. # Copyright (c) Contributors to the Open 3D Engine Project.
  2. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  3. #
  4. # SPDX-License-Identifier: Apache-2.0 OR MIT
  5. # Currently we are in the Code folder: ${CMAKE_CURRENT_LIST_DIR}
  6. # Get the platform specific folder ${pal_dir} for the current folder: ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}
  7. # Note: o3de_pal_dir will take care of the details for us, as this may be a restricted platform
  8. # in which case it will see if that platform is present here or in the restricted folder.
  9. # i.e. It could here in our gem : Gems/WarehouseAutomation/Code/Platform/<platorm_name> or
  10. # <restricted_folder>/<platform_name>/Gems/WarehouseAutomation/Code
  11. o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_parent_relative_path}")
  12. # Now that we have the platform abstraction layer (PAL) folder for this folder, thats where we will find the
  13. # traits for this platform. Traits for a platform are defines for things like whether or not something in this gem
  14. # is supported by this platform.
  15. include(${pal_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
  16. # Check to see if building the Gem Modules are supported for the current platform
  17. if(NOT PAL_TRAIT_WAREHOUSEAUTOMATION_SUPPORTED)
  18. return()
  19. endif()
  20. # The ${gem_name}.API target declares the common interface that users of this gem should depend on in their targets
  21. ly_add_target(
  22. NAME ${gem_name}.API INTERFACE
  23. NAMESPACE Gem
  24. FILES_CMAKE
  25. warehouseautomation_api_files.cmake
  26. ${pal_dir}/warehouseautomation_api_files.cmake
  27. INCLUDE_DIRECTORIES
  28. INTERFACE
  29. Include
  30. BUILD_DEPENDENCIES
  31. INTERFACE
  32. AZ::AzCore
  33. )
  34. # The ${gem_name}.Private.Object target is an internal target
  35. # It should not be used outside of this Gems CMakeLists.txt
  36. ly_add_target(
  37. NAME ${gem_name}.Private.Object STATIC
  38. NAMESPACE Gem
  39. FILES_CMAKE
  40. warehouseautomation_private_files.cmake
  41. ${pal_dir}/warehouseautomation_private_files.cmake
  42. TARGET_PROPERTIES
  43. O3DE_PRIVATE_TARGET TRUE
  44. INCLUDE_DIRECTORIES
  45. PRIVATE
  46. Include
  47. Source
  48. BUILD_DEPENDENCIES
  49. PUBLIC
  50. AZ::AzCore
  51. AZ::AzFramework
  52. Gem::CommonFeaturesAtom.Static
  53. Gem::PhysX.Static
  54. )
  55. # Here add ${gem_name} target, it depends on the Private Object library and Public API interface
  56. ly_add_target(
  57. NAME ${gem_name} ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
  58. NAMESPACE Gem
  59. FILES_CMAKE
  60. warehouseautomation_shared_files.cmake
  61. ${pal_dir}/warehouseautomation_shared_files.cmake
  62. INCLUDE_DIRECTORIES
  63. PUBLIC
  64. Include
  65. PRIVATE
  66. Source
  67. BUILD_DEPENDENCIES
  68. PUBLIC
  69. Gem::${gem_name}.API
  70. PRIVATE
  71. Gem::${gem_name}.Private.Object
  72. )
  73. # By default, we will specify that the above target ${gem_name} would be used by
  74. # Client and Server type targets when this gem is enabled. If you don't want it
  75. # active in Clients or Servers by default, delete one of both of the following lines:
  76. ly_create_alias(NAME ${gem_name}.Clients NAMESPACE Gem TARGETS Gem::${gem_name})
  77. ly_create_alias(NAME ${gem_name}.Servers NAMESPACE Gem TARGETS Gem::${gem_name})
  78. ly_create_alias(NAME ${gem_name}.Unified NAMESPACE Gem TARGETS Gem::${gem_name})
  79. # For the Client and Server variants of ${gem_name} Gem, an alias to the ${gem_name}.API target will be made
  80. ly_create_alias(NAME ${gem_name}.Clients.API NAMESPACE Gem TARGETS Gem::${gem_name}.API)
  81. ly_create_alias(NAME ${gem_name}.Servers.API NAMESPACE Gem TARGETS Gem::${gem_name}.API)
  82. ly_create_alias(NAME ${gem_name}.Unified.API NAMESPACE Gem TARGETS Gem::${gem_name}.API)
  83. # Add in CMake dependencies for each gem dependency listed in this gem's gem.json file
  84. # for the Clients, Servers, Unified gem variants
  85. o3de_add_variant_dependencies_for_gem_dependencies(GEM_NAME ${gem_name} VARIANTS Clients Servers Unified)
  86. # If we are on a host platform, we want to add the host tools targets like the ${gem_name}.Editor MODULE target
  87. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  88. # The ${gem_name}.Editor.API target can be used by other gems that want to interact with the ${gem_name}.Editor module
  89. ly_add_target(
  90. NAME ${gem_name}.Editor.API INTERFACE
  91. NAMESPACE Gem
  92. FILES_CMAKE
  93. warehouseautomation_editor_api_files.cmake
  94. ${pal_dir}/warehouseautomation_editor_api_files.cmake
  95. INCLUDE_DIRECTORIES
  96. INTERFACE
  97. Include
  98. BUILD_DEPENDENCIES
  99. INTERFACE
  100. AZ::AzToolsFramework
  101. )
  102. # The ${gem_name}.Editor.Private.Object target is an internal target
  103. # which is only to be used by this gems CMakeLists.txt and any subdirectories
  104. # Other gems should not use this target
  105. ly_add_target(
  106. NAME ${gem_name}.Editor.Private.Object STATIC
  107. NAMESPACE Gem
  108. FILES_CMAKE
  109. warehouseautomation_editor_private_files.cmake
  110. TARGET_PROPERTIES
  111. O3DE_PRIVATE_TARGET TRUE
  112. INCLUDE_DIRECTORIES
  113. PRIVATE
  114. Include
  115. Source
  116. BUILD_DEPENDENCIES
  117. PUBLIC
  118. AZ::AzToolsFramework
  119. Gem::PhysX.Editor.Static
  120. $<TARGET_OBJECTS:Gem::${gem_name}.Private.Object>
  121. )
  122. ly_add_target(
  123. NAME ${gem_name}.Editor GEM_MODULE
  124. NAMESPACE Gem
  125. AUTOMOC
  126. FILES_CMAKE
  127. warehouseautomation_editor_shared_files.cmake
  128. INCLUDE_DIRECTORIES
  129. PRIVATE
  130. Source
  131. PUBLIC
  132. Include
  133. BUILD_DEPENDENCIES
  134. PUBLIC
  135. Gem::${gem_name}.Editor.API
  136. PRIVATE
  137. Gem::${gem_name}.Editor.Private.Object
  138. )
  139. # By default, we will specify that the above target ${gem_name} would be used by
  140. # Tool and Builder type targets when this gem is enabled. If you don't want it
  141. # active in Tools or Builders by default, delete one or both of the following lines:
  142. ly_create_alias(NAME ${gem_name}.Tools NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
  143. ly_create_alias(NAME ${gem_name}.Builders NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
  144. # For the Tools and Builders variants of ${gem_name} Gem, an alias to the ${gem_name}.Editor API target will be made
  145. ly_create_alias(NAME ${gem_name}.Tools.API NAMESPACE Gem TARGETS Gem::${gem_name}.Editor.API)
  146. ly_create_alias(NAME ${gem_name}.Builders.API NAMESPACE Gem TARGETS Gem::${gem_name}.Editor.API)
  147. # Add in CMake dependencies for each gem dependency listed in this gem's gem.json file
  148. # for the Tools and Builders gem variants
  149. o3de_add_variant_dependencies_for_gem_dependencies(GEM_NAME ${gem_name} VARIANTS Tools Builders)
  150. endif()
  151. ################################################################################
  152. # Tests
  153. ################################################################################
  154. # See if globally, tests are supported
  155. if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  156. # We globally support tests, see if we support tests on this platform for ${gem_name}.Tests
  157. if(PAL_TRAIT_WAREHOUSEAUTOMATION_TEST_SUPPORTED)
  158. # We support ${gem_name}.Tests on this platform, add dependency on the Private Object target
  159. ly_add_target(
  160. NAME ${gem_name}.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  161. NAMESPACE Gem
  162. FILES_CMAKE
  163. warehouseautomation_tests_files.cmake
  164. INCLUDE_DIRECTORIES
  165. PRIVATE
  166. Tests
  167. Source
  168. Include
  169. BUILD_DEPENDENCIES
  170. PRIVATE
  171. AZ::AzTest
  172. AZ::AzFramework
  173. Gem::${gem_name}.Private.Object
  174. )
  175. # Add ${gem_name}.Tests to googletest
  176. ly_add_googletest(
  177. NAME Gem::${gem_name}.Tests
  178. )
  179. endif()
  180. # If we are a host platform we want to add tools test like editor tests here
  181. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  182. # We are a host platform, see if Editor tests are supported on this platform
  183. if(PAL_TRAIT_WAREHOUSEAUTOMATION_EDITOR_TEST_SUPPORTED)
  184. # We support ${gem_name}.Editor.Tests on this platform, add ${gem_name}.Editor.Tests target which depends on
  185. # private ${gem_name}.Editor.Private.Object target
  186. ly_add_target(
  187. NAME ${gem_name}.Editor.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  188. NAMESPACE Gem
  189. FILES_CMAKE
  190. warehouseautomation_editor_tests_files.cmake
  191. INCLUDE_DIRECTORIES
  192. PRIVATE
  193. Tests
  194. Source
  195. Include
  196. BUILD_DEPENDENCIES
  197. PRIVATE
  198. AZ::AzTest
  199. Gem::${gem_name}.Editor.Private.Object
  200. )
  201. # Add ${gem_name}.Editor.Tests to googletest
  202. ly_add_googletest(
  203. NAME Gem::${gem_name}.Editor.Tests
  204. )
  205. endif()
  206. endif()
  207. endif()