CMakeLists.txt 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. #
  2. # Copyright (c) Contributors to the Open 3D Engine Project. 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. #
  7. ly_add_target(
  8. NAME ${gem_name}.Static STATIC
  9. NAMESPACE Gem
  10. FILES_CMAKE
  11. terrain_files.cmake
  12. INCLUDE_DIRECTORIES
  13. PUBLIC
  14. Include
  15. PRIVATE
  16. Source
  17. BUILD_DEPENDENCIES
  18. PUBLIC
  19. AZ::AzCore
  20. AZ::AzFramework
  21. Gem::Atom_RPI.Public
  22. Gem::Atom_Utils.Static
  23. Gem::Atom_Feature_Common.Public
  24. Gem::CommonFeaturesAtom.Static
  25. Gem::GradientSignal.Static
  26. Gem::SurfaceData.Static
  27. Gem::LmbrCentral.API
  28. )
  29. ly_add_target(
  30. NAME ${gem_name} ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
  31. NAMESPACE Gem
  32. FILES_CMAKE
  33. terrain_shared_files.cmake
  34. INCLUDE_DIRECTORIES
  35. PUBLIC
  36. Include
  37. PRIVATE
  38. Source
  39. BUILD_DEPENDENCIES
  40. PRIVATE
  41. Gem::${gem_name}.Static
  42. Gem::LmbrCentral.API
  43. RUNTIME_DEPENDENCIES
  44. Gem::LmbrCentral
  45. )
  46. # Inject the gem name into the Module source file
  47. ly_add_source_properties(
  48. SOURCES
  49. Source/TerrainModule.cpp
  50. PROPERTY COMPILE_DEFINITIONS
  51. VALUES
  52. O3DE_GEM_NAME=${gem_name}
  53. O3DE_GEM_VERSION=${gem_version})
  54. # the above module is for use in all client/server types
  55. ly_create_alias(NAME ${gem_name}.Servers NAMESPACE Gem TARGETS Gem::${gem_name} Gem::SurfaceData.Servers Gem::GradientSignal.Servers)
  56. ly_create_alias(NAME ${gem_name}.Clients NAMESPACE Gem TARGETS Gem::${gem_name} Gem::SurfaceData.Clients Gem::GradientSignal.Clients)
  57. ly_create_alias(NAME ${gem_name}.Unified NAMESPACE Gem TARGETS Gem::${gem_name} Gem::SurfaceData.Unified Gem::GradientSignal.Unified)
  58. # If we are on a host platform, we want to add the host tools targets like the ${gem_name}.Editor target which
  59. # will also depend on ${gem_name}.Static
  60. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  61. ly_add_target(
  62. NAME ${gem_name}.Editor GEM_MODULE
  63. NAMESPACE Gem
  64. AUTOMOC
  65. FILES_CMAKE
  66. terrain_editor_shared_files.cmake
  67. COMPILE_DEFINITIONS
  68. PRIVATE
  69. TERRAIN_EDITOR
  70. INCLUDE_DIRECTORIES
  71. PRIVATE
  72. Source
  73. PUBLIC
  74. Include
  75. BUILD_DEPENDENCIES
  76. PRIVATE
  77. Gem::Atom_RPI.Edit
  78. Gem::GradientSignal.Editor.Static
  79. PUBLIC
  80. AZ::AzToolsFramework
  81. Gem::GradientSignal.Static
  82. Gem::LmbrCentral.API
  83. Gem::${gem_name}.Static
  84. )
  85. # Inject the gem name into the Module source file
  86. ly_add_source_properties(
  87. SOURCES
  88. Source/EditorTerrainModule.cpp
  89. PROPERTY COMPILE_DEFINITIONS
  90. VALUES
  91. O3DE_GEM_NAME=${gem_name}
  92. O3DE_GEM_VERSION=${gem_version})
  93. # the above module is for use in dev tool situations
  94. ly_create_alias(NAME ${gem_name}.Builders NAMESPACE Gem TARGETS Gem::${gem_name}.Editor Gem::SurfaceData.Builders Gem::GradientSignal.Builders)
  95. ly_create_alias(NAME ${gem_name}.Tools NAMESPACE Gem TARGETS Gem::${gem_name}.Editor Gem::SurfaceData.Tools Gem::GradientSignal.Tools)
  96. endif()
  97. ################################################################################
  98. # Tests
  99. ################################################################################
  100. # See if globally, tests are supported
  101. if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  102. ly_add_target(
  103. NAME ${gem_name}.Mocks HEADERONLY
  104. NAMESPACE Gem
  105. FILES_CMAKE
  106. terrain_mocks_files.cmake
  107. INCLUDE_DIRECTORIES
  108. INTERFACE
  109. Mocks
  110. )
  111. ly_add_target(
  112. NAME ${gem_name}.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  113. NAMESPACE Gem
  114. FILES_CMAKE
  115. terrain_tests_files.cmake
  116. INCLUDE_DIRECTORIES
  117. PRIVATE
  118. Tests
  119. Source
  120. BUILD_DEPENDENCIES
  121. PRIVATE
  122. AZ::AzTest
  123. AZ::AzFrameworkTestShared
  124. AZ::AzTestShared
  125. AZ::AzFramework
  126. Gem::Atom_RPI.TestUtils
  127. Gem::GradientSignal.Tests.Static
  128. Gem::LmbrCentral.Mocks
  129. Gem::GradientSignal.Mocks
  130. Gem::${gem_name}.Mocks
  131. Gem::${gem_name}.Static
  132. RUNTIME_DEPENDENCIES
  133. Gem::GradientSignal
  134. Gem::LmbrCentral
  135. Gem::SurfaceData
  136. )
  137. # Add ${gem_name}.Tests to googletest
  138. ly_add_googletest(
  139. NAME Gem::${gem_name}.Tests
  140. LABELS REQUIRES_tiaf
  141. )
  142. ly_add_googlebenchmark(
  143. NAME Gem::${gem_name}.Benchmarks
  144. TARGET Gem::${gem_name}.Tests
  145. )
  146. endif()