CMakeLists.txt 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. # Copyright (c) Contributors to the Open 3D Engine Project.
  2. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  3. #
  4. # SPDX-License-Identifier: Apache-2.0 OR MIT
  5. #
  6. # Currently we are in the Code folder: ${CMAKE_CURRENT_LIST_DIR}
  7. # Get the platform specific folder ${pal_dir} for the current folder: ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}
  8. # Note: o3de_pal_dir will take care of the details for us, as this may be a restricted platform
  9. # in which case it will see if that platform is present here or in the restricted folder.
  10. # i.e. It could here in our gem : Gems/Compression/Code/Platform/<platorm_name> or
  11. # <restricted_folder>/<platform_name>/Gems/Compression/Code
  12. o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_parent_relative_path}")
  13. # Now that we have the platform abstraction layer (PAL) folder for this folder, thats where we will find the
  14. # traits for this platform. Traits for a platform are defines for things like whether or not something in this gem
  15. # is supported by this platform.
  16. include(${pal_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
  17. # The Compression.API target declares the common interface that users of this gem should depend on in their targets
  18. ly_add_target(
  19. NAME Compression.API INTERFACE
  20. NAMESPACE Gem
  21. FILES_CMAKE
  22. compression_api_files.cmake
  23. ${pal_dir}/compression_api_files.cmake
  24. INCLUDE_DIRECTORIES
  25. INTERFACE
  26. Include
  27. BUILD_DEPENDENCIES
  28. INTERFACE
  29. AZ::AzCore
  30. )
  31. # Add the Compression.Private.Object target
  32. # Note: We include the common files and the platform specific files which are set in
  33. # 1.compression_private_files.cmake
  34. # 2.${pal_dir}/compression_private_files.cmake
  35. ly_add_target(
  36. NAME Compression.Private.Object STATIC
  37. NAMESPACE Gem
  38. FILES_CMAKE
  39. compression_private_files.cmake
  40. ${pal_dir}/compression_private_files.cmake
  41. INCLUDE_DIRECTORIES
  42. PRIVATE
  43. Include
  44. Source
  45. BUILD_DEPENDENCIES
  46. PUBLIC
  47. AZ::AzCore
  48. AZ::AzFramework
  49. )
  50. # Here add Compression target, it depends on the Private Object library and Public API interface
  51. ly_add_target(
  52. NAME Compression ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
  53. NAMESPACE Gem
  54. FILES_CMAKE
  55. compression_shared_files.cmake
  56. ${pal_dir}/compression_shared_files.cmake
  57. INCLUDE_DIRECTORIES
  58. PUBLIC
  59. Include
  60. PRIVATE
  61. Source
  62. BUILD_DEPENDENCIES
  63. PUBLIC
  64. Gem::Compression.API
  65. PRIVATE
  66. Gem::Compression.Private.Object
  67. )
  68. # By default, we will specify that the above target Compression would be used by
  69. # Client and Server type targets when this gem is enabled. If you don't want it
  70. # active in Clients or Servers by default, delete one of both of the following lines:
  71. ly_create_alias(NAME Compression.Clients NAMESPACE Gem TARGETS Gem::Compression)
  72. ly_create_alias(NAME Compression.Servers NAMESPACE Gem TARGETS Gem::Compression)
  73. ly_create_alias(NAME Compression.Unified NAMESPACE Gem TARGETS Gem::Compression)
  74. # For the Client and Server variants of Compression Gem, an alias to the Compression.API target will be made
  75. ly_create_alias(NAME Compression.Clients.API NAMESPACE Gem TARGETS Gem::Compression.API)
  76. ly_create_alias(NAME Compression.Servers.API NAMESPACE Gem TARGETS Gem::Compression.API)
  77. ly_create_alias(NAME Compression.Unified.API NAMESPACE Gem TARGETS Gem::Compression.API)
  78. # If we are on a host platform, we want to add the host tools targets like the Compression.Editor MODULE target
  79. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  80. # The Compression.Editor.API target can be used by other gems that want to interact with the Compression.Editor module
  81. ly_add_target(
  82. NAME Compression.Editor.API INTERFACE
  83. NAMESPACE Gem
  84. FILES_CMAKE
  85. compression_editor_api_files.cmake
  86. ${pal_dir}/compression_editor_api_files.cmake
  87. INCLUDE_DIRECTORIES
  88. INTERFACE
  89. Include
  90. BUILD_DEPENDENCIES
  91. INTERFACE
  92. AZ::AzToolsFramework
  93. )
  94. # The Compression.Editor.Private.Object target is an internal target
  95. # which is only to be used by this Gem's CMakeLists.txt and any Subdirectories
  96. # Other Gems should not use this target
  97. ly_add_target(
  98. NAME Compression.Editor.Private.Object STATIC
  99. NAMESPACE Gem
  100. FILES_CMAKE
  101. compression_editor_private_files.cmake
  102. INCLUDE_DIRECTORIES
  103. PRIVATE
  104. Include
  105. Source
  106. BUILD_DEPENDENCIES
  107. PUBLIC
  108. AZ::AzToolsFramework
  109. $<TARGET_OBJECTS:Gem::Compression.Private.Object>
  110. )
  111. ly_add_target(
  112. NAME Compression.Editor GEM_MODULE
  113. NAMESPACE Gem
  114. AUTOMOC
  115. FILES_CMAKE
  116. compression_editor_shared_files.cmake
  117. INCLUDE_DIRECTORIES
  118. PRIVATE
  119. Source
  120. PUBLIC
  121. Include
  122. BUILD_DEPENDENCIES
  123. PUBLIC
  124. Gem::Compression.Editor.API
  125. PRIVATE
  126. Gem::Compression.Editor.Private.Object
  127. )
  128. # By default, we will specify that the above target Compression would be used by
  129. # Tool and Builder type targets when this gem is enabled. If you don't want it
  130. # active in Tools or Builders by default, delete one of both of the following lines:
  131. ly_create_alias(NAME Compression.Tools NAMESPACE Gem TARGETS Gem::Compression.Editor)
  132. ly_create_alias(NAME Compression.Builders NAMESPACE Gem TARGETS Gem::Compression.Editor)
  133. # For the Tools and Builders variants of Compression Gem, an alias to the Compression.Editor API target will be made
  134. ly_create_alias(NAME Compression.Tools.API NAMESPACE Gem TARGETS Gem::Compression.Editor.API)
  135. ly_create_alias(NAME Compression.Builders.API NAMESPACE Gem TARGETS Gem::Compression.Editor.API)
  136. endif()
  137. ################################################################################
  138. # Tests
  139. ################################################################################
  140. # See if globally, tests are supported
  141. if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  142. # We globally support tests, see if we support tests on this platform for Compression.Tests
  143. if(PAL_TRAIT_COMPRESSION_TEST_SUPPORTED)
  144. # We support Compression.Tests on this platform, add dependency on the Private Object target
  145. ly_add_target(
  146. NAME Compression.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  147. NAMESPACE Gem
  148. FILES_CMAKE
  149. compression_tests_files.cmake
  150. INCLUDE_DIRECTORIES
  151. PRIVATE
  152. Tests
  153. Source
  154. Include
  155. BUILD_DEPENDENCIES
  156. PRIVATE
  157. AZ::AzTest
  158. AZ::AzFramework
  159. Gem::Compression.Private.Object
  160. )
  161. ly_add_googletest(
  162. NAME Gem::Compression.Tests
  163. )
  164. endif()
  165. # If we are a host platform we want to add tools test like editor tests here
  166. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  167. # We are a host platform, see if Editor tests are supported on this platform
  168. if(PAL_TRAIT_COMPRESSION_EDITOR_TEST_SUPPORTED)
  169. # We support Compression.Editor.Tests on this platform, add Compression.Editor.Tests target which depends on
  170. # private Compression.Editor.Private.Object target
  171. ly_add_target(
  172. NAME Compression.Editor.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  173. NAMESPACE Gem
  174. FILES_CMAKE
  175. compression_editor_tests_files.cmake
  176. INCLUDE_DIRECTORIES
  177. PRIVATE
  178. Tests
  179. Source
  180. Include
  181. BUILD_DEPENDENCIES
  182. PRIVATE
  183. AZ::AzTest
  184. Gem::Compression.Editor.Private.Object
  185. )
  186. ly_add_googletest(
  187. NAME Gem::Compression.Editor.Tests
  188. )
  189. endif()
  190. endif()
  191. endif()