FindWwise.cmake 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. #
  2. # All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
  3. # its licensors.
  4. #
  5. # For complete copyright and license terms please see the LICENSE at the root of this
  6. # distribution (the "License"). All use of this software is governed by the License,
  7. # or, if provided, by the license below or the license accompanying this file. Do not
  8. # remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
  9. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. #
  11. # The current supported version of Wwise
  12. set(WWISE_VERSION 2021.1.1.7601)
  13. # Wwise Install Path
  14. # Initialize to the default 3rdParty path
  15. set(LY_WWISE_INSTALL_PATH "" CACHE PATH "Path to Wwise version ${WWISE_VERSION} installation.")
  16. function(is_valid_sdk sdk_path is_valid)
  17. set(${is_valid} FALSE PARENT_SCOPE)
  18. if(EXISTS ${sdk_path})
  19. set(sdk_version_file ${sdk_path}/SDK/include/AK/AkWwiseSDKVersion.h)
  20. if(EXISTS ${sdk_version_file})
  21. string(FIND ${sdk_path} ${WWISE_VERSION} index)
  22. if(NOT index EQUAL -1)
  23. set(${is_valid} TRUE PARENT_SCOPE)
  24. else()
  25. # The install path doesn't contain the WWISE_VERSION string.
  26. # The path could still be correct, but it would require parsing the AkWwiseSDKVersion.h to verify.
  27. endif()
  28. endif()
  29. endif()
  30. endfunction()
  31. # Paths that will be checked, in order:
  32. # - CMake cache variable
  33. # - WWISEROOT Environment Variable
  34. # - Standard 3rdParty path
  35. set(WWISE_SDK_PATHS
  36. "${LY_WWISE_INSTALL_PATH}"
  37. "$ENV{WWISEROOT}"
  38. "${LY_3RDPARTY_PATH}/Wwise/${WWISE_VERSION}"
  39. )
  40. set(found_sdk FALSE)
  41. foreach(test_path ${WWISE_SDK_PATHS})
  42. is_valid_sdk(${test_path} found_sdk)
  43. if(found_sdk)
  44. # Update the Wwise Install Path cache variable
  45. set(LY_WWISE_INSTALL_PATH "${test_path}" CACHE PATH "Path to Wwise version ${WWISE_VERSION} installation." FORCE)
  46. break()
  47. endif()
  48. endforeach()
  49. if(NOT found_sdk)
  50. # If we don't find a path that appears to be a valid Wwise install, we can bail here.
  51. # No 3rdParty::Wwise target will exist, so that can be checked elsewhere.
  52. message(STATUS "Wwise SDK version ${WWISE_VERSION} was not found.")
  53. return()
  54. else()
  55. message(STATUS "Using Wwise SDK at ${LY_WWISE_INSTALL_PATH}")
  56. endif()
  57. set(WWISE_COMMON_LIB_NAMES
  58. # Core AK
  59. AkMemoryMgr
  60. AkMusicEngine
  61. AkSoundEngine
  62. AkStreamMgr
  63. AkSpatialAudio
  64. # AK Effects
  65. AkCompressorFX
  66. AkDelayFX
  67. AkMatrixReverbFX
  68. AkMeterFX
  69. AkExpanderFX
  70. AkParametricEQFX
  71. AkGainFX
  72. AkPeakLimiterFX
  73. AkRoomVerbFX
  74. AkGuitarDistortionFX
  75. AkStereoDelayFX
  76. AkPitchShifterFX
  77. AkTimeStretchFX
  78. AkFlangerFX
  79. AkTremoloFX
  80. AkHarmonizerFX
  81. AkRecorderFX
  82. # AK Sources
  83. AkSilenceSource
  84. AkSineSource
  85. AkToneSource
  86. AkAudioInputSource
  87. AkSynthOneSource
  88. )
  89. set(WWISE_CODEC_LIB_NAMES
  90. # AK Codecs
  91. AkVorbisDecoder
  92. AkOpusDecoder
  93. )
  94. set(WWISE_NON_RELEASE_LIB_NAMES
  95. # For remote profiling
  96. CommunicationCentral
  97. )
  98. set(WWISE_ADDITIONAL_LIB_NAMES
  99. # Additional Libraries
  100. )
  101. set(WWISE_COMPILE_DEFINITIONS
  102. $<IF:$<CONFIG:Release>,AK_OPTIMIZED,>
  103. )
  104. # The default install path might look different than the standard 3rdParty format (${LY_3RDPARTY_PATH}/<Name>/<Version>).
  105. # Use these to get the parent path and folder name before adding the external 3p target.
  106. get_filename_component(WWISE_3P_ROOT ${LY_WWISE_INSTALL_PATH} DIRECTORY)
  107. get_filename_component(WWISE_FOLDER ${LY_WWISE_INSTALL_PATH} NAME)
  108. ly_add_external_target(
  109. NAME Wwise
  110. VERSION "${WWISE_FOLDER}"
  111. 3RDPARTY_ROOT_DIRECTORY "${WWISE_3P_ROOT}"
  112. INCLUDE_DIRECTORIES SDK/include
  113. COMPILE_DEFINITIONS ${WWISE_COMPILE_DEFINITIONS}
  114. )
  115. set(Wwise_FOUND TRUE)