From f70b1a47d21f510a2bcf04f189853ae020bac612 Mon Sep 17 00:00:00 2001 From: Winter Pu Date: Fri, 13 Dec 2024 11:43:50 +0800 Subject: [PATCH] update Wwise Archive Function --- Platform/Android.py | 24 +++++++++++++++++++++ Platform/IOS.py | 20 ++++++++++++++++- Platform/Mac.py | 23 +++++++++++++++++++- Platform/Windows.py | 29 +++++++++++++++++++++++++ Utility/ArchiveManager.py | 45 +++++++++++++++++++++++++++++++++++++++ WPMHelper.py | 3 +++ 6 files changed, 142 insertions(+), 2 deletions(-) diff --git a/Platform/Android.py b/Platform/Android.py index f46cd82..dcc9273 100644 --- a/Platform/Android.py +++ b/Platform/Android.py @@ -148,6 +148,30 @@ def Package_Wwise(self): OneWwiseCommand.Build(one_param) + PrintStageLog("Android - Package_Wwise Build Complete") + + ## Archive + ## Final Product + for one_config in list_config: + for one_arch in list_arch: + OneArchiveInfo = ArchiveInfo_WwisePlugin( + WPMHelper.Get().GetName_WwisePluginName(), + WPMHelper.Get().GetVer_Wwise(), + SystemHelper.IOS_TargetName(), + one_config, + one_arch + + ) + extension = "so" + name_final_product = OneArchiveInfo.GetArchiveName() + "." + extension + path_target_archive_file = WPMHelper.Get().GetPath_WwiseSDKBase() / "Android_" + one_arch / one_config / "lib" / name_final_product + PrintWarn("Src Wwise Final Product [%s]" % path_target_archive_file) + bshould_clean_others_when_archving = False + ArchiveManager.Get().ArchiveBuild(path_target_archive_file,OneArchiveInfo,bshould_clean_others_when_archving,extension) + + PrintStageLog("Android - Package_Wwise Archive Complete") + + def SetupEnvironment_Wwise(self): PrintStageLog("SetupEnvironment_Wwise - Android") diff --git a/Platform/IOS.py b/Platform/IOS.py index 377c364..e14e79b 100644 --- a/Platform/IOS.py +++ b/Platform/IOS.py @@ -339,4 +339,22 @@ def Package_Wwise(self): one_param_build.platform = platform OneWwiseCommand.Build(one_param_build) - PrintStageLog("iOS - Package_Wwise Complete") \ No newline at end of file + PrintStageLog("iOS - Package_Wwise Build Complete") + + ## Archive + ## Final Product + for one_config in list_config: + OneArchiveInfo = ArchiveInfo_WwisePlugin( + WPMHelper.Get().GetName_WwisePluginName(), + WPMHelper.Get().GetVer_Wwise(), + SystemHelper.IOS_TargetName(), + one_config + ) + extension = "a" + name_final_product = OneArchiveInfo.GetArchiveName() + "." + extension + path_target_archive_file = WPMHelper.Get().GetPath_WwiseSDKBase() / "iOS" /(one_config +"-iphoneos") / "lib" / name_final_product + PrintWarn("Src Wwise Final Product [%s]" % path_target_archive_file) + bshould_clean_others_when_archving = False + ArchiveManager.Get().ArchiveBuild(path_target_archive_file,OneArchiveInfo,bshould_clean_others_when_archving,extension) + + PrintStageLog("IOS - Package_Wwise Archive Complete") \ No newline at end of file diff --git a/Platform/Mac.py b/Platform/Mac.py index cbd3bf3..5187d78 100644 --- a/Platform/Mac.py +++ b/Platform/Mac.py @@ -409,6 +409,27 @@ def Package_Wwise(self): one_param_build.platform = platform OneWwiseCommand.Build(one_param_build) - PrintStageLog("Mac - Package_Wwise Complete") + PrintStageLog("Mac - Package_Wwise Build Complete") + + ## Archive + ## Final Product + for one_config in list_config: + OneArchiveInfo = ArchiveInfo_WwisePlugin( + WPMHelper.Get().GetName_WwisePluginName(), + WPMHelper.Get().GetVer_Wwise(), + SystemHelper.Mac_TargetName(), + one_config + ) + extension = "a" + name_final_product = OneArchiveInfo.GetArchiveName() + "." + extension + path_target_archive_file = WPMHelper.Get().GetPath_WwiseSDKBase() / Path("Mac") / one_config / "lib" / name_final_product + PrintWarn("Src Wwise Final Product [%s]" % path_target_archive_file) + bshould_clean_others_when_archving = False + ArchiveManager.Get().ArchiveBuild(path_target_archive_file,OneArchiveInfo,bshould_clean_others_when_archving,extension) + + PrintStageLog("Mac - Package_Wwise Archive Complete") + + + diff --git a/Platform/Windows.py b/Platform/Windows.py index dbecc0d..490f5f6 100644 --- a/Platform/Windows.py +++ b/Platform/Windows.py @@ -123,3 +123,32 @@ def Package_Wwise(self): one_param.platform = "Windows_" + one_toolset OneWwiseCommand.Build(one_param) + PrintStageLog("Win64 - Package_Wwise Build Complete") + + ## Archive + ## Final Product + for one_config in list_config: + for one_toolset in toolset: + OneArchiveInfo = ArchiveInfo_WwisePlugin( + WPMHelper.Get().GetName_WwisePluginName(), + WPMHelper.Get().GetVer_Wwise(), + SystemHelper.Mac_TargetName(), + one_config, + arch, + one_toolset + ) + extension = "dll" + name_final_product = OneArchiveInfo.GetArchiveName() + "." + extension + path_target_archive_file = WPMHelper.Get().GetPath_WwiseSDKBase() / OneArchiveInfo.GetArchiveSubDirBasedOnInfo() / "bin" / name_final_product + PrintWarn("Src Wwise Final Product [%s]" % path_target_archive_file) + bshould_clean_others_when_archving = False + ArchiveManager.Get().ArchiveBuild(path_target_archive_file,OneArchiveInfo,bshould_clean_others_when_archving,extension) + + extension = "lib" + name_final_product = OneArchiveInfo.GetArchiveName() + "." + extension + path_target_archive_file = WPMHelper.Get().GetPath_WwiseSDKBase() /OneArchiveInfo.GetArchiveSubDirBasedOnInfo() / "bin" / name_final_product + PrintWarn("Src Wwise Final Product [%s]" % path_target_archive_file) + bshould_clean_others_when_archving = False + ArchiveManager.Get().ArchiveBuild(path_target_archive_file,OneArchiveInfo,bshould_clean_others_when_archving,extension) + + PrintStageLog("Win64 - Package_Wwise Archive Complete") \ No newline at end of file diff --git a/Utility/ArchiveManager.py b/Utility/ArchiveManager.py index 84699d3..4f6c862 100644 --- a/Utility/ArchiveManager.py +++ b/Utility/ArchiveManager.py @@ -112,6 +112,51 @@ def GetPath_CurRootArchiveDir(self): def GetArchivePath(self): return self.GetPath_CurRootArchiveDir() + +class ArchiveInfo_WwisePlugin(ArchiveInfoBase): + def __init__(self,PLUGIN_NAME, val_wwisever,val_platform, val_config,val_arch = "",val_toolset = "") -> None: + self.name_plugin = PLUGIN_NAME + self.wwisever = val_wwisever + self.platform = val_platform + self.config = val_config + self.arch = val_arch + self.toolset = val_toolset + + def GetPath_CurRootArchiveDirBase(self): + return Path("Archive_WwisePlugin") + + def GetPath_CurRootArchiveDir(self): + return self.GetPath_CurRootArchiveDirBase()/ self.wwisever / "ThirdParty" + + def GetArchivePath(self): + return self.GetPath_CurRootArchiveDir() / self.GetArchiveSubDirBasedOnInfo() + + def GetArchiveSubDirBasedOnInfo(self): + path = "" + if self.platform == SystemHelper.Win64_TargetName(): + path = Path("Win64") + path = path / ( self.arch + "_" + self.toolset) / self.config + elif self.platform == SystemHelper.Mac_TargetName(): + path = Path("Mac") / self.config + elif self.platform == SystemHelper.IOS_TargetName(): + path = Path("IOS") / (self.config + "-iphoneos") + elif self.platform == SystemHelper.Android_TargetName(): + path = Path("Android") / self.arch / self.config + return path + + def GetArchiveName(self): + name = "" + if self.platform == SystemHelper.Win64_TargetName(): + name = self.name_plugin + elif self.platform == SystemHelper.Mac_TargetName(): + name = "lib" + self.name_plugin + "Source" + elif self.platform == SystemHelper.IOS_TargetName(): + name = "lib" + self.name_plugin + "Source" + elif self.platform == SystemHelper.Android_TargetName(): + name = "lib" + self.name_plugin + + return name + class ArchiveManager: __instance = None diff --git a/WPMHelper.py b/WPMHelper.py index b5da718..bba9729 100644 --- a/WPMHelper.py +++ b/WPMHelper.py @@ -73,6 +73,9 @@ def GetPath_WwiseWPScript(self): def GetPath_WwiseSDKBase(self): return self.GetPath_WwiseBase() / Path("SDK") + def GetVer_Wwise(self): + return self.__Args.wwisever + def GetName_WwisePluginName(self): return self.__Args.wwisepluginname