CMakeLists.txt 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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. # Currently we are in the Code folder: ${CMAKE_CURRENT_LIST_DIR}
  9. # Get the platform specific folder ${pal_dir} for the current folder: ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}
  10. # Note: o3de_pal_dir will take care of the details for us, as this may be a restricted platform
  11. # in which case it will see if that platform is present here or in the restricted folder.
  12. # i.e. It could here in our gem : Gems/Meshlets/Code/Platform/<platorm_name> or
  13. # <restricted_folder>/<platform_name>/Gems/Meshlets/Code
  14. #o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_name}")
  15. # Now that we have the platform abstraction layer (PAL) folder for this folder, thats where we will find the
  16. # traits for this platform. Traits for a platform are defines for things like whether or not something in this gem
  17. # is supported by this platform.
  18. #include(${pal_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
  19. # Add the Meshlets.Static target
  20. # Note: We include the common files and the platform specific files which are set in meshlets_common_files.cmake
  21. # and in ${pal_dir}/meshlets_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
  22. ly_add_target(
  23. NAME ${gem_name}.Static STATIC
  24. NAMESPACE Gem
  25. FILES_CMAKE
  26. meshlets_files.cmake
  27. # ${pal_dir}/meshlets_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
  28. INCLUDE_DIRECTORIES
  29. PUBLIC
  30. Include
  31. External/Include
  32. Source
  33. Source/${gem_name}
  34. PRIVATE
  35. External/Include
  36. Source
  37. Source/${gem_name}
  38. BUILD_DEPENDENCIES
  39. PUBLIC
  40. AZ::AzCore
  41. AZ::AzFramework
  42. Gem::CommonFeaturesAtom.Static
  43. Gem::Atom_RPI.Public
  44. )
  45. # Here add ${gem_name} target, it depends on the ${gem_name}.Static
  46. ly_add_target(
  47. NAME ${gem_name} ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
  48. NAMESPACE Gem
  49. FILES_CMAKE
  50. meshlets_shared_files.cmake
  51. # ${pal_dir}/meshlets_shared_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
  52. INCLUDE_DIRECTORIES
  53. PUBLIC
  54. Include
  55. Source
  56. Source/${gem_name}
  57. PRIVATE
  58. Source
  59. Source/${gem_name}
  60. BUILD_DEPENDENCIES
  61. PRIVATE
  62. Gem::${gem_name}.Static
  63. )
  64. # Inject the gem name into the Module source file
  65. ly_add_source_properties(
  66. SOURCES
  67. Source/MeshletsModule.cpp
  68. PROPERTY COMPILE_DEFINITIONS
  69. VALUES
  70. O3DE_GEM_NAME=${gem_name}
  71. O3DE_GEM_VERSION=${gem_version})
  72. # By default, we will specify that the above target ${gem_name} would be used by
  73. # Client and Server type targets when this gem is enabled. If you don't want it
  74. # active in Clients or Servers by default, delete one of both of the following lines:
  75. ly_create_alias(NAME ${gem_name}.Clients NAMESPACE Gem TARGETS Gem::${gem_name})
  76. ly_create_alias(NAME ${gem_name}.Servers NAMESPACE Gem TARGETS Gem::${gem_name})
  77. ly_create_alias(NAME ${gem_name}.Unified NAMESPACE Gem TARGETS Gem::${gem_name})
  78. # If we are on a host platform, we want to add the host tools targets like the ${gem_name}.Editor target which
  79. # will also depend on ${gem_name}.Static
  80. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  81. ly_add_target(
  82. NAME ${gem_name}.Editor.Static STATIC
  83. NAMESPACE Gem
  84. FILES_CMAKE
  85. meshlets_editor_files.cmake
  86. INCLUDE_DIRECTORIES
  87. PRIVATE
  88. External/Include
  89. Source
  90. Source/${gem_name}
  91. PUBLIC
  92. Include
  93. BUILD_DEPENDENCIES
  94. PUBLIC
  95. AZ::AzToolsFramework
  96. Gem::${gem_name}.Static
  97. )
  98. ly_add_target(
  99. NAME ${gem_name}.Editor GEM_MODULE
  100. NAMESPACE Gem
  101. AUTOMOC
  102. FILES_CMAKE
  103. meshlets_editor_shared_files.cmake
  104. INCLUDE_DIRECTORIES
  105. PRIVATE
  106. Source
  107. Source/${gem_name}
  108. PUBLIC
  109. Include
  110. BUILD_DEPENDENCIES
  111. PUBLIC
  112. Gem::${gem_name}.Editor.Static
  113. )
  114. # Inject the gem name into the Module source file
  115. ly_add_source_properties(
  116. SOURCES
  117. Source/MeshletsEditorModule.cpp
  118. PROPERTY COMPILE_DEFINITIONS
  119. VALUES
  120. O3DE_GEM_NAME=${gem_name}
  121. O3DE_GEM_VERSION=${gem_version})
  122. # By default, we will specify that the above target ${gem_name} would be used by
  123. # Tool and Builder type targets when this gem is enabled. If you don't want it
  124. # active in Tools or Builders by default, delete one of both of the following lines:
  125. ly_create_alias(NAME ${gem_name}.Tools NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
  126. ly_create_alias(NAME ${gem_name}.Builders NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
  127. endif()
  128. ################################################################################
  129. # Tests
  130. ################################################################################
  131. # See if globally, tests are supported
  132. if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  133. # We globally support tests, see if we support tests on this platform for ${gem_name}.Static
  134. if(PAL_TRAIT_MESHLETS_TEST_SUPPORTED)
  135. # We support ${gem_name}.Tests on this platform, add ${gem_name}.Tests target which depends on ${gem_name}.Static
  136. ly_add_target(
  137. NAME ${gem_name}.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  138. NAMESPACE Gem
  139. FILES_CMAKE
  140. meshlets_files.cmake
  141. meshlets_tests_files.cmake
  142. INCLUDE_DIRECTORIES
  143. PRIVATE
  144. Tests
  145. Source
  146. BUILD_DEPENDENCIES
  147. PRIVATE
  148. AZ::AzTest
  149. AZ::AzFramework
  150. Gem::${gem_name}.Static
  151. )
  152. # Add ${gem_name}.Tests to googletest
  153. ly_add_googletest(
  154. NAME Gem::${gem_name}.Tests
  155. )
  156. endif()
  157. # If we are a host platform we want to add tools test like editor tests here
  158. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  159. # We are a host platform, see if Editor tests are supported on this platform
  160. if(PAL_TRAIT_MESHLETS_EDITOR_TEST_SUPPORTED)
  161. # We support ${gem_name}.Editor.Tests on this platform, add ${gem_name}.Editor.Tests target which depends on ${gem_name}.Editor
  162. ly_add_target(
  163. NAME ${gem_name}.Editor.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  164. NAMESPACE Gem
  165. FILES_CMAKE
  166. meshlets_editor_tests_files.cmake
  167. INCLUDE_DIRECTORIES
  168. PRIVATE
  169. Tests
  170. Source
  171. BUILD_DEPENDENCIES
  172. PRIVATE
  173. AZ::AzTest
  174. Gem::${gem_name}.Editor
  175. )
  176. # Add ${gem_name}.Editor.Tests to googletest
  177. ly_add_googletest(
  178. NAME Gem::${gem_name}.Editor.Tests
  179. )
  180. endif()
  181. endif()
  182. endif()