Przeglądaj źródła

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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* Updates capitalization of Audiokinetic name

Signed-off-by: amzn-phist <[email protected]>
amzn-phist 4 lat temu
rodzic
commit
7b7adb8573
3 zmienionych plików z 17 dodań i 28 usunięć
  1. 1 1
      Gems/AudioEngineWwise/gem.json
  2. 7 6
      README.md
  3. 9 21
      cmake/3rdParty/FindWwise.cmake

+ 1 - 1
Gems/AudioEngineWwise/gem.json

@@ -8,5 +8,5 @@
     "canonical_tags": ["Gem"],
     "canonical_tags": ["Gem"],
     "user_tags": ["Audio", "Utility", "Tools"],
     "user_tags": ["Audio", "Utility", "Tools"],
     "icon_path": "preview.png",
     "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/"
 }
 }

+ 7 - 6
README.md

@@ -41,11 +41,13 @@ git clone https://github.com/o3de/o3de.git
 
 
 #### Optional
 #### 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
     *   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=<path to Wwise version>`
-    *   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
 ### Quick Start Build Steps
 
 
@@ -54,8 +56,7 @@ git clone https://github.com/o3de/o3de.git
 1.  Install the following redistributables to the following:
 1.  Install the following redistributables to the following:
     - Visual Studio and VC++ redistributable can be installed to any location
     - 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
     - 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=<path to Wwise>`
-    
+
 1.  Configure the source into a solution using this command line, replacing <your build path> and <3rdParty cache path> to a path you've created:
 1.  Configure the source into a solution using this command line, replacing <your build path> and <3rdParty cache path> to a path you've created:
     ```
     ```
     cmake -B <your build path> -S <your source path> -G "Visual Studio 16" -DLY_3RDPARTY_PATH=<3rdParty cache path> -DLY_UNITY_BUILD=ON -DLY_PROJECTS=AutomatedTesting 
     cmake -B <your build path> -S <your source path> -G "Visual Studio 16" -DLY_3RDPARTY_PATH=<3rdParty cache path> -DLY_UNITY_BUILD=ON -DLY_PROJECTS=AutomatedTesting 

+ 9 - 21
cmake/3rdParty/FindWwise.cmake

@@ -6,25 +6,16 @@
 #
 #
 #
 #
 
 
-# The current supported version of Wwise
-set(WWISE_VERSION 2021.1.1.7601)
-
 # Wwise Install Path
 # 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)
 function(is_valid_sdk sdk_path is_valid)
     set(${is_valid} FALSE PARENT_SCOPE)
     set(${is_valid} FALSE PARENT_SCOPE)
     if(EXISTS ${sdk_path})
     if(EXISTS ${sdk_path})
         set(sdk_version_file ${sdk_path}/SDK/include/AK/AkWwiseSDKVersion.h)
         set(sdk_version_file ${sdk_path}/SDK/include/AK/AkWwiseSDKVersion.h)
         if(EXISTS ${sdk_version_file})
         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()
     endif()
     endif()
 endfunction()
 endfunction()
@@ -32,19 +23,17 @@ endfunction()
 # Paths that will be checked, in order:
 # Paths that will be checked, in order:
 # - CMake cache variable
 # - CMake cache variable
 # - WWISEROOT Environment Variable
 # - WWISEROOT Environment Variable
-# - Standard 3rdParty path
 set(WWISE_SDK_PATHS
 set(WWISE_SDK_PATHS
     "${LY_WWISE_INSTALL_PATH}"
     "${LY_WWISE_INSTALL_PATH}"
     "$ENV{WWISEROOT}"
     "$ENV{WWISEROOT}"
-    "${LY_3RDPARTY_PATH}/Wwise/${WWISE_VERSION}"
 )
 )
 
 
 set(found_sdk FALSE)
 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)
     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()
         break()
     endif()
     endif()
 endforeach()
 endforeach()
@@ -112,15 +101,14 @@ set(WWISE_COMPILE_DEFINITIONS
 )
 )
 
 
 
 
-# The default install path might look different than the standard 3rdParty format (${LY_3RDPARTY_PATH}/<Name>/<Version>).
 # Use these to get the parent path and folder name before adding the external 3p target.
 # 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)
 get_filename_component(WWISE_FOLDER ${LY_WWISE_INSTALL_PATH} NAME)
 
 
 ly_add_external_target(
 ly_add_external_target(
     NAME Wwise
     NAME Wwise
     VERSION "${WWISE_FOLDER}"
     VERSION "${WWISE_FOLDER}"
-    3RDPARTY_ROOT_DIRECTORY "${WWISE_3P_ROOT}"
+    3RDPARTY_ROOT_DIRECTORY "${WWISE_INSTALL_ROOT}"
     INCLUDE_DIRECTORIES SDK/include
     INCLUDE_DIRECTORIES SDK/include
     COMPILE_DEFINITIONS ${WWISE_COMPILE_DEFINITIONS}
     COMPILE_DEFINITIONS ${WWISE_COMPILE_DEFINITIONS}
 )
 )