CMakeLists.txt 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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. o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_parent_relative_path}")
  9. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  10. set(additional_tool_deps AZ::AzToolsFramework)
  11. endif()
  12. ly_add_target(
  13. NAME ${gem_name}.Static STATIC
  14. NAMESPACE Gem
  15. FILES_CMAKE
  16. awscore_files.cmake
  17. ${pal_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
  18. INCLUDE_DIRECTORIES
  19. PUBLIC
  20. Include
  21. ${pal_dir}
  22. PRIVATE
  23. Source
  24. BUILD_DEPENDENCIES
  25. PRIVATE
  26. AZ::AzCore
  27. AZ::AzFramework
  28. AZ::AWSNativeSDKInit
  29. PUBLIC
  30. 3rdParty::AWSNativeSDK::AWSCore
  31. )
  32. ly_add_target(
  33. NAME ${gem_name} ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
  34. NAMESPACE Gem
  35. FILES_CMAKE
  36. awscore_shared_files.cmake
  37. INCLUDE_DIRECTORIES
  38. PRIVATE
  39. Source
  40. BUILD_DEPENDENCIES
  41. PRIVATE
  42. AZ::AzCore
  43. PUBLIC
  44. Gem::${gem_name}.Static
  45. )
  46. # Inject the gem name into the Module source file
  47. ly_add_source_properties(
  48. SOURCES
  49. Source/AWSCoreModule.cpp
  50. PROPERTY COMPILE_DEFINITIONS
  51. VALUES
  52. O3DE_GEM_NAME=${gem_name}
  53. O3DE_GEM_VERSION=${gem_version})
  54. # clients and servers will use the above Gem::${gem_name} module.
  55. ly_create_alias(
  56. NAME ${gem_name}.Servers
  57. NAMESPACE Gem
  58. TARGETS
  59. Gem::${gem_name}
  60. )
  61. ly_create_alias(
  62. NAME ${gem_name}.Clients
  63. NAMESPACE Gem
  64. TARGETS
  65. Gem::${gem_name}
  66. )
  67. ly_create_alias(
  68. NAME ${gem_name}.Unified
  69. NAMESPACE Gem
  70. TARGETS
  71. Gem::${gem_name}
  72. )
  73. if (PAL_TRAIT_BUILD_HOST_TOOLS)
  74. include(${pal_dir}/PAL_traits_editor_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
  75. ly_add_target(
  76. NAME ${gem_name}.Editor.Static STATIC
  77. NAMESPACE Gem
  78. FILES_CMAKE
  79. awscore_editor_files.cmake
  80. ${pal_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_editor_files.cmake
  81. INCLUDE_DIRECTORIES
  82. PRIVATE
  83. Source
  84. ${pal_dir}
  85. PUBLIC
  86. Include
  87. BUILD_DEPENDENCIES
  88. PRIVATE
  89. AZ::AzQtComponents
  90. 3rdParty::Qt::Core
  91. 3rdParty::Qt::Widgets
  92. Gem::${gem_name}.Static
  93. PUBLIC
  94. ${additional_tool_deps}
  95. 3rdParty::AWSNativeSDK::AWSCore
  96. )
  97. ly_add_target(
  98. NAME ${gem_name}.Editor GEM_MODULE
  99. NAMESPACE Gem
  100. FILES_CMAKE
  101. awscore_editor_shared_files.cmake
  102. INCLUDE_DIRECTORIES
  103. PRIVATE
  104. Source
  105. BUILD_DEPENDENCIES
  106. PRIVATE
  107. AZ::AzCore
  108. Gem::${gem_name}.Editor.Static
  109. )
  110. # Inject the gem name into the Module source file
  111. ly_add_source_properties(
  112. SOURCES
  113. Source/AWSCoreEditorModule.cpp
  114. PROPERTY COMPILE_DEFINITIONS
  115. VALUES
  116. O3DE_GEM_NAME=${gem_name}
  117. O3DE_GEM_VERSION=${gem_version})
  118. if (PAL_TRAIT_ENABLE_RESOURCE_MAPPING_TOOL)
  119. # This target is not a real gem module
  120. # It is not meant to be loaded by the ModuleManager in C++
  121. ly_add_target(
  122. NAME ${gem_name}.ResourceMappingTool MODULE
  123. NAMESPACE Gem
  124. OUTPUT_SUBDIRECTORY AWSCoreEditorQtBin
  125. FILES_CMAKE
  126. awscore_resourcemappingtool_files.cmake
  127. INCLUDE_DIRECTORIES
  128. PRIVATE
  129. Source
  130. BUILD_DEPENDENCIES
  131. PRIVATE
  132. Gem::${gem_name}.Editor.Static
  133. RUNTIME_DEPENDENCIES
  134. 3rdParty::pyside2
  135. )
  136. ly_add_dependencies(${gem_name}.Editor ${gem_name}.ResourceMappingTool)
  137. ly_install_directory(DIRECTORIES Tools/ResourceMappingTool)
  138. endif()
  139. # Builders and Tools (such as the Editor use ${gem_name}.Editor) use the .Editor module above.
  140. ly_create_alias(
  141. NAME ${gem_name}.Tools
  142. NAMESPACE Gem
  143. TARGETS
  144. Gem::${gem_name}
  145. Gem::${gem_name}.Editor
  146. )
  147. ly_create_alias(
  148. NAME ${gem_name}.Builders
  149. NAMESPACE Gem
  150. TARGETS
  151. Gem::${gem_name}
  152. Gem::${gem_name}.Editor
  153. )
  154. endif()
  155. ################################################################################
  156. # Tests
  157. ################################################################################
  158. if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  159. ly_add_target(
  160. NAME ${gem_name}.Tests MODULE
  161. NAMESPACE Gem
  162. FILES_CMAKE
  163. awscore_tests_files.cmake
  164. INCLUDE_DIRECTORIES
  165. PRIVATE
  166. Source
  167. Include
  168. Tests
  169. BUILD_DEPENDENCIES
  170. PRIVATE
  171. AZ::AzTest
  172. AZ::AzFramework
  173. AZ::AWSNativeSDKTestLibs
  174. Gem::${gem_name}.Static
  175. )
  176. ly_add_googletest(
  177. NAME Gem::${gem_name}.Tests
  178. LABELS REQUIRES_tiaf
  179. )
  180. ly_add_target_files(
  181. TARGETS
  182. ${gem_name}.Tests
  183. FILES
  184. ${CMAKE_CURRENT_SOURCE_DIR}/../Assets/resource_mapping_schema.json
  185. OUTPUT_SUBDIRECTORY
  186. Gems/${gem_name}
  187. )
  188. if (PAL_TRAIT_BUILD_HOST_TOOLS)
  189. ly_add_target(
  190. NAME ${gem_name}.Editor.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  191. NAMESPACE Gem
  192. FILES_CMAKE
  193. awscore_editor_tests_files.cmake
  194. ${pal_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_editor_files.cmake
  195. ${pal_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_editor_tests_files.cmake
  196. INCLUDE_DIRECTORIES
  197. PRIVATE
  198. Source
  199. ${pal_dir}
  200. Include
  201. Tests
  202. COMPILE_DEFINITIONS
  203. PRIVATE
  204. AWSCORE_EDITOR
  205. BUILD_DEPENDENCIES
  206. PRIVATE
  207. 3rdParty::Qt::Gui
  208. 3rdParty::Qt::Widgets
  209. AZ::AzTest
  210. AZ::AWSNativeSDKTestLibs
  211. Gem::${gem_name}.Static
  212. Gem::${gem_name}.Editor.Static
  213. )
  214. set(SUPPORTED_PLATFORMS "Windows")
  215. if ("${PAL_PLATFORM_NAME}" IN_LIST SUPPORTED_PLATFORMS)
  216. ly_add_googletest(
  217. NAME Gem::${gem_name}.Editor.Tests
  218. LABELS REQUIRES_tiaf
  219. )
  220. endif()
  221. endif()
  222. endif()
  223. ly_add_target_files(
  224. TARGETS
  225. ${gem_name}
  226. FILES
  227. ${CMAKE_CURRENT_SOURCE_DIR}/../Assets/resource_mapping_schema.json
  228. OUTPUT_SUBDIRECTORY
  229. Gems/${gem_name}
  230. )
  231. ly_install_directory(DIRECTORIES Tools/ResourceMappingTool)