Skip to content

Commit

Permalink
Add WwiseModule
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterPu committed Dec 11, 2024
1 parent 6d6ec32 commit 3ca9ed3
Showing 7 changed files with 342 additions and 1 deletion.
102 changes: 102 additions & 0 deletions Command/WwiseCommand.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
from Command.CommandBase import *
from pathlib import Path


class ParamsWwise:
def __init__(self) -> None:
self.__path_wp = ""

@property
def get_path_wp(self):
return self.__path_wp
@get_path_wp.setter
def path_wp(self,val):
self.__path_wp = val


class ParamsWwisePluginBuild:
def __init__(self) -> None:
self.__path_wp = ""

@property
def get_path_wp(self):
return self.__path_wp
@get_path_wp.setter
def path_wp(self,val):
self.__path_wp = val

@property
def get_configuration(self):
return self.__configuration

@get_configuration.setter
def config(self,val):
self.__configuration = val

@property
def get_platform(self):
return self.__platform

@get_platform.setter
def platform(self,val):
self.__platform = val

@property
def get_architecture(self):
return self.__architecture

@get_architecture.setter
def arch(self,val):
self.__architecture = val

@property
def get_toolset(self):
return self.__toolset

@get_toolset.setter
def toolset(self,val):
self.__toolset = val

@property
def get_subcommand(self):
subcommand = ""

if self.__configuration != "":
subcommand += " -c " + self.__configuration
if self.__architecture != "":
subcommand += " -x " + self.__architecture
if self.__toolset != "":
subcommand += " -t " + self.__toolset
if self.__platform != "":
subcommand += " " + self.__platform

return subcommand


class WwiseCommand:

def Premake(self,params:ParamsWwise):
path_wp = params.get_path_wp
default = "Authoring"
command = (
'" python ' + str(path_wp) + '"' + " premake"
)
RUNCMD(command)

def Build(self,params:ParamsWwisePluginBuild):
path_wp = params.get_path_wp
subcommand = params.get_subcommand
command = (
'" python ' + str(path_wp) + '"' + " build " + subcommand
)
RUNCMD(command)

pass

# ```
# python "C:\Program Files (x86)\Audiokinetic\Wwise 2023.1.6.8555\Scripts\Build\Plugins\wp.py" build -c Profile -x x64 -t vc160 Windows_vc160
# ```

# ```
# python "C:\Program Files (x86)\Audiokinetic\Wwise 2023.1.6.8555\Scripts\Build\Plugins\wp.py" build -c Debug -x arm64-v8a Android
# ```
26 changes: 25 additions & 1 deletion Platform/Windows.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from Platform.PlatformBase import *
from Command.UBTCommand import *
from Command.WwiseCommand import *
from pathlib import Path

from UBSHelper import *
@@ -84,4 +85,27 @@ def PostPackaged(self):

path_archive_dir = UBSHelper.Get().GetPath_ArchiveDir(self.GetTargetPlatform())
self.SetArchivePath_FinalProductDir(path_archive_dir)






#####################################################################################
#################################### Wwise ##########################################
def Package_Wwise(self):
list_config = ["Debug","Profile","Release"]
arch = "x64"
toolset = ["vc_160","vc170"]

OneWwiseCommand = WwiseCommand()

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

for one_toolset in toolset:
one_param.toolset = one_toolset
one_param.platform = "Windows_" + one_toolset
OneWwiseCommand.Build(one_param)

7 changes: 7 additions & 0 deletions SystemHelper.py
Original file line number Diff line number Diff line change
@@ -22,6 +22,13 @@ def GetHostPlatform(self):
else:
PrintErr("HostPlatform [%s] currently is not supported" %(str(ossystem)))
return "NotSupportPlatform"


def GetTargetPlatform_BasedOnHostPlatform(self):
platform = self.GetHostPlatform()
if platform == SystemHelper.Win_HostName():
platform = SystemHelper.Win64_TargetName()
return platform

## Host Platforms
def Win_HostName():
24 changes: 24 additions & 0 deletions Template/_template_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class _template_helper:
__instance = None
__initialized = False

def __new__(cls, *args, **kwargs):
if not cls.__instance:
cls.__instance = super().__new__(cls, *args, **kwargs)
cls.__instance.__initialized = False
return cls.__instance

def __init__(self) -> None:
if not self.__initialized:
super().__init__()

## Init

self.__initialized = True


def Get():
return _template_helper()

def Init(self):
pass
52 changes: 52 additions & 0 deletions Template/_template_manager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from Utility.HeaderBase import *
import argparse

class _template_mananger_():
__instance = None
__initialized = False

def __new__(cls, *args, **kwargs):
if not cls.__instance:
cls.__instance = super().__new__(cls, *args, **kwargs)
cls.__instance.__initialized = False
return cls.__instance

def __init__(self) -> None:
if not self.__initialized:
super().__init__()
self.__initialized = True

def Get():
return _template_mananger_()


def ParseCMDArgs(self):
ArgParser = argparse.ArgumentParser(description="Parse _template_mananger_ Args")

self.AddArgsToParser(ArgParser)

Args = ArgParser.parse_args()

PrintLog(Args)
return Args

def AddArgsToParser(self,ArgParser, bIncludeConflictArgs = True):
ArgParser.add_argument('-wwisever',default="2024.1.0.8669")
if bIncludeConflictArgs:
pass

def Init(self):
PrintStageLog("_template_mananger_ Init")

def Start(self):
_template_mananger_.Get().Init()
args = self.ParseCMDArgs()
self.CreateTask(args)

def CreateTask(self,Args):
pass



if __name__ == '__main__':
_template_mananger_.Get().Start()
72 changes: 72 additions & 0 deletions WPM.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
from Utility.HeaderBase import *
import argparse
from WPMHelper import *

class WwisePluginManager():
__instance = None
__initialized = False

def __new__(cls, *args, **kwargs):
if not cls.__instance:
cls.__instance = super().__new__(cls, *args, **kwargs)
cls.__instance.__initialized = False
return cls.__instance

def __init__(self) -> None:
if not self.__initialized:
super().__init__()
self.__initialized = True

def Get():
return WwisePluginManager()


def ParseCMDArgs(self):
ArgParser = argparse.ArgumentParser(description="Parse Wwise Plugin Manager Args")

self.AddArgsToParser(ArgParser)

Args = ArgParser.parse_args()

PrintLog(Args)
return Args

def AddArgsToParser(self,ArgParser, bIncludeConflictArgs = True):
default_targetsystem = self.GetHostPlatform()
if default_targetsystem == SystemHelper.Win_HostName():
default_targetsystem = SystemHelper.Win64_TargetName()

ArgParser.add_argument('-wwisever',default="2021.1.14.8108")
ArgParser.add_argument('-pathwwisebase',default="")
ArgParser.add_argument('-wpprojectpath',default="")
if bIncludeConflictArgs:
ArgParser.add_argument("-targetplatform", default=SystemHelper.Get().GetTargetPlatform_BasedOnHostPlatform())

def Init(self):
PrintStageLog("WwisePluginManager Init")

def Start(self):
WwisePluginManager.Get().Init()
args = self.ParseCMDArgs()
WPMHelper.Get().Init(args)
self.CreateTask(args)

def CreateTask(self):
self.BuildWwisePlugin()


def BuildWwisePlugin(self):
Args = WPMHelper.Get().GetArgs()
type_hostplatform = SystemHelper.Get().GetHostPlatform()
ret_host,host_platform = CreateHostPlatform(type_hostplatform,Args)
target_platform_type_list = ParsePlatformArg(Args.targetplatform)
for target_platform_type in target_platform_type_list:
ret_target,target_platform = CreateTargetPlatform(host_platform,target_platform_type,Args)
if ret_target == True:
target_platform.Package_Wwwise()
else:
PrintErr("Invalid TargetPlatform Creation")


if __name__ == '__main__':
WwisePluginManager.Get().Start()
60 changes: 60 additions & 0 deletions WPMHelper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from SystemHelper import *
from pathlib import Path
class WPMHelper:
__instance = None
__initialized = False
__Args = None

def __new__(cls, *args, **kwargs):
if not cls.__instance:
cls.__instance = super().__new__(cls, *args, **kwargs)
cls.__instance.__initialized = False
return cls.__instance

def __init__(self) -> None:
if not self.__initialized:
super().__init__()

## Init

self.__initialized = True


def Get():
return WPMHelper()

def Init(self,Args):
self.__Args = Args


def GetArgs(self):
return self.__Args


def GetPath_WwiseBase(self):
path_wwise_base = self.__Args.pathwwisebase
if path_wwise_base == "":
if SystemHelper.GetHostPlatform() == SystemHelper.Mac_HostName():
path_wwise_base = Path("/Applications/Audiokinetic")

elif SystemHelper.GetHostPlatform() == SystemHelper.Win_HostName():
path_wwise_base = Path("C:\Program Files (x86)\Audiokinetic")

ver_wwise = self.__Args.wwisever

path_wwise_ver = str("Wwise") + str(ver_wwise)

path_wwise_base = path_wwise_base / path_wwise_ver

return path_wwise_base


def GetPath_WwiseWPScript(self):
return self.GetPath_WwiseBase() / Path("Scripts/Build/Plugins/wp.py")


def GetPath_WwiseSDKBase(self):
return self.GetPath_WwiseBase() / Path("SDK")



0 comments on commit 3ca9ed3

Please sign in to comment.