CMakeLists.txt 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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. set(common_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/Common)
  10. include(${pal_source_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
  11. if(NOT PAL_TRAIT_WHITEBOX_SUPPORTED)
  12. ly_add_target(
  13. NAME ${gem_name} ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
  14. NAMESPACE Gem
  15. FILES_CMAKE
  16. whitebox_unsupported_files.cmake
  17. INCLUDE_DIRECTORIES
  18. PRIVATE
  19. Source
  20. PUBLIC
  21. Include
  22. BUILD_DEPENDENCIES
  23. PRIVATE
  24. AZ::AzCore
  25. )
  26. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  27. ly_add_target(
  28. NAME ${gem_name}.Editor GEM_MODULE
  29. NAMESPACE Gem
  30. FILES_CMAKE
  31. whitebox_unsupported_files.cmake
  32. INCLUDE_DIRECTORIES
  33. PRIVATE
  34. Source
  35. PUBLIC
  36. Include
  37. COMPILE_DEFINITIONS
  38. PRIVATE
  39. WHITE_BOX_EDITOR
  40. BUILD_DEPENDENCIES
  41. PRIVATE
  42. AZ::AzCore
  43. RUNTIME_DEPENDENCIES
  44. Gem::EditorPythonBindings.Editor
  45. )
  46. endif()
  47. # Inject the gem name into the Unsupported Module source file
  48. ly_add_source_properties(
  49. SOURCES
  50. Source/WhiteBoxModuleUnsupported.cpp
  51. PROPERTY COMPILE_DEFINITIONS
  52. VALUES
  53. O3DE_GEM_NAME=${gem_name}
  54. O3DE_GEM_VERSION=${gem_version})
  55. return()
  56. endif()
  57. ly_add_target(
  58. NAME ${gem_name}.Static STATIC
  59. NAMESPACE Gem
  60. FILES_CMAKE
  61. whitebox_supported_files.cmake
  62. INCLUDE_DIRECTORIES
  63. PRIVATE
  64. Source
  65. PUBLIC
  66. Include
  67. BUILD_DEPENDENCIES
  68. PUBLIC
  69. AZ::AzCore
  70. Gem::Atom_RPI.Public
  71. Gem::Atom_Feature_Common.Public
  72. Gem::CommonFeaturesAtom.Static
  73. Legacy::CryCommon
  74. )
  75. ly_add_target(
  76. NAME ${gem_name} ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
  77. NAMESPACE Gem
  78. FILES_CMAKE
  79. whitebox_shared_files.cmake
  80. INCLUDE_DIRECTORIES
  81. PRIVATE
  82. Source
  83. PUBLIC
  84. Include
  85. BUILD_DEPENDENCIES
  86. PRIVATE
  87. Gem::${gem_name}.Static
  88. )
  89. # Inject the gem name into the Module source file
  90. ly_add_source_properties(
  91. SOURCES
  92. Source/WhiteBoxModule.cpp
  93. PROPERTY COMPILE_DEFINITIONS
  94. VALUES
  95. O3DE_GEM_NAME=${gem_name}
  96. O3DE_GEM_VERSION=${gem_version})
  97. # use the above ${gem_name} module in runtimes:
  98. ly_create_alias(NAME ${gem_name}.Clients NAMESPACE Gem TARGETS Gem::${gem_name})
  99. ly_create_alias(NAME ${gem_name}.Servers NAMESPACE Gem TARGETS Gem::${gem_name})
  100. ly_create_alias(NAME ${gem_name}.Unified NAMESPACE Gem TARGETS Gem::${gem_name})
  101. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  102. ly_add_target(
  103. NAME ${gem_name}.Editor.Static STATIC
  104. NAMESPACE Gem
  105. FILES_CMAKE
  106. whitebox_editor_supported_files.cmake
  107. PLATFORM_INCLUDE_FILES
  108. ${pal_source_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_tools.cmake
  109. ${CMAKE_CURRENT_LIST_DIR}/Source/Platform/Common/${PAL_TRAIT_COMPILER_ID}/whitebox_editor_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake
  110. INCLUDE_DIRECTORIES
  111. PRIVATE
  112. Source
  113. PUBLIC
  114. Include
  115. COMPILE_DEFINITIONS
  116. PRIVATE
  117. _USE_MATH_DEFINES
  118. OM_STATIC_BUILD
  119. PUBLIC
  120. WHITE_BOX_EDITOR
  121. BUILD_DEPENDENCIES
  122. PUBLIC
  123. AZ::AzToolsFramework
  124. Legacy::CryCommon
  125. Legacy::EditorCommon
  126. Legacy::Editor.Headers
  127. Gem::${gem_name}.Static
  128. )
  129. ly_add_target(
  130. NAME ${gem_name}.Editor GEM_MODULE
  131. NAMESPACE Gem
  132. FILES_CMAKE
  133. whitebox_editor_shared_files.cmake
  134. INCLUDE_DIRECTORIES
  135. PRIVATE
  136. Source
  137. PUBLIC
  138. Include
  139. BUILD_DEPENDENCIES
  140. PRIVATE
  141. Gem::${gem_name}.Editor.Static
  142. )
  143. # Inject the gem name into the Module source file
  144. ly_add_source_properties(
  145. SOURCES
  146. Source/${gem_name}EditorModule.cpp
  147. PROPERTY COMPILE_DEFINITIONS
  148. VALUES
  149. O3DE_GEM_NAME=${gem_name}
  150. O3DE_GEM_VERSION=${gem_version})
  151. # use the above ${gem_name}.Editor module in dev tools:
  152. ly_create_alias(NAME ${gem_name}.Tools NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
  153. ly_create_alias(NAME ${gem_name}.Builders NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
  154. endif()
  155. ################################################################################
  156. # Tests
  157. ################################################################################
  158. if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  159. ly_add_target(
  160. NAME ${gem_name}.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  161. NAMESPACE Gem
  162. FILES_CMAKE
  163. whitebox_tests_supported_files.cmake
  164. INCLUDE_DIRECTORIES
  165. PRIVATE
  166. Source
  167. Tests
  168. BUILD_DEPENDENCIES
  169. PRIVATE
  170. AZ::AzTestShared
  171. AZ::AzTest
  172. Gem::${gem_name}.Static
  173. )
  174. ly_add_googletest(
  175. NAME Gem::${gem_name}.Tests
  176. LABELS REQUIRES_tiaf
  177. )
  178. if (PAL_TRAIT_BUILD_HOST_TOOLS)
  179. ly_add_target(
  180. NAME ${gem_name}.Editor.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  181. NAMESPACE Gem
  182. FILES_CMAKE
  183. whitebox_editor_tests_supported_files.cmake
  184. INCLUDE_DIRECTORIES
  185. PRIVATE
  186. Source
  187. Tests
  188. BUILD_DEPENDENCIES
  189. PRIVATE
  190. AZ::AzTestShared
  191. AZ::AzManipulatorTestFramework.Static
  192. Gem::${gem_name}.Editor.Static
  193. )
  194. ly_add_googletest(
  195. NAME Gem::${gem_name}.Editor.Tests
  196. )
  197. ly_add_target(
  198. NAME ${gem_name}.Editor.Physics.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  199. NAMESPACE Gem
  200. FILES_CMAKE
  201. whitebox_editor_physics_tests_supported_files.cmake
  202. INCLUDE_DIRECTORIES
  203. PRIVATE
  204. Source
  205. Tests
  206. BUILD_DEPENDENCIES
  207. PRIVATE
  208. AZ::AzTestShared
  209. AZ::AzManipulatorTestFramework.Static
  210. Gem::${gem_name}.Editor.Static
  211. RUNTIME_DEPENDENCIES
  212. Gem::PhysX.Editor
  213. )
  214. ly_add_googletest(
  215. NAME Gem::${gem_name}.Editor.Physics.Tests
  216. LABELS REQUIRES_tiaf
  217. )
  218. endif()
  219. endif()