mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-22 01:45:19 +01:00
wscript: check for dedicated or singlebinary before recurse into subdirectory, add a chance to skip some subprojects on configuration stage
This commit is contained in:
parent
1b372115a5
commit
2c17dce25b
@ -14,10 +14,6 @@ def options(opt):
|
||||
'--enable-bsp2', action = 'store_true', dest = 'SUPPORT_BSP2_FORMAT', default = False,
|
||||
help = 'build engine with BSP2 map support(recommended for Quake, breaks compatibility!)')
|
||||
|
||||
grp.add_option(
|
||||
'--single-binary', action = 'store_true', dest = 'SINGLE_BINARY', default = None,
|
||||
help = 'build single "xash" binary instead of xash.dll/libxash.so (default for dedicated)')
|
||||
|
||||
grp.add_option(
|
||||
'--stdin-input', action = 'store_true', dest = 'USE_SELECT', default = None,
|
||||
help = 'enable console input from stdin (default for dedicated)')
|
||||
@ -38,10 +34,7 @@ def configure(conf):
|
||||
conf.fatal('SDL2 not availiable! If you want to build dedicated server, specify --dedicated')
|
||||
conf.env.append_unique('DEFINES', 'XASH_SDL')
|
||||
|
||||
if conf.options.SINGLE_BINARY == None:
|
||||
conf.options.SINGLE_BINARY = conf.options.DEDICATED # We don't need game launcher on dedicated
|
||||
conf.env.SINGLE_BINARY = conf.options.SINGLE_BINARY
|
||||
if conf.options.SINGLE_BINARY:
|
||||
if conf.env.SINGLE_BINARY:
|
||||
conf.env.append_unique('DEFINES', 'SINGLE_BINARY')
|
||||
|
||||
if conf.options.USE_SELECT == None:
|
||||
|
@ -10,22 +10,13 @@ from fwgslib import get_subproject_name
|
||||
top = '.'
|
||||
|
||||
def options(opt):
|
||||
# stub
|
||||
return
|
||||
|
||||
def configure(conf):
|
||||
if conf.env.SINGLE_BINARY:
|
||||
return
|
||||
|
||||
# check for dedicated server build
|
||||
if not conf.env.DEDICATED:
|
||||
if conf.env.DEST_OS == 'win32':
|
||||
conf.load('winres')
|
||||
if conf.env.DEST_OS == 'win32':
|
||||
conf.load('winres')
|
||||
|
||||
def build(bld):
|
||||
if bld.env.SINGLE_BINARY:
|
||||
return
|
||||
|
||||
bld.load_envs()
|
||||
bld.env = bld.all_envs[get_subproject_name(bld)]
|
||||
|
||||
|
2
mainui
2
mainui
@ -1 +1 @@
|
||||
Subproject commit 33e6e585e875d91ae44b22d5425f1c38f2413741
|
||||
Subproject commit 9acf8b75d9d167ac63efd6db8f35c42a2d325082
|
@ -25,7 +25,7 @@ def options(opt):
|
||||
|
||||
def configure(conf):
|
||||
conf.env.NO_VGUI = conf.options.NO_VGUI
|
||||
if conf.options.DEDICATED or conf.options.NO_VGUI:
|
||||
if conf.options.NO_VGUI:
|
||||
return
|
||||
|
||||
conf.start_msg('Configuring VGUI by provided path')
|
||||
@ -74,7 +74,7 @@ def build(bld):
|
||||
bld.load_envs()
|
||||
bld.env = bld.all_envs[get_subproject_name(bld)]
|
||||
|
||||
if bld.env.DEDICATED or bld.env.NO_VGUI:
|
||||
if bld.env.NO_VGUI:
|
||||
return
|
||||
|
||||
libs = []
|
||||
|
84
wscript
84
wscript
@ -13,9 +13,29 @@ import fwgslib
|
||||
|
||||
VERSION = '0.99'
|
||||
APPNAME = 'xash3d-fwgs'
|
||||
SUBDIRS = [ 'engine', 'game_launch', 'mainui', 'vgui_support' ]
|
||||
top = '.'
|
||||
|
||||
class Subproject:
|
||||
name = ''
|
||||
dedicated = True # if true will be ignored when building dedicated server
|
||||
singlebin = False # if true will be ignored when singlebinary is set
|
||||
ignore = False # if true will be ignored, set by user request
|
||||
|
||||
def __init__(self, name, dedicated=True, singlebin=False):
|
||||
self.name = name
|
||||
self.dedicated = dedicated
|
||||
self.singlebin = singlebin
|
||||
|
||||
SUBDIRS = [
|
||||
Subproject('engine', dedicated=False),
|
||||
Subproject('game_launch', singlebin=True),
|
||||
Subproject('mainui'),
|
||||
Subproject('vgui_support'),
|
||||
]
|
||||
|
||||
def subdirs():
|
||||
return map(lambda x: x.name, SUBDIRS)
|
||||
|
||||
def options(opt):
|
||||
grp = opt.add_option_group('Common options')
|
||||
|
||||
@ -27,6 +47,10 @@ def options(opt):
|
||||
'--dedicated', action = 'store_true', dest = 'DEDICATED', default = False,
|
||||
help = 'build Xash Dedicated Server(XashDS)')
|
||||
|
||||
grp.add_option(
|
||||
'--single-binary', action = 'store_true', dest = 'SINGLE_BINARY', default = False,
|
||||
help = 'build single "xash" binary instead of xash.dll/libxash.so (forced for dedicated)')
|
||||
|
||||
grp.add_option(
|
||||
'--64bits', action = 'store_true', dest = 'ALLOW64', default = False,
|
||||
help = 'allow targetting 64-bit engine')
|
||||
@ -35,11 +59,29 @@ def options(opt):
|
||||
'--win-style-install', action = 'store_true', dest = 'WIN_INSTALL', default = False,
|
||||
help = 'install like Windows build, ignore prefix, useful for development')
|
||||
|
||||
opt.recurse(SUBDIRS)
|
||||
grp.add_option(
|
||||
'--skip-subprojects', action='store', type = 'string', dest = 'SKIP_SUBDIRS', default=None,
|
||||
help = 'don\'t recurse into specified subprojects. Current subdirs: ' + str(subdirs()))
|
||||
|
||||
for i in SUBDIRS:
|
||||
if not os.path.isfile(os.path.join(i.name, 'wscript')):
|
||||
# HACKHACK: this way we get warning message right in the help
|
||||
# so this just becomes more noticeable
|
||||
opt.add_option_group('Cannot find wscript in ' + i.name + '. You probably missed submodule update')
|
||||
else: opt.recurse(i.name)
|
||||
|
||||
opt.load('xcompile compiler_cxx compiler_c')
|
||||
if sys.platform == 'win32':
|
||||
opt.load('msvc msvs')
|
||||
|
||||
def set_ignored_subdirs(subdirs):
|
||||
for i in SUBDIRS:
|
||||
if i.ignore:
|
||||
continue
|
||||
|
||||
if i.name in subdirs:
|
||||
i.ignore = True
|
||||
|
||||
def configure(conf):
|
||||
conf.start_msg('Build type')
|
||||
if conf.options.BUILD_TYPE == None:
|
||||
@ -50,6 +92,11 @@ def configure(conf):
|
||||
conf.fatal('Invalid build type. Valid are "debug", "release" or "none"')
|
||||
conf.end_msg(conf.options.BUILD_TYPE)
|
||||
|
||||
# skip some subdirectories, if requested
|
||||
if conf.options.SKIP_SUBDIRS:
|
||||
skip_subdirs = conf.options.SKIP_SUBDIRS.split(',')
|
||||
set_ignored_subdirs(skip_subdirs)
|
||||
|
||||
# Force XP compability, all build targets should add
|
||||
# subsystem=bld.env.MSVC_SUBSYSTEM
|
||||
# TODO: wrapper around bld.stlib, bld.shlib and so on?
|
||||
@ -101,6 +148,8 @@ def configure(conf):
|
||||
linker_flags, conf.options.BUILD_TYPE, conf.env.COMPILER_CC))
|
||||
|
||||
conf.env.DEDICATED = conf.options.DEDICATED
|
||||
# we don't need game launcher on dedicated
|
||||
conf.env.SINGLE_BINARY = conf.options.SINGLE_BINARY or conf.env.DEDICATED
|
||||
if conf.env.DEST_OS == 'linux':
|
||||
conf.check_cc( lib='dl' )
|
||||
|
||||
@ -132,13 +181,32 @@ def configure(conf):
|
||||
conf.env.append_unique('DEFINES', 'XASH_BUILD_COMMIT="{0}"'.format(conf.env.GIT_VERSION if conf.env.GIT_VERSION else 'notset'))
|
||||
|
||||
for i in SUBDIRS:
|
||||
conf.setenv(i, conf.env) # derive new env from global one
|
||||
conf.env.ENVNAME = i
|
||||
conf.msg(msg='--> ' + i, result='in progress', color='BLUE')
|
||||
if conf.env.SINGLE_BINARY and i.singlebin:
|
||||
continue
|
||||
|
||||
if conf.env.DEDICATED and not i.dedicated:
|
||||
continue
|
||||
|
||||
if i.ignore:
|
||||
continue
|
||||
|
||||
conf.setenv(i.name, conf.env) # derive new env from global one
|
||||
conf.env.ENVNAME = i.name
|
||||
conf.msg(msg='--> ' + i.name, result='in progress', color='BLUE')
|
||||
# configure in standalone env
|
||||
conf.recurse(i)
|
||||
conf.msg(msg='<-- ' + i, result='done', color='BLUE')
|
||||
conf.recurse(i.name)
|
||||
conf.msg(msg='<-- ' + i.name, result='done', color='BLUE')
|
||||
conf.setenv('')
|
||||
|
||||
def build(bld):
|
||||
bld.recurse(SUBDIRS)
|
||||
for i in SUBDIRS:
|
||||
if bld.env.SINGLE_BINARY and i.singlebin:
|
||||
continue
|
||||
|
||||
if bld.env.DEDICATED and not i.dedicated:
|
||||
continue
|
||||
|
||||
if i.ignore:
|
||||
continue
|
||||
|
||||
bld.recurse(i.name)
|
||||
|
Loading…
Reference in New Issue
Block a user