CMakeLists.txt 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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. set(AUDIOSYSTEM_COMPILEDEFINITIONS
  9. $<IF:$<CONFIG:Release>,AUDIO_RELEASE,ENABLE_AUDIO_LOGGING>
  10. )
  11. o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_parent_relative_path}")
  12. ################################################################################
  13. # Client Targets
  14. ################################################################################
  15. ly_add_target(
  16. NAME ${gem_name}.API INTERFACE
  17. NAMESPACE Gem
  18. FILES_CMAKE
  19. audiosystem_api_files.cmake
  20. INCLUDE_DIRECTORIES
  21. INTERFACE
  22. Include/Engine
  23. BUILD_DEPENDENCIES
  24. INTERFACE
  25. AZ::AzCore
  26. )
  27. ly_add_target(
  28. NAME ${gem_name}.Private.Object STATIC
  29. NAMESPACE Gem
  30. FILES_CMAKE
  31. audiosystem_files.cmake
  32. ${pal_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
  33. TARGET_PROPERTIES
  34. O3DE_PRIVATE_TARGET TRUE
  35. INCLUDE_DIRECTORIES
  36. PRIVATE
  37. Include/Engine
  38. Source/Engine
  39. ${pal_dir}
  40. PLATFORM_INCLUDE_FILES
  41. ${pal_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
  42. COMPILE_DEFINITIONS
  43. PUBLIC
  44. ${AUDIOSYSTEM_COMPILEDEFINITIONS}
  45. BUILD_DEPENDENCIES
  46. PUBLIC
  47. AZ::AzCore
  48. AZ::AzFramework
  49. Gem::${gem_name}.API
  50. Gem::Atom_RPI.Public
  51. Legacy::CryCommon # Temporary, needs to be removed
  52. )
  53. ly_add_target(
  54. NAME ${gem_name} ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
  55. NAMESPACE Gem
  56. FILES_CMAKE
  57. audiosystem_shared_files.cmake
  58. INCLUDE_DIRECTORIES
  59. PRIVATE
  60. Source/Engine
  61. ${pal_dir}
  62. COMPILE_DEFINITIONS
  63. PUBLIC
  64. ${AUDIOSYSTEM_COMPILEDEFINITIONS}
  65. BUILD_DEPENDENCIES
  66. PUBLIC
  67. Gem::${gem_name}.API
  68. PRIVATE
  69. Gem::${gem_name}.Private.Object
  70. )
  71. # Inject the gem name into the Module source file
  72. ly_add_source_properties(
  73. SOURCES
  74. Source/AudioSystemModule.cpp
  75. PROPERTY COMPILE_DEFINITIONS
  76. VALUES
  77. O3DE_GEM_NAME=${gem_name}
  78. O3DE_GEM_VERSION=${gem_version})
  79. # AudioSystem aliases for Clients and Unified launchers (no Servers)
  80. ly_create_alias(NAME ${gem_name}.Clients NAMESPACE Gem TARGETS Gem::${gem_name})
  81. ly_create_alias(NAME ${gem_name}.Clients.API NAMESPACE Gem TARGETS Gem::${gem_name}.API)
  82. ly_create_alias(NAME ${gem_name}.Unified NAMESPACE Gem TARGETS Gem::${gem_name})
  83. ly_create_alias(NAME ${gem_name}.Unified.API NAMESPACE Gem TARGETS Gem::${gem_name}.API)
  84. ################################################################################
  85. # Tests
  86. ################################################################################
  87. if (PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  88. set(common_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/Common)
  89. ly_add_target(
  90. NAME ${gem_name}.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  91. NAMESPACE Gem
  92. FILES_CMAKE
  93. audiosystem_tests_files.cmake
  94. audiosystem_shared_files.cmake
  95. INCLUDE_DIRECTORIES
  96. PRIVATE
  97. Tests
  98. Source/Engine
  99. BUILD_DEPENDENCIES
  100. PUBLIC
  101. Gem::${gem_name}.API
  102. PRIVATE
  103. AZ::AzTest
  104. Gem::${gem_name}.Private.Object
  105. Legacy::CryCommon # Temporary, needs to be removed
  106. )
  107. ly_add_googletest(
  108. NAME Gem::${gem_name}.Tests
  109. )
  110. list(APPEND testTargets ${gem_name}.Tests)
  111. ly_add_target_files(
  112. TARGETS
  113. ${testTargets}
  114. FILES
  115. ${CMAKE_CURRENT_SOURCE_DIR}/Tests/ATLData/Legacy/MultipleMultiple/ATLTestControls.xml
  116. OUTPUT_SUBDIRECTORY
  117. Test.Assets/Gems/AudioSystem/ATLData/Legacy/MultipleMultiple
  118. )
  119. ly_add_target_files(
  120. TARGETS
  121. ${testTargets}
  122. FILES
  123. ${CMAKE_CURRENT_SOURCE_DIR}/Tests/ATLData/Legacy/MultipleOne/ATLTestControls.xml
  124. OUTPUT_SUBDIRECTORY
  125. Test.Assets/Gems/AudioSystem/ATLData/Legacy/MultipleOne
  126. )
  127. ly_add_target_files(
  128. TARGETS
  129. ${testTargets}
  130. FILES
  131. ${CMAKE_CURRENT_SOURCE_DIR}/Tests/ATLData/Legacy/OneMultiple/ATLTestControls.xml
  132. OUTPUT_SUBDIRECTORY
  133. Test.Assets/Gems/AudioSystem/ATLData/Legacy/OneMultiple
  134. )
  135. ly_add_target_files(
  136. TARGETS
  137. ${testTargets}
  138. FILES
  139. ${CMAKE_CURRENT_SOURCE_DIR}/Tests/ATLData/Legacy/OneOne/ATLTestControls.xml
  140. OUTPUT_SUBDIRECTORY
  141. Test.Assets/Gems/AudioSystem/ATLData/Legacy/OneOne
  142. )
  143. ly_add_target_files(
  144. TARGETS
  145. ${testTargets}
  146. FILES
  147. ${CMAKE_CURRENT_SOURCE_DIR}/Tests/ATLData/MultipleMultiple/ATLTestControls.xml
  148. OUTPUT_SUBDIRECTORY
  149. Test.Assets/Gems/AudioSystem/ATLData/MultipleMultiple
  150. )
  151. ly_add_target_files(
  152. TARGETS
  153. ${testTargets}
  154. FILES
  155. ${CMAKE_CURRENT_SOURCE_DIR}/Tests/ATLData/MultipleOne/ATLTestControls.xml
  156. OUTPUT_SUBDIRECTORY
  157. Test.Assets/Gems/AudioSystem/ATLData/MultipleOne
  158. )
  159. ly_add_target_files(
  160. TARGETS
  161. ${testTargets}
  162. FILES
  163. ${CMAKE_CURRENT_SOURCE_DIR}/Tests/ATLData/OneMultiple/ATLTestControls.xml
  164. OUTPUT_SUBDIRECTORY
  165. Test.Assets/Gems/AudioSystem/ATLData/OneMultiple
  166. )
  167. ly_add_target_files(
  168. TARGETS
  169. ${testTargets}
  170. FILES
  171. ${CMAKE_CURRENT_SOURCE_DIR}/Tests/ATLData/OneOne/ATLTestControls.xml
  172. OUTPUT_SUBDIRECTORY
  173. Test.Assets/Gems/AudioSystem/ATLData/OneOne
  174. )
  175. endif() # PAL_TRAIT_BUILD_TESTS_SUPPORTED
  176. ################################################################################
  177. # Editor
  178. ################################################################################
  179. if (PAL_TRAIT_BUILD_HOST_TOOLS)
  180. ly_add_target(
  181. NAME ${gem_name}.Editor.API INTERFACE
  182. NAMESPACE Gem
  183. FILES_CMAKE
  184. audiosystem_editor_api_files.cmake
  185. INCLUDE_DIRECTORIES
  186. INTERFACE
  187. Include/Editor
  188. BUILD_DEPENDENCIES
  189. INTERFACE
  190. AZ::AzCore
  191. )
  192. ly_add_target(
  193. NAME ${gem_name}.Editor.Private.Object STATIC
  194. NAMESPACE Gem
  195. AUTOMOC
  196. AUTOUIC
  197. AUTORCC
  198. FILES_CMAKE
  199. audiosystem_editor_files.cmake
  200. TARGET_PROPERTIES
  201. O3DE_PRIVATE_TARGET TRUE
  202. INCLUDE_DIRECTORIES
  203. PRIVATE
  204. . # <-- This is needed for Automoc, Autouic, Autorcc
  205. Source/Engine
  206. Source/Editor
  207. ${pal_dir}
  208. COMPILE_DEFINITIONS
  209. PUBLIC
  210. ${AUDIOSYSTEM_COMPILEDEFINITIONS}
  211. BUILD_DEPENDENCIES
  212. PUBLIC
  213. AZ::AzCore
  214. AZ::AzToolsFramework
  215. Legacy::EditorCore
  216. Legacy::EditorCommon
  217. Gem::${gem_name}.API
  218. Gem::${gem_name}.Editor.API
  219. Legacy::CryCommon # Temporary, needs to be removed
  220. PRIVATE
  221. Gem::${gem_name}.Private.Object
  222. 3rdParty::Qt::Core
  223. 3rdParty::Qt::Widgets
  224. 3rdParty::Qt::Gui
  225. )
  226. ly_add_target(
  227. NAME ${gem_name}.Editor GEM_MODULE
  228. NAMESPACE Gem
  229. FILES_CMAKE
  230. audiosystem_editor_shared_files.cmake
  231. INCLUDE_DIRECTORIES
  232. PRIVATE
  233. Source/Editor
  234. Source/Engine
  235. COMPILE_DEFINITIONS
  236. PRIVATE
  237. AUDIO_SYSTEM_EDITOR
  238. BUILD_DEPENDENCIES
  239. PUBLIC
  240. Gem::${gem_name}.API
  241. Gem::${gem_name}.Editor.API
  242. PRIVATE
  243. 3rdParty::Qt::Core
  244. Gem::Atom_RPI.Public
  245. Gem::${gem_name}.Editor.Private.Object
  246. )
  247. # use the above "Editor" target in tools and builders:
  248. ly_create_alias(NAME ${gem_name}.Tools NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
  249. ly_create_alias(NAME ${gem_name}.Builders NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
  250. if (PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  251. ly_add_target(
  252. NAME ${gem_name}.Editor.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  253. NAMESPACE Gem
  254. FILES_CMAKE
  255. audiosystem_editor_tests_files.cmake
  256. audiosystem_editor_shared_files.cmake
  257. INCLUDE_DIRECTORIES
  258. PRIVATE
  259. Tests
  260. Source/Editor
  261. Source/Engine
  262. BUILD_DEPENDENCIES
  263. PUBLIC
  264. Gem::${gem_name}.API
  265. Gem::${gem_name}.Editor.API
  266. PRIVATE
  267. AZ::AzTest
  268. 3rdParty::Qt::Core
  269. Gem::Atom_RPI.Public
  270. Gem::${gem_name}.Editor.Private.Object
  271. )
  272. ly_add_googletest(
  273. NAME Gem::AudioSystem.Editor.Tests
  274. LABELS REQUIRES_tiaf
  275. )
  276. endif() # PAL_TRAIT_BUILD_TESTS_SUPPORTED
  277. endif() # PAL_TRAIT_BUILD_HOST_TOOLS