wscript: use ConfigurationContext.define instead of appending to env['DEFINES']

This commit is contained in:
Alibek Omarov 2019-10-11 03:10:08 +03:00
parent a5fa4df37c
commit 8889bda261
6 changed files with 17 additions and 35 deletions

View File

@ -22,7 +22,7 @@ def configure(conf):
if conf.options.DEDICATED: if conf.options.DEDICATED:
if conf.env.DEST_OS == 'linux': if conf.env.DEST_OS == 'linux':
conf.check_cc( lib='rt' ) conf.check_cc( lib='rt' )
conf.env.append_unique('DEFINES', 'XASH_DEDICATED=1') conf.define('XASH_DEDICATED', 1)
elif conf.env.DEST_OS == 'android': # Android doesn't need SDL2 elif conf.env.DEST_OS == 'android': # Android doesn't need SDL2
for i in ['android', 'log', 'EGL']: for i in ['android', 'log', 'EGL']:
conf.check_cc(lib = i) conf.check_cc(lib = i)
@ -30,26 +30,17 @@ def configure(conf):
conf.load('sdl2') conf.load('sdl2')
if not conf.env.HAVE_SDL2: if not conf.env.HAVE_SDL2:
conf.fatal('SDL2 not availiable! If you want to build dedicated server, specify --dedicated') conf.fatal('SDL2 not availiable! If you want to build dedicated server, specify --dedicated')
conf.env.append_unique('DEFINES', 'XASH_SDL') conf.define('XASH_SDL', 1)
if conf.env.SINGLE_BINARY:
conf.env.append_unique('DEFINES', 'SINGLE_BINARY')
if conf.options.USE_SELECT == None: if conf.options.USE_SELECT == None:
conf.options.USE_SELECT = conf.options.DEDICATED conf.options.USE_SELECT = conf.options.DEDICATED
if conf.options.USE_SELECT: conf.define_cond('SINGLE_BINARY', conf.env.SINGLE_BINARY)
conf.env.append_unique('DEFINES', 'XASH_USE_SELECT') conf.define_cond('XASH_USE_SELECT', conf.options.USE_SELECT)
conf.define_cond('SUPPORT_BSP2_FORMAT', conf.options.SUPPORT_BSP2_FORMAT)
if conf.options.SUPPORT_BSP2_FORMAT: conf.define_cond('XASH_64BIT', conf.env.DEST_SIZEOF_VOID_P != 4)
conf.env.append_unique('DEFINES', 'SUPPORT_BSP2_FORMAT') conf.define_cond('DBGHELP', conf.env.DEST_OS == 'win32')
conf.define_cond('PSAPI_VERSION', conf.env.DEST_OS == 'win32') # will be defined as 1
if conf.env.DEST_OS == 'win32':
conf.env.append_unique('DEFINES', 'DBGHELP')
conf.env.append_unique('DEFINES', 'PSAPI_VERSION=1')
if conf.env.DEST_SIZEOF_VOID_P != 4:
conf.env.append_unique('DEFINES', 'XASH_64BIT')
def build(bld): def build(bld):
libs = [ 'public' ] libs = [ 'public' ]

2
mainui

@ -1 +1 @@
Subproject commit 78467eb7e4fd4e24a75d2115e94d0f7567cfed85 Subproject commit c95b7e59be219dc1acb4ec95fd6fc2b75f4393ab

@ -1 +1 @@
Subproject commit c5d2f80ad936d30d3c0503a21df7467ce9c87779 Subproject commit 73b552c67a44cf055321ef08dd26cc0ac23f585f

@ -1 +1 @@
Subproject commit 00f19060368987077d5936425e5b233b1d500ad6 Subproject commit b5a056408b1fdf8e8c33c7cf988d7ba8f280d290

View File

@ -18,7 +18,7 @@ def options(opt):
grp.add_option('--enable-gles2', action='store_true', dest='GLWES', grp.add_option('--enable-gles2', action='store_true', dest='GLWES',
help = 'enable gles2 renderer by linking gl-wes-v2 statically(put source to ref_gl directory)') help = 'enable gles2 renderer by linking gl-wes-v2 statically(put source to ref_gl directory)')
grp.add_option('--disable-gl', action='store_false', dest='GL', default=True, grp.add_option('--disable-gl', action='store_false', dest='GL', default=True,
help = 'disable building OpenGL renderer(default: False)') help = 'disable building OpenGL renderer(default: False)')
@ -30,8 +30,7 @@ def configure(conf):
if conf.options.DEDICATED: if conf.options.DEDICATED:
return return
if conf.options.SUPPORT_BSP2_FORMAT: conf.define_cond('SUPPORT_BSP2_FORMAT', conf.options.SUPPORT_BSP2_FORMAT)
conf.env.append_unique('DEFINES', 'SUPPORT_BSP2_FORMAT')
conf.env.NANOGL = conf.options.NANOGL conf.env.NANOGL = conf.options.NANOGL
conf.env.GLWES = conf.options.GLWES conf.env.GLWES = conf.options.GLWES
@ -46,7 +45,7 @@ def configure(conf):
if conf.env.GL_STATIC: if conf.env.GL_STATIC:
conf.check( lib='GL' ) conf.check( lib='GL' )
conf.env.append_unique('DEFINES', 'REF_DLL') conf.define('REF_DLL', 1)
if conf.env.DEST_OS2 == 'android': if conf.env.DEST_OS2 == 'android':
conf.check_cc(lib='log') conf.check_cc(lib='log')
@ -64,22 +63,14 @@ def build(bld):
'../common', '../common',
'../pm_shared' ] '../pm_shared' ]
def link_gl( glstatic ):
if glstatic: return ['GL']
else: return []
def static_gl( glstatic ):
if glstatic: return ['XASH_GL_STATIC']
else: return []
if bld.env.GL: if bld.env.GL:
bld.shlib( bld.shlib(
source = source, source = source,
target = 'ref_gl', target = 'ref_gl',
features = 'c', features = 'c',
includes = includes, includes = includes,
use = libs + link_gl(bld.env.GL_STATIC), use = libs + ['GL'] if bld.env.GL_STATIC else [],
defines = static_gl(bld.env.GL_STATIC), defines = ['XASH_GL_STATIC'] if bld.env.GL_STATIC else [],
install_path = bld.env.LIBDIR, install_path = bld.env.LIBDIR,
subsystem = bld.env.MSVC_SUBSYSTEM subsystem = bld.env.MSVC_SUBSYSTEM
) )

View File

@ -265,7 +265,7 @@ def configure(conf):
else: else:
conf.env.LIBDIR = conf.env.BINDIR = conf.env.PREFIX conf.env.LIBDIR = conf.env.BINDIR = conf.env.PREFIX
conf.env.append_unique('DEFINES', 'XASH_BUILD_COMMIT="{0}"'.format(conf.env.GIT_VERSION if conf.env.GIT_VERSION else 'notset')) conf.define('XASH_BUILD_COMMIT', conf.env.GIT_VERSION if conf.env.GIT_VERSION else 'notset')
for i in SUBDIRS: for i in SUBDIRS:
if conf.env.SINGLE_BINARY and i.singlebin: if conf.env.SINGLE_BINARY and i.singlebin: