|
|
@ -13,9 +13,29 @@ import fwgslib |
|
|
|
|
|
|
|
|
|
|
|
VERSION = '0.99' |
|
|
|
VERSION = '0.99' |
|
|
|
APPNAME = 'xash3d-fwgs' |
|
|
|
APPNAME = 'xash3d-fwgs' |
|
|
|
SUBDIRS = [ 'engine', 'game_launch', 'mainui', 'vgui_support' ] |
|
|
|
|
|
|
|
top = '.' |
|
|
|
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): |
|
|
|
def options(opt): |
|
|
|
grp = opt.add_option_group('Common options') |
|
|
|
grp = opt.add_option_group('Common options') |
|
|
|
|
|
|
|
|
|
|
@ -27,6 +47,10 @@ def options(opt): |
|
|
|
'--dedicated', action = 'store_true', dest = 'DEDICATED', default = False, |
|
|
|
'--dedicated', action = 'store_true', dest = 'DEDICATED', default = False, |
|
|
|
help = 'build Xash Dedicated Server(XashDS)') |
|
|
|
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( |
|
|
|
grp.add_option( |
|
|
|
'--64bits', action = 'store_true', dest = 'ALLOW64', default = False, |
|
|
|
'--64bits', action = 'store_true', dest = 'ALLOW64', default = False, |
|
|
|
help = 'allow targetting 64-bit engine') |
|
|
|
help = 'allow targetting 64-bit engine') |
|
|
@ -35,11 +59,29 @@ def options(opt): |
|
|
|
'--win-style-install', action = 'store_true', dest = 'WIN_INSTALL', default = False, |
|
|
|
'--win-style-install', action = 'store_true', dest = 'WIN_INSTALL', default = False, |
|
|
|
help = 'install like Windows build, ignore prefix, useful for development') |
|
|
|
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') |
|
|
|
opt.load('xcompile compiler_cxx compiler_c') |
|
|
|
if sys.platform == 'win32': |
|
|
|
if sys.platform == 'win32': |
|
|
|
opt.load('msvc msvs') |
|
|
|
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): |
|
|
|
def configure(conf): |
|
|
|
conf.start_msg('Build type') |
|
|
|
conf.start_msg('Build type') |
|
|
|
if conf.options.BUILD_TYPE == None: |
|
|
|
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.fatal('Invalid build type. Valid are "debug", "release" or "none"') |
|
|
|
conf.end_msg(conf.options.BUILD_TYPE) |
|
|
|
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 |
|
|
|
# Force XP compability, all build targets should add |
|
|
|
# subsystem=bld.env.MSVC_SUBSYSTEM |
|
|
|
# subsystem=bld.env.MSVC_SUBSYSTEM |
|
|
|
# TODO: wrapper around bld.stlib, bld.shlib and so on? |
|
|
|
# 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)) |
|
|
|
linker_flags, conf.options.BUILD_TYPE, conf.env.COMPILER_CC)) |
|
|
|
|
|
|
|
|
|
|
|
conf.env.DEDICATED = conf.options.DEDICATED |
|
|
|
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': |
|
|
|
if conf.env.DEST_OS == 'linux': |
|
|
|
conf.check_cc( lib='dl' ) |
|
|
|
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')) |
|
|
|
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: |
|
|
|
for i in SUBDIRS: |
|
|
|
conf.setenv(i, conf.env) # derive new env from global one |
|
|
|
if conf.env.SINGLE_BINARY and i.singlebin: |
|
|
|
conf.env.ENVNAME = i |
|
|
|
continue |
|
|
|
conf.msg(msg='--> ' + i, result='in progress', color='BLUE') |
|
|
|
|
|
|
|
|
|
|
|
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 |
|
|
|
# configure in standalone env |
|
|
|
conf.recurse(i) |
|
|
|
conf.recurse(i.name) |
|
|
|
conf.msg(msg='<-- ' + i, result='done', color='BLUE') |
|
|
|
conf.msg(msg='<-- ' + i.name, result='done', color='BLUE') |
|
|
|
conf.setenv('') |
|
|
|
conf.setenv('') |
|
|
|
|
|
|
|
|
|
|
|
def build(bld): |
|
|
|
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) |
|
|
|