CMakeLists.txt 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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_source_dir ${CMAKE_CURRENT_LIST_DIR}/Source/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_parent_relative_path}")
  9. #for PAL_TRAIT_BUILD_ATOM_RPI_ASSETS_SUPPORTED and PAL_TRAIT_BUILD_ATOM_RPI_MASKED_OCCLUSION_CULLING_SUPPORTED
  10. include(${pal_source_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
  11. if(PAL_TRAIT_BUILD_ATOM_RPI_MASKED_OCCLUSION_CULLING_SUPPORTED)
  12. set(MASKED_OCCLUSION_CULLING_FILES "atom_rpi_masked_occlusion_files.cmake")
  13. else()
  14. set(MASKED_OCCLUSION_CULLING_FILES "")
  15. endif()
  16. ly_add_target(
  17. NAME ${gem_name}.Public STATIC
  18. NAMESPACE Gem
  19. FILES_CMAKE
  20. atom_rpi_reflect_files.cmake
  21. atom_rpi_public_files.cmake
  22. ../Assets/atom_rpi_asset_files.cmake
  23. ${pal_source_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
  24. ${MASKED_OCCLUSION_CULLING_FILES}
  25. PLATFORM_INCLUDE_FILES
  26. ${CMAKE_CURRENT_LIST_DIR}/Source/Platform/Common/${PAL_TRAIT_COMPILER_ID}/atom_rpi_public_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake
  27. INCLUDE_DIRECTORIES
  28. PRIVATE
  29. Source
  30. ${pal_source_dir}
  31. PUBLIC
  32. Include
  33. External
  34. BUILD_DEPENDENCIES
  35. PRIVATE
  36. AZ::AzCore
  37. AZ::AzFramework
  38. PUBLIC
  39. AZ::AtomCore
  40. Gem::Atom_RHI.Public
  41. )
  42. ################################################################################
  43. # Private
  44. ################################################################################
  45. ly_add_target(
  46. NAME ${gem_name}.Private ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
  47. NAMESPACE Gem
  48. FILES_CMAKE
  49. atom_rpi_private_files.cmake
  50. INCLUDE_DIRECTORIES
  51. PRIVATE
  52. Source
  53. PUBLIC
  54. Include
  55. BUILD_DEPENDENCIES
  56. PRIVATE
  57. AZ::AtomCore
  58. AZ::AzCore
  59. AZ::AzFramework
  60. Gem::${gem_name}.Public
  61. Gem::Atom_RHI.Public
  62. Gem::Atom_RHI.Reflect
  63. RUNTIME_DEPENDENCIES
  64. Gem::Atom_RHI.Private
  65. )
  66. # Inject the gem name into the Module source file
  67. ly_add_source_properties(
  68. SOURCES
  69. Source/RPI.Private/Module.cpp
  70. PROPERTY COMPILE_DEFINITIONS
  71. VALUES
  72. O3DE_GEM_NAME=${gem_name}
  73. O3DE_GEM_VERSION=${gem_version})
  74. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  75. ly_add_target(
  76. NAME ${gem_name}.Edit STATIC
  77. NAMESPACE Gem
  78. FILES_CMAKE
  79. atom_rpi_edit_files.cmake
  80. INCLUDE_DIRECTORIES
  81. PRIVATE
  82. Source
  83. PUBLIC
  84. Include
  85. BUILD_DEPENDENCIES
  86. PRIVATE
  87. AZ::AtomCore
  88. AZ::AzToolsFramework
  89. Gem::Atom_RHI.Edit
  90. Gem::${gem_name}.Public
  91. )
  92. ly_add_target(
  93. NAME ${gem_name}.Editor.Private.Object OBJECT
  94. NAMESPACE Gem
  95. FILES_CMAKE
  96. atom_rpi_private_files.cmake
  97. INCLUDE_DIRECTORIES
  98. PRIVATE
  99. Source
  100. PUBLIC
  101. Include
  102. COMPILE_DEFINITIONS
  103. PUBLIC
  104. RPI_EDITOR # Compile RPI Editor module
  105. BUILD_DEPENDENCIES
  106. PUBLIC
  107. AZ::AtomCore
  108. AZ::AzCore
  109. AZ::AzFramework
  110. Gem::Atom_RHI.Public
  111. Gem::${gem_name}.Public
  112. )
  113. ly_add_target(
  114. NAME ${gem_name}.Editor GEM_MODULE
  115. NAMESPACE Gem
  116. FILES_CMAKE
  117. atom_rpi_editor_files.cmake
  118. INCLUDE_DIRECTORIES
  119. PRIVATE
  120. Source
  121. PUBLIC
  122. Include
  123. BUILD_DEPENDENCIES
  124. PRIVATE
  125. AZ::AzToolsFramework
  126. Gem::${gem_name}.Edit
  127. Gem::${gem_name}.Editor.Private.Object
  128. RUNTIME_DEPENDENCIES
  129. Gem::Atom_RHI.Private
  130. )
  131. # Inject the gem name into the Module source file
  132. ly_add_source_properties(
  133. SOURCES
  134. Source/RPI.Editor/EditorModule.cpp
  135. PROPERTY COMPILE_DEFINITIONS
  136. VALUES
  137. O3DE_GEM_NAME=${gem_name}
  138. O3DE_GEM_VERSION=${gem_version})
  139. endif()
  140. ################################################################################
  141. # Tests
  142. ################################################################################
  143. if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  144. ly_add_target(
  145. NAME ${gem_name}.TestUtils STATIC
  146. NAMESPACE Gem
  147. FILES_CMAKE
  148. atom_rpi_test_utils_files.cmake
  149. INCLUDE_DIRECTORIES
  150. PUBLIC
  151. Tests
  152. BUILD_DEPENDENCIES
  153. PRIVATE
  154. AZ::AtomCore
  155. AZ::AzTest
  156. AZ::AzTestShared
  157. AZ::AzFramework
  158. Gem::${gem_name}.Public
  159. Gem::Atom_RHI.Public
  160. )
  161. endif()
  162. if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
  163. ly_add_target(
  164. NAME ${gem_name}.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  165. NAMESPACE Gem
  166. FILES_CMAKE
  167. atom_rpi_tests_files.cmake
  168. INCLUDE_DIRECTORIES
  169. PRIVATE
  170. .
  171. Tests
  172. BUILD_DEPENDENCIES
  173. PRIVATE
  174. AZ::AtomCore
  175. AZ::AzTest
  176. AZ::AzTestShared
  177. AZ::AzFramework
  178. AZ::AzToolsFramework
  179. Legacy::CryCommon
  180. Gem::Atom_RHI.Public
  181. Gem::Atom_Utils.TestUtils.Static
  182. Gem::${gem_name}.Edit
  183. Gem::${gem_name}.Public
  184. Gem::${gem_name}.TestUtils
  185. )
  186. ly_add_googletest(
  187. NAME Gem::${gem_name}.Tests
  188. LABELS REQUIRES_tiaf
  189. )
  190. endif()
  191. ################################################################################
  192. # Builders
  193. ################################################################################
  194. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  195. o3de_pal_dir(pal_source_dir ${CMAKE_CURRENT_LIST_DIR}/Source/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_parent_relative_path}")
  196. set(common_source_dir ${CMAKE_CURRENT_LIST_DIR}/Source/Platform/Common)
  197. if(NOT PAL_TRAIT_BUILD_ATOM_RPI_ASSETS_SUPPORTED)
  198. # Create a stub
  199. ly_add_target(
  200. NAME ${gem_name}.Builders GEM_MODULE
  201. NAMESPACE Gem
  202. FILES_CMAKE
  203. atom_rpi_builders_stub_files.cmake
  204. INCLUDE_DIRECTORIES
  205. PRIVATE
  206. Source
  207. PUBLIC
  208. Include
  209. BUILD_DEPENDENCIES
  210. PRIVATE
  211. AZ::AzCore
  212. )
  213. # Inject the gem name into the Module source file
  214. ly_add_source_properties(
  215. SOURCES
  216. Source/Platform/Common/Unimplemented/BuilderModule_Stub.cpp
  217. PROPERTY COMPILE_DEFINITIONS
  218. VALUES
  219. O3DE_GEM_NAME=${gem_name}
  220. O3DE_GEM_VERSION=${gem_version})
  221. return()
  222. endif()
  223. ly_add_target(
  224. NAME ${gem_name}.Builders.Private.Object OBJECT
  225. NAMESPACE Gem
  226. FILES_CMAKE
  227. atom_rpi_builders_files.cmake
  228. INCLUDE_DIRECTORIES
  229. PRIVATE
  230. Source
  231. Source/RPI.Builders
  232. PUBLIC
  233. Include
  234. BUILD_DEPENDENCIES
  235. PUBLIC
  236. AZ::AtomCore
  237. AZ::AzCore
  238. AZ::AzFramework
  239. AZ::SceneCore
  240. AZ::SceneData
  241. AZ::AssetBuilderSDK
  242. Gem::Atom_RHI.Public
  243. Gem::${gem_name}.Edit
  244. Gem::${gem_name}.Public
  245. )
  246. ly_add_target(
  247. NAME ${gem_name}.Builders GEM_MODULE
  248. NAMESPACE Gem
  249. FILES_CMAKE
  250. atom_rpi_builders_shared_files.cmake
  251. INCLUDE_DIRECTORIES
  252. PRIVATE
  253. Source
  254. Source/RPI.Builders
  255. PUBLIC
  256. Include
  257. BUILD_DEPENDENCIES
  258. PRIVATE
  259. Gem::${gem_name}.Builders.Private.Object
  260. )
  261. # Inject the gem name into the Module source file
  262. ly_add_source_properties(
  263. SOURCES
  264. Source/RPI.Builders/BuilderModule.cpp
  265. PROPERTY COMPILE_DEFINITIONS
  266. VALUES
  267. O3DE_GEM_NAME=${gem_name}
  268. O3DE_GEM_VERSION=${gem_version})
  269. if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  270. ly_add_target(
  271. NAME ${gem_name}.Builders.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  272. NAMESPACE Gem
  273. FILES_CMAKE
  274. atom_rpi_builders_tests_files.cmake
  275. INCLUDE_DIRECTORIES
  276. PRIVATE
  277. .
  278. Tests
  279. Source/RPI.Builders
  280. BUILD_DEPENDENCIES
  281. PRIVATE
  282. AZ::AzTest
  283. AZ::AzFramework
  284. Gem::${gem_name}.Builders.Private.Object
  285. )
  286. ly_add_googletest(
  287. NAME Gem::${gem_name}.Builders.Tests
  288. LABELS REQUIRES_tiaf
  289. )
  290. endif()
  291. endif()