Skip to content

Commit

Permalink
update wwise module for Windows / Android
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterPu committed Dec 12, 2024
1 parent 7ee2c68 commit a37ac1c
Show file tree
Hide file tree
Showing 5 changed files with 169 additions and 20 deletions.
7 changes: 6 additions & 1 deletion FileIO/FileUtility.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ def CopyDirWithWildcardCharInPath_Win(src_root_path,src_sub_path,dst_path,patter


def DeleteFile(path,bForce = False):
PrintLog("DeleteFile " + str(path))
if not Path(path).exists():
PrintWarn("DeleteFile but %s not exists" % path)
return
else:
PrintLog("DeleteFile " + str(path))

path = str(path)
if bForce:
command = (
Expand Down
70 changes: 68 additions & 2 deletions Platform/Android.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def GenTargetPlatformParams(args):
ret, val = PlatformBase.GenTargetPlatformParams(args)

key = "androidpackagename"
val[key] = args.androidpackagename
val[key] = args.androidpackagename if "androidpackagename" in args else ""
# key = "target_platform"
# val[key] = "Android"

Expand Down Expand Up @@ -123,4 +123,70 @@ def PostPackaged(self):
#####################################################################################
#################################### Wwise ##########################################
def Package_Wwise(self):
pass
WPMHelper.Get().CleanWwiseProject()

self.SetupEnvironment_Wwise()

list_config = ["Debug","Profile","Release"]
list_arch = ["armeabi-v7a", "x86", "arm64-v8a", "x86_64"]
platform = "Android"

OneWwiseCommand = WwiseCommand()
OneWwiseCommand.path_project = WPMHelper.Get().GetPath_WPProject()
OneWwiseCommand.path_wp = WPMHelper.Get().GetPath_WwiseWPScript()

one_param_premake = ParamsWwisePluginPremake()
one_param_premake.platform = "Android"
OneWwiseCommand.Premake(one_param_premake)

for one_config in list_config:
for one_arch in list_arch:
one_param = ParamsWwisePluginBuild()
one_param.config = one_config
one_param.arch = one_arch
one_param.platform = platform

OneWwiseCommand.Build(one_param)

def SetupEnvironment_Wwise(self):
PrintStageLog("SetupEnvironment_Wwise - Android")

PrintLog("Before Modification: NDKROOT: %s" % os.environ["NDKROOT"])
PrintLog("Before Modification: NDK_ROOT: %s" % os.environ["NDK_ROOT"])

path_ndk = Path(os.environ["NDKROOT"])

final_ndk_path = path_ndk.parent.joinpath("25.1.8937393")
# final_ndk_path = path_ndk.parent.joinpath("21.4.7075529")

os.environ["NDKROOT"] = str(final_ndk_path)
os.environ["NDK_ROOT"] = str(final_ndk_path)

PrintLog("Cur NDKROOT: %s" % os.environ["NDKROOT"])
PrintLog("Cur NDK_ROOT: %s" % os.environ["NDK_ROOT"])


## Modifiy In
if SystemHelper.Get().GetHostPlatform() == SystemHelper.Win_HostName():
path_android_script_in_wwise_script = Path("C:\Program Files (x86)\Audiokinetic\Wwise 2021.1.14.8108\Scripts\Build\Plugins\common\command\android.py")
PrintWarn(f"Please check modification of android script in wwise build script {path_android_script_in_wwise_script}")

#### Change The Code Here ###
# libs_out = " NDK_LIBS_OUT=" + '"' + os.path.join(out_dir_root, config, "libs").replace("\\", "/") + '"'
# ndk_out = " NDK_OUT=" + '"' +os.path.join(out_dir_root, config, "lib").replace("\\", "/") + '"' # the missing "s" at lib is on purpose
# ndk_app_out = " NDK_APP_OUT="+ '"' + out_dir_root.replace("\\", "/") + '"'
# target_out = " TARGET_OUT="+ '"' + os.path.join(out_dir_root, config, "lib").replace("\\", "/") + '"'

#### Change The Code To ###
# from pathlib import Path
# def wrap_str(val_str):
# return '"' + val_str + '"'
# # return str('"' + val_str + '"').replace('\\', '//')

# # ......
# path_lib = Path("D://WwiseAndroidOutput") / config
# libs_out = " NDK_LIBS_OUT=" + wrap_str(str(path_lib))
# ndk_out = " NDK_OUT=" + wrap_str(str(path_lib))
# ndk_app_out = " NDK_APP_OUT=" + wrap_str(str(path_lib))
# target_out = " TARGET_OUT=" + wrap_str(str(path_lib))

19 changes: 13 additions & 6 deletions Platform/Windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,32 @@ def PostPackaged(self):
#####################################################################################
#################################### Wwise ##########################################
def Package_Wwise(self):
WPMHelper.Get().CleanWwiseProject()

list_config = ["Debug","Profile","Release"]
arch = "x64"
toolset = ["vc160","vc170"]
platform = {
"vc160":"Windows_vc160",
"vc170":"Windows_vc170"
}
toolset = WPMHelper.Get().GetWindowsToolsetList()
not_build_black_list = WPMHelper.Get().GetWindowsToolsetBuildBlackList()

OneWwiseCommand = WwiseCommand()
OneWwiseCommand.path_project = WPMHelper.Get().GetPath_WPProject()
OneWwiseCommand.path_wp = WPMHelper.Get().GetPath_WwiseWPScript()

one_param_premake = ParamsWwisePluginPremake()
## Authoring would generate all platforms
one_param_premake.platform = "Authoring"
OneWwiseCommand.Premake(one_param_premake)

for one_config in list_config:
one_param = ParamsWwisePluginBuild()
one_param.config = one_config
one_param.arch = arch

for one_toolset in toolset:
if one_toolset in not_build_black_list:
PrintLog("Skip Build - %s" % one_toolset)
continue
one_param.toolset = one_toolset
one_param.platform = platform[one_toolset]
one_param.platform = "Windows_" + one_toolset
OneWwiseCommand.Build(one_param)

4 changes: 3 additions & 1 deletion WPM.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ def ParseCMDArgs(self):
def AddArgsToParser(self,ArgParser, bIncludeConflictArgs = True):
ArgParser.add_argument('-wwisever',default="2021.1.14.8108")
ArgParser.add_argument('-pathwwisebase',default="")
ArgParser.add_argument('-wpprojectpath',default="/Users/winterpu/Documents/Gitee/agora-wwise-plugin/AgoraWWiseRTCSDK")
ArgParser.add_argument('-wpprojectpath',default="")
ArgParser.add_argument('-wwisepluginname',default="AgoraWWiseRTCSDK")
ArgParser.add_argument('-wwise_xcode_generated_teamid',default="BCB4VLKTK5")
ArgParser.add_argument('-wwise_windows_toolset',default="vc150+vc160+vc170")
ArgParser.add_argument('-wwise_windows_toolset_not_build',default="vc150")
if bIncludeConflictArgs:
ArgParser.add_argument("-targetplatform", default=SystemHelper.Get().GetTargetPlatform_BasedOnHostPlatform())
ArgParser.add_argument("-ioscert", default="D")
Expand Down
89 changes: 79 additions & 10 deletions WPMHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ def GetPath_WwiseSDKBase(self):
def GetName_WwisePluginName(self):
return self.__Args.wwisepluginname

## Windows
def GetWindowsToolsetList(self):
## Full List
str_toolset = self.__Args.wwise_windows_toolset
return str_toolset.split('+')

def GetWindowsToolsetBuildBlackList(self):
## Not Build List
str_toolset = self.__Args.wwise_windows_toolset_not_build
return str_toolset.split('+')

## Mac / IOS
def GetWwiseDefaultTeamID(self):
return self.__Args.wwise_xcode_generated_teamid

Expand All @@ -85,16 +97,73 @@ def GetAppleTeamID(self):

def CleanWwiseProject(self):
path_wp_project = self.GetPath_WPProject()
name_mac_xcodeworkspace = self.GetName_WwisePluginName() + "_Mac.xcworkspace"
NAME_PLUGIN = self.GetName_WwisePluginName()

NAME_SOUND_ENGINE = "SoundEnginePlugin"
## Windows
win_toolset_list = self.GetWindowsToolsetList()
for one_toolset in win_toolset_list:
name_sln_authoring = NAME_PLUGIN + "_Authoring_Windows_" + one_toolset + ".sln"
path_sln_authoring = path_wp_project / name_sln_authoring
FileUtility.DeleteFile(path_sln_authoring)

name_sln_windows_shared = NAME_PLUGIN + "_Windows_" + one_toolset + "_shared.sln"
path_sln_windows_shared = path_wp_project / name_sln_windows_shared
FileUtility.DeleteFile(path_sln_windows_shared)

name_vcxproj_windows_shared = NAME_PLUGIN + "_Windows_" + one_toolset + "_shared.vcxproj"
path_vcxproj_windows_shared = path_wp_project / NAME_SOUND_ENGINE / name_vcxproj_windows_shared
FileUtility.DeleteFile(path_vcxproj_windows_shared)


name_vcxproj_filters_windows_shared = NAME_PLUGIN + "_Windows_" + one_toolset + "_shared.vcxproj.filters"
path_vcxproj_filters_windows_shared = path_wp_project / NAME_SOUND_ENGINE / name_vcxproj_filters_windows_shared
FileUtility.DeleteFile(path_vcxproj_filters_windows_shared)

name_sln_windows_static = NAME_PLUGIN + "_Windows_" + one_toolset + "_static.sln"
path_sln_windows_static = path_wp_project / name_sln_windows_static
FileUtility.DeleteFile(path_sln_windows_static)

name_vcxproj_windows_static = NAME_PLUGIN + "_Windows_" + one_toolset + "_static.vcxproj"
path_vcxproj_windows_static = path_wp_project / NAME_SOUND_ENGINE / name_vcxproj_windows_static
FileUtility.DeleteFile(path_vcxproj_windows_static)

name_vcxproj_filters_windows_static = NAME_PLUGIN + "_Windows_" + one_toolset + "_static.vcxproj.filters"
path_vcxproj_filters_windows_static = path_wp_project / NAME_SOUND_ENGINE / name_vcxproj_filters_windows_static
FileUtility.DeleteFile(path_vcxproj_filters_windows_static)


#Android
name_android_mk = NAME_PLUGIN + "_Android.mk"
path_android_mk = path_wp_project/ name_android_mk
FileUtility.DeleteFile(path_android_mk)


name_android_application_mk = NAME_PLUGIN + "_Android_application.mk"
path_android_application_mk = path_wp_project / name_android_application_mk
FileUtility.DeleteFile(path_android_application_mk)


name_android_shared_mk = NAME_PLUGIN + "_Android_shared.mk"
path_android_shared_mk = path_wp_project / NAME_SOUND_ENGINE / name_android_shared_mk
FileUtility.DeleteFile(path_android_shared_mk)

name_android_static_mk = NAME_PLUGIN + "_Android_static.mk"
path_android_static_mk = path_wp_project / NAME_SOUND_ENGINE / name_android_static_mk
FileUtility.DeleteFile(path_android_static_mk)


## Mac / iOS
name_mac_xcodeworkspace = NAME_PLUGIN + "_Mac.xcworkspace"
FileUtility.DeleteDir(path_wp_project / name_mac_xcodeworkspace)
name_ios_xcodeworkspace = self.GetName_WwisePluginName() + "_iOS.xcworkspace"
name_ios_xcodeworkspace = NAME_PLUGIN + "_iOS.xcworkspace"
FileUtility.DeleteDir(path_wp_project / name_ios_xcodeworkspace)

name_mac_shared_xcodeproj = self.GetName_WwisePluginName() + "_Mac_shared.xcodeproj"
FileUtility.DeleteDir(path_wp_project / "SoundEngine" / name_mac_shared_xcodeproj)
name_mac_static_xcodeproj = self.GetName_WwisePluginName() + "_Mac_static.xcodeproj"
FileUtility.DeleteDir(path_wp_project / "SoundEngine" / name_mac_static_xcodeproj)
name_ios_shared_xcodeproj = self.GetName_WwisePluginName() + "_iOS_shared.xcodeproj"
FileUtility.DeleteDir(path_wp_project / "SoundEngine" / name_ios_shared_xcodeproj)
name_ios_static_xcodeproj = self.GetName_WwisePluginName() + "_iOS_static.xcodeproj"
FileUtility.DeleteDir(path_wp_project / "SoundEngine" / name_ios_static_xcodeproj)
name_mac_shared_xcodeproj = NAME_PLUGIN + "_Mac_shared.xcodeproj"
FileUtility.DeleteDir(path_wp_project / NAME_SOUND_ENGINE / name_mac_shared_xcodeproj)
name_mac_static_xcodeproj = NAME_PLUGIN + "_Mac_static.xcodeproj"
FileUtility.DeleteDir(path_wp_project / NAME_SOUND_ENGINE / name_mac_static_xcodeproj)
name_ios_shared_xcodeproj = NAME_PLUGIN + "_iOS_shared.xcodeproj"
FileUtility.DeleteDir(path_wp_project / NAME_SOUND_ENGINE / name_ios_shared_xcodeproj)
name_ios_static_xcodeproj = NAME_PLUGIN + "_iOS_static.xcodeproj"
FileUtility.DeleteDir(path_wp_project / NAME_SOUND_ENGINE / name_ios_static_xcodeproj)

0 comments on commit a37ac1c

Please sign in to comment.