From 7b7adb8573122ad3b9b4bcffa46b4629e45bb959 Mon Sep 17 00:00:00 2001 From: amzn-phist <52085794+amzn-phist@users.noreply.github.com> Date: Tue, 27 Jul 2021 18:18:03 -0500 Subject: [PATCH] Don't require a specific version of Wwise SDK, allow for later versions to be used (#2484) * Updates the Wwise SDK detection in CMake Parses AkWwiseSDKVersion.h to obtain the version instead of requiring an exact version to be installed. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Updates readme.md information about Wwise Rewrite some of the setup info about Wwise, mention the two ways in which Wwise can be found via CMake and that users can install later versions than the one specified. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Remove unnecessary parts of Wwise version detect Don't need to parse the file contents, it was only being used to print a message to CMake. Simplify the validation to just checking that the SDK version header exists. Maybe in the future we can reinstate better version checking to make sure the version falls within a range. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Updates capitalization of Audiokinetic name Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> --- Gems/AudioEngineWwise/gem.json | 2 +- README.md | 13 +++++++------ cmake/3rdParty/FindWwise.cmake | 30 +++++++++--------------------- 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/Gems/AudioEngineWwise/gem.json b/Gems/AudioEngineWwise/gem.json index dc5f968bc7..699ed8419a 100644 --- a/Gems/AudioEngineWwise/gem.json +++ b/Gems/AudioEngineWwise/gem.json @@ -8,5 +8,5 @@ "canonical_tags": ["Gem"], "user_tags": ["Audio", "Utility", "Tools"], "icon_path": "preview.png", - "requirements": "Users will need to download WWise from the AudioKinetic web site: https://www.audiokinetic.com/download/" + "requirements": "Users will need to download Wwise from the Audiokinetic web site: https://www.audiokinetic.com/download/" } diff --git a/README.md b/README.md index 6b88097739..c129fffb6c 100644 --- a/README.md +++ b/README.md @@ -41,11 +41,13 @@ git clone https://github.com/o3de/o3de.git #### Optional -* Wwise - 2021.1.1.7601 minimum: [https://www.audiokinetic.com/download/](https://www.audiokinetic.com/download/) +* Wwise version 2021.1.1.7601 minimum: [https://www.audiokinetic.com/download/](https://www.audiokinetic.com/download/) * Note: This requires registration and installation of a client application to download - * Make sure to select the SDK(C++) component during installation of Wwise - * You will also need to set an environment variable: `set LY_WWISE_INSTALL_PATH=` - * For example: `set LY_WWISE_INSTALL_PATH="C:\Program Files (x86)\Audiokinetic\Wwise 2021.1.1.7601"` + * Note: It is generally okay to use a more recent version of Wwise, but some SDK updates will require code changes + * Make sure to select the `SDK(C++)` component during installation of Wwise + * CMake can find the Wwise install location in two ways: + * The `LY_WWISE_INSTALL_PATH` CMake cache variable -- this is checked first + * The `WWISEROOT` environment variable which is set when installing Wwise SDK ### Quick Start Build Steps @@ -54,8 +56,7 @@ git clone https://github.com/o3de/o3de.git 1. Install the following redistributables to the following: - Visual Studio and VC++ redistributable can be installed to any location - CMake can be installed to any location, as long as it's available in the system path - - (Optional) Wwise can be installed anywhere, but you will need to set an environment variable for CMake to detect it: `set LY_WWISE_INSTALL_PATH=` - + 1. Configure the source into a solution using this command line, replacing and <3rdParty cache path> to a path you've created: ``` cmake -B -S -G "Visual Studio 16" -DLY_3RDPARTY_PATH=<3rdParty cache path> -DLY_UNITY_BUILD=ON -DLY_PROJECTS=AutomatedTesting diff --git a/cmake/3rdParty/FindWwise.cmake b/cmake/3rdParty/FindWwise.cmake index 8cd6db31dd..4cb95da319 100644 --- a/cmake/3rdParty/FindWwise.cmake +++ b/cmake/3rdParty/FindWwise.cmake @@ -6,25 +6,16 @@ # # -# The current supported version of Wwise -set(WWISE_VERSION 2021.1.1.7601) - # Wwise Install Path -# Initialize to the default 3rdParty path -set(LY_WWISE_INSTALL_PATH "" CACHE PATH "Path to Wwise version ${WWISE_VERSION} installation.") +set(LY_WWISE_INSTALL_PATH "" CACHE PATH "Path to Wwise installation.") +# Check for a known file in the SDK path to verify the path function(is_valid_sdk sdk_path is_valid) set(${is_valid} FALSE PARENT_SCOPE) if(EXISTS ${sdk_path}) set(sdk_version_file ${sdk_path}/SDK/include/AK/AkWwiseSDKVersion.h) if(EXISTS ${sdk_version_file}) - string(FIND ${sdk_path} ${WWISE_VERSION} index) - if(NOT index EQUAL -1) - set(${is_valid} TRUE PARENT_SCOPE) - else() - # The install path doesn't contain the WWISE_VERSION string. - # The path could still be correct, but it would require parsing the AkWwiseSDKVersion.h to verify. - endif() + set(${is_valid} TRUE PARENT_SCOPE) endif() endif() endfunction() @@ -32,19 +23,17 @@ endfunction() # Paths that will be checked, in order: # - CMake cache variable # - WWISEROOT Environment Variable -# - Standard 3rdParty path set(WWISE_SDK_PATHS "${LY_WWISE_INSTALL_PATH}" "$ENV{WWISEROOT}" - "${LY_3RDPARTY_PATH}/Wwise/${WWISE_VERSION}" ) set(found_sdk FALSE) -foreach(test_path ${WWISE_SDK_PATHS}) - is_valid_sdk(${test_path} found_sdk) +foreach(candidate_path ${WWISE_SDK_PATHS}) + is_valid_sdk(${candidate_path} found_sdk) if(found_sdk) - # Update the Wwise Install Path cache variable - set(LY_WWISE_INSTALL_PATH "${test_path}") + # Update the Wwise Install Path variable internally + set(LY_WWISE_INSTALL_PATH "${candidate_path}") break() endif() endforeach() @@ -112,15 +101,14 @@ set(WWISE_COMPILE_DEFINITIONS ) -# The default install path might look different than the standard 3rdParty format (${LY_3RDPARTY_PATH}//). # Use these to get the parent path and folder name before adding the external 3p target. -get_filename_component(WWISE_3P_ROOT ${LY_WWISE_INSTALL_PATH} DIRECTORY) +get_filename_component(WWISE_INSTALL_ROOT ${LY_WWISE_INSTALL_PATH} DIRECTORY) get_filename_component(WWISE_FOLDER ${LY_WWISE_INSTALL_PATH} NAME) ly_add_external_target( NAME Wwise VERSION "${WWISE_FOLDER}" - 3RDPARTY_ROOT_DIRECTORY "${WWISE_3P_ROOT}" + 3RDPARTY_ROOT_DIRECTORY "${WWISE_INSTALL_ROOT}" INCLUDE_DIRECTORIES SDK/include COMPILE_DEFINITIONS ${WWISE_COMPILE_DEFINITIONS} )