3
0

CMakeLists.txt 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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/MiniAudio/Code/Platform/<platorm_name> or
  13. # <restricted_folder>/<platform_name>/Gems/MiniAudio/Code
  14. o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_parent_relative_path}")
  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. # The MiniAudio.API target declares the common interface that users of this gem should depend on in their targets
  20. ly_add_target(
  21. NAME ${gem_name}.API INTERFACE
  22. NAMESPACE Gem
  23. FILES_CMAKE
  24. miniaudio_api_files.cmake
  25. ${pal_dir}/miniaudio_api_files.cmake
  26. INCLUDE_DIRECTORIES
  27. INTERFACE
  28. Include
  29. BUILD_DEPENDENCIES
  30. INTERFACE
  31. AZ::AzCore
  32. )
  33. # The MiniAudio.Private.Object target is an internal target
  34. # It should not be used outside of this Gems CMakeLists.txt
  35. ly_add_target(
  36. NAME ${gem_name}.Private.Object STATIC
  37. NAMESPACE Gem
  38. FILES_CMAKE
  39. miniaudio_private_files.cmake
  40. ${pal_dir}/miniaudio_private_files.cmake
  41. TARGET_PROPERTIES
  42. O3DE_PRIVATE_TARGET TRUE
  43. INCLUDE_DIRECTORIES
  44. PRIVATE
  45. Include
  46. Source
  47. BUILD_DEPENDENCIES
  48. PUBLIC
  49. AZ::AzCore
  50. AZ::AzFramework
  51. PRIVATE
  52. 3rdParty::miniaudio
  53. 3rdParty::stb_vorbis
  54. )
  55. # Here add MiniAudio target, it depends on the Private Object library and Public API interface
  56. ly_add_target(
  57. NAME ${gem_name} ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
  58. NAMESPACE Gem
  59. FILES_CMAKE
  60. miniaudio_shared_files.cmake
  61. ${pal_dir}/miniaudio_shared_files.cmake
  62. INCLUDE_DIRECTORIES
  63. PUBLIC
  64. Include
  65. PRIVATE
  66. Source
  67. BUILD_DEPENDENCIES
  68. PUBLIC
  69. Gem::${gem_name}.API
  70. PRIVATE
  71. Gem::${gem_name}.Private.Object
  72. )
  73. # Inject the gem name into the Module source file
  74. ly_add_source_properties(
  75. SOURCES
  76. Source/Clients/MiniAudioModule.cpp
  77. PROPERTY COMPILE_DEFINITIONS
  78. VALUES
  79. O3DE_GEM_NAME=${gem_name}
  80. O3DE_GEM_VERSION=${gem_version})
  81. # By default, we will specify that the above target MiniAudio would be used by
  82. # Client and Server type targets when this gem is enabled. If you don't want it
  83. # active in Clients or Servers by default, delete one of both of the following lines:
  84. ly_create_alias(NAME ${gem_name}.Clients NAMESPACE Gem TARGETS Gem::${gem_name})
  85. ly_create_alias(NAME ${gem_name}.Servers NAMESPACE Gem TARGETS Gem::${gem_name})
  86. # For the Client and Server variants of MiniAudio Gem, an alias to the MiniAudio.API target will be made
  87. ly_create_alias(NAME ${gem_name}.Clients.API NAMESPACE Gem TARGETS Gem::${gem_name}.API)
  88. ly_create_alias(NAME ${gem_name}.Servers.API NAMESPACE Gem TARGETS Gem::${gem_name}.API)
  89. # If we are on a host platform, we want to add the host tools targets like the MiniAudio.Editor MODULE target
  90. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  91. # The MiniAudio.Editor.API target can be used by other gems that want to interact with the MiniAudio.Editor module
  92. ly_add_target(
  93. NAME ${gem_name}.Editor.API INTERFACE
  94. NAMESPACE Gem
  95. FILES_CMAKE
  96. miniaudio_editor_api_files.cmake
  97. ${pal_dir}/miniaudio_editor_api_files.cmake
  98. INCLUDE_DIRECTORIES
  99. INTERFACE
  100. Include
  101. BUILD_DEPENDENCIES
  102. INTERFACE
  103. AZ::AzToolsFramework
  104. )
  105. # The MiniAudio.Editor.Private.Object target is an internal target
  106. # which is only to be used by this gems CMakeLists.txt and any subdirectories
  107. # Other gems should not use this target
  108. ly_add_target(
  109. NAME ${gem_name}.Editor.Private.Object STATIC
  110. NAMESPACE Gem
  111. FILES_CMAKE
  112. miniaudio_editor_private_files.cmake
  113. TARGET_PROPERTIES
  114. O3DE_PRIVATE_TARGET TRUE
  115. INCLUDE_DIRECTORIES
  116. PRIVATE
  117. Include
  118. Source
  119. BUILD_DEPENDENCIES
  120. PUBLIC
  121. AZ::AzToolsFramework
  122. AZ::AssetBuilderSDK
  123. $<TARGET_OBJECTS:Gem::${gem_name}.Private.Object>
  124. PRIVATE
  125. 3rdParty::miniaudio
  126. 3rdParty::stb_vorbis
  127. )
  128. ly_add_target(
  129. NAME ${gem_name}.Editor GEM_MODULE
  130. NAMESPACE Gem
  131. AUTOMOC
  132. FILES_CMAKE
  133. miniaudio_editor_shared_files.cmake
  134. INCLUDE_DIRECTORIES
  135. PRIVATE
  136. Source
  137. PUBLIC
  138. Include
  139. BUILD_DEPENDENCIES
  140. PUBLIC
  141. Gem::${gem_name}.Editor.API
  142. PRIVATE
  143. Gem::${gem_name}.Editor.Private.Object
  144. )
  145. # By default, we will specify that the above target MiniAudio would be used by
  146. # Tool and Builder type targets when this gem is enabled. If you don't want it
  147. # active in Tools or Builders by default, delete one of both of the following lines:
  148. ly_create_alias(NAME ${gem_name}.Tools NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
  149. ly_create_alias(NAME ${gem_name}.Builders NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
  150. # For the Tools and Builders variants of MiniAudio Gem, an alias to the MiniAudio.Editor API target will be made
  151. ly_create_alias(NAME ${gem_name}.Tools.API NAMESPACE Gem TARGETS Gem::${gem_name}.Editor.API)
  152. ly_create_alias(NAME ${gem_name}.Builders.API NAMESPACE Gem TARGETS Gem::${gem_name}.Editor.API)
  153. endif()