CMakeLists.txt 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. include(${pal_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) #for PAL_TRAIT_NVCLOTH Traits
  10. if(PAL_TRAIT_NVCLOTH_USE_STUB)
  11. include(nvcloth_stub.cmake)
  12. return()
  13. endif()
  14. ly_add_target(
  15. NAME ${gem_name}.Static STATIC
  16. NAMESPACE Gem
  17. FILES_CMAKE
  18. nvcloth_files.cmake
  19. INCLUDE_DIRECTORIES
  20. PRIVATE
  21. Include
  22. Source
  23. BUILD_DEPENDENCIES
  24. PUBLIC
  25. 3rdParty::NvCloth
  26. AZ::AzFramework
  27. Gem::CommonFeaturesAtom.Public
  28. PRIVATE
  29. Gem::EMotionFXStaticLib
  30. )
  31. ly_add_target(
  32. NAME ${gem_name} ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
  33. NAMESPACE Gem
  34. OUTPUT_NAME ${gem_name}.Gem
  35. FILES_CMAKE
  36. nvcloth_shared_files.cmake
  37. INCLUDE_DIRECTORIES
  38. PUBLIC
  39. Include
  40. PRIVATE
  41. Source
  42. BUILD_DEPENDENCIES
  43. PUBLIC
  44. AZ::AzCore
  45. PRIVATE
  46. Gem::${gem_name}.Static
  47. )
  48. # Inject the gem name into the Module source file
  49. ly_add_source_properties(
  50. SOURCES
  51. Source/Module.cpp
  52. PROPERTY COMPILE_DEFINITIONS
  53. VALUES
  54. O3DE_GEM_NAME=${gem_name}
  55. O3DE_GEM_VERSION=${gem_version})
  56. # use the NvCloth module in clients and servers:
  57. ly_create_alias(NAME ${gem_name}.Clients NAMESPACE Gem TARGETS Gem::${gem_name})
  58. ly_create_alias(NAME ${gem_name}.Servers NAMESPACE Gem TARGETS Gem::${gem_name})
  59. ly_create_alias(NAME ${gem_name}.Unified NAMESPACE Gem TARGETS Gem::${gem_name})
  60. # Add each "dependencies" entry from the NvCloth gem.json as a dependency to the
  61. # NvCloth Clients, Servers and Unified targets
  62. o3de_add_variant_dependencies_for_gem_dependencies(GEM_NAME ${gem_name} VARIANTS Clients Servers Unified)
  63. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  64. ly_add_target(
  65. NAME ${gem_name}.Editor.Static STATIC
  66. NAMESPACE Gem
  67. AUTOMOC
  68. FILES_CMAKE
  69. nvcloth_editor_files.cmake
  70. INCLUDE_DIRECTORIES
  71. PRIVATE
  72. .
  73. Include
  74. Source
  75. COMPILE_DEFINITIONS
  76. PRIVATE
  77. NVCLOTH_EDITOR
  78. BUILD_DEPENDENCIES
  79. PUBLIC
  80. Gem::${gem_name}.Static
  81. AZ::AzToolsFramework
  82. AZ::SceneCore
  83. )
  84. ly_add_target(
  85. NAME ${gem_name}.Editor GEM_MODULE
  86. NAMESPACE Gem
  87. OUTPUT_NAME ${gem_name}.Editor.Gem
  88. FILES_CMAKE
  89. nvcloth_editor_shared_files.cmake
  90. INCLUDE_DIRECTORIES
  91. PRIVATE
  92. Include
  93. Source
  94. COMPILE_DEFINITIONS
  95. PRIVATE
  96. NVCLOTH_EDITOR
  97. BUILD_DEPENDENCIES
  98. PRIVATE
  99. Gem::${gem_name}.Editor.Static
  100. )
  101. # use the NvCloth.Editor module in dev tools:
  102. ly_create_alias(NAME ${gem_name}.Builders NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
  103. ly_create_alias(NAME ${gem_name}.Tools NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
  104. # Add each "dependencies" entry from the NvCloth gem.json as a dependency to the NvCloth Tools and Builders targets
  105. o3de_add_variant_dependencies_for_gem_dependencies(GEM_NAME ${gem_name} VARIANTS Tools Builders)
  106. endif()
  107. ################################################################################
  108. # Tests
  109. ################################################################################
  110. if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  111. ly_add_target(
  112. NAME ${gem_name}.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  113. NAMESPACE Gem
  114. OUTPUT_NAME ${gem_name}.Tests.Gem
  115. FILES_CMAKE
  116. nvcloth_tests_files.cmake
  117. INCLUDE_DIRECTORIES
  118. PRIVATE
  119. Include
  120. Tests
  121. Source
  122. BUILD_DEPENDENCIES
  123. PRIVATE
  124. AZ::AzTestShared
  125. AZ::AzTest
  126. Gem::${gem_name}.Static
  127. Gem::EMotionFXStaticLib
  128. Gem::EMotionFX.Tests.Static
  129. RUNTIME_DEPENDENCIES
  130. Gem::EMotionFX
  131. )
  132. ly_add_googletest(
  133. NAME Gem::${gem_name}.Tests
  134. LABELS REQUIRES_tiaf
  135. )
  136. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  137. ly_add_target(
  138. NAME ${gem_name}.Editor.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  139. NAMESPACE Gem
  140. OUTPUT_NAME ${gem_name}.Editor.Tests.Gem
  141. FILES_CMAKE
  142. nvcloth_editor_tests_files.cmake
  143. INCLUDE_DIRECTORIES
  144. PRIVATE
  145. Include
  146. Tests
  147. Source
  148. COMPILE_DEFINITIONS
  149. PRIVATE
  150. NVCLOTH_EDITOR
  151. BUILD_DEPENDENCIES
  152. PRIVATE
  153. AZ::AzTestShared
  154. AZ::AzTest
  155. AZ::AzToolsFrameworkTestCommon
  156. Gem::${gem_name}.Editor.Static
  157. Gem::EMotionFX.Editor.Static
  158. Gem::EMotionFX.Tests.Static
  159. RUNTIME_DEPENDENCIES
  160. Gem::EMotionFX.Editor
  161. )
  162. ly_add_googletest(
  163. NAME Gem::${gem_name}.Editor.Tests
  164. LABELS REQUIRES_tiaf
  165. )
  166. endif()
  167. endif()