mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2025-02-01 04:10:40 +00:00
build script: extract cmake output target class
This commit is contained in:
parent
f28319bf43
commit
29cb712b50
1 changed files with 31 additions and 19 deletions
50
build.py
50
build.py
|
@ -421,14 +421,36 @@ class CMakeStaticDependencyTarget(CMakeTarget):
|
|||
self.install(builder)
|
||||
|
||||
|
||||
class ZDoomBaseTarget(CMakeTarget):
|
||||
class CMakeOutputTarget(CMakeTarget):
|
||||
def __init__(self, name=None):
|
||||
super().__init__(name)
|
||||
self.outputs = (self.name + '.app',)
|
||||
|
||||
def initialize(self, builder: 'Builder'):
|
||||
super().initialize(builder)
|
||||
self.prefix = builder.output_path + self.name
|
||||
|
||||
def post_build(self, builder: 'Builder'):
|
||||
if builder.xcode:
|
||||
return
|
||||
|
||||
if os.path.exists(self.prefix):
|
||||
shutil.rmtree(self.prefix)
|
||||
|
||||
os.makedirs(self.prefix)
|
||||
|
||||
for output in self.outputs:
|
||||
src = builder.build_path + output
|
||||
dst = self.prefix + os.sep + output
|
||||
|
||||
copy_func = shutil.copytree if os.path.isdir(src) else shutil.copy
|
||||
copy_func(src, dst)
|
||||
|
||||
|
||||
class ZDoomBaseTarget(CMakeOutputTarget):
|
||||
def __init__(self, name=None):
|
||||
super().__init__(name)
|
||||
|
||||
def configure(self, builder: 'Builder'):
|
||||
opts = self.options
|
||||
opts['CMAKE_EXE_LINKER_FLAGS'] = builder.run_pkg_config('--libs', 'fluidsynth', 'libmpg123')
|
||||
|
@ -444,18 +466,6 @@ class ZDoomBaseTarget(CMakeTarget):
|
|||
|
||||
super().configure(builder)
|
||||
|
||||
def post_build(self, builder: 'Builder'):
|
||||
if builder.xcode:
|
||||
return
|
||||
|
||||
if os.path.exists(self.prefix):
|
||||
shutil.rmtree(self.prefix)
|
||||
|
||||
os.makedirs(self.prefix)
|
||||
|
||||
bundle_name = self.name + '.app'
|
||||
shutil.copytree(builder.build_path + bundle_name, self.prefix + os.sep + bundle_name)
|
||||
|
||||
|
||||
class GZDoomTarget(ZDoomBaseTarget):
|
||||
def __init__(self, name='gzdoom'):
|
||||
|
@ -518,18 +528,20 @@ class RazeTarget(ZDoomBaseTarget):
|
|||
builder.checkout_git('https://github.com/coelckers/Raze.git')
|
||||
|
||||
|
||||
class AccTarget(CMakeTarget):
|
||||
class AccTarget(CMakeOutputTarget):
|
||||
def __init__(self, name='acc'):
|
||||
super().__init__(name)
|
||||
self.outputs = ('acc',)
|
||||
|
||||
def prepare_source(self, builder: 'Builder'):
|
||||
builder.checkout_git('https://github.com/rheit/acc.git')
|
||||
|
||||
|
||||
class PrBoomPlusTarget(CMakeTarget):
|
||||
class PrBoomPlusTarget(CMakeOutputTarget):
|
||||
def __init__(self, name='prboom-plus'):
|
||||
super().__init__(name)
|
||||
self.src_root = 'prboom2'
|
||||
self.outputs = ('Launcher.app',)
|
||||
|
||||
def prepare_source(self, builder: 'Builder'):
|
||||
builder.checkout_git('https://github.com/coelckers/prboom-plus.git')
|
||||
|
@ -543,7 +555,7 @@ class PrBoomPlusTarget(CMakeTarget):
|
|||
super().configure(builder)
|
||||
|
||||
|
||||
class ChocolateDoomTarget(CMakeTarget):
|
||||
class ChocolateDoomTarget(CMakeOutputTarget):
|
||||
def __init__(self, name='chocolate-doom'):
|
||||
super().__init__(name)
|
||||
|
||||
|
@ -564,7 +576,7 @@ class CrispyDoomTarget(ChocolateDoomTarget):
|
|||
builder.checkout_git('https://github.com/fabiangreffrath/crispy-doom.git')
|
||||
|
||||
|
||||
class DoomRetroTarget(CMakeTarget):
|
||||
class DoomRetroTarget(CMakeOutputTarget):
|
||||
def __init__(self, name='doomretro'):
|
||||
super().__init__(name)
|
||||
|
||||
|
@ -572,7 +584,7 @@ class DoomRetroTarget(CMakeTarget):
|
|||
builder.checkout_git('https://github.com/bradharding/doomretro.git')
|
||||
|
||||
|
||||
class Doom64EXTarget(CMakeTarget):
|
||||
class Doom64EXTarget(CMakeOutputTarget):
|
||||
def __init__(self, name='doom64ex'):
|
||||
super().__init__(name)
|
||||
|
||||
|
@ -587,7 +599,7 @@ class Doom64EXTarget(CMakeTarget):
|
|||
super().configure(builder)
|
||||
|
||||
|
||||
class DevilutionXTarget(CMakeTarget):
|
||||
class DevilutionXTarget(CMakeOutputTarget):
|
||||
def __init__(self, name='devilutionx'):
|
||||
super().__init__(name)
|
||||
|
||||
|
|
Loading…
Reference in a new issue