From 8889bda26147a28d48b8b94673337e35faf647ff Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Fri, 11 Oct 2019 03:10:08 +0300 Subject: [PATCH] wscript: use ConfigurationContext.define instead of appending to env['DEFINES'] --- engine/wscript | 25 ++++++++----------------- mainui | 2 +- ref_gl/gl-wes-v2 | 2 +- ref_gl/nanogl | 2 +- ref_gl/wscript | 19 +++++-------------- wscript | 2 +- 6 files changed, 17 insertions(+), 35 deletions(-) diff --git a/engine/wscript b/engine/wscript index 53f5875b..53f1ece5 100644 --- a/engine/wscript +++ b/engine/wscript @@ -22,7 +22,7 @@ def configure(conf): if conf.options.DEDICATED: if conf.env.DEST_OS == 'linux': 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 for i in ['android', 'log', 'EGL']: conf.check_cc(lib = i) @@ -30,26 +30,17 @@ def configure(conf): conf.load('sdl2') if not conf.env.HAVE_SDL2: conf.fatal('SDL2 not availiable! If you want to build dedicated server, specify --dedicated') - conf.env.append_unique('DEFINES', 'XASH_SDL') - - if conf.env.SINGLE_BINARY: - conf.env.append_unique('DEFINES', 'SINGLE_BINARY') + conf.define('XASH_SDL', 1) if conf.options.USE_SELECT == None: conf.options.USE_SELECT = conf.options.DEDICATED - if conf.options.USE_SELECT: - conf.env.append_unique('DEFINES', 'XASH_USE_SELECT') - - if conf.options.SUPPORT_BSP2_FORMAT: - conf.env.append_unique('DEFINES', 'SUPPORT_BSP2_FORMAT') - - 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') + conf.define_cond('SINGLE_BINARY', conf.env.SINGLE_BINARY) + conf.define_cond('XASH_USE_SELECT', conf.options.USE_SELECT) + conf.define_cond('SUPPORT_BSP2_FORMAT', conf.options.SUPPORT_BSP2_FORMAT) + conf.define_cond('XASH_64BIT', conf.env.DEST_SIZEOF_VOID_P != 4) + conf.define_cond('DBGHELP', conf.env.DEST_OS == 'win32') + conf.define_cond('PSAPI_VERSION', conf.env.DEST_OS == 'win32') # will be defined as 1 def build(bld): libs = [ 'public' ] diff --git a/mainui b/mainui index 78467eb7..c95b7e59 160000 --- a/mainui +++ b/mainui @@ -1 +1 @@ -Subproject commit 78467eb7e4fd4e24a75d2115e94d0f7567cfed85 +Subproject commit c95b7e59be219dc1acb4ec95fd6fc2b75f4393ab diff --git a/ref_gl/gl-wes-v2 b/ref_gl/gl-wes-v2 index c5d2f80a..73b552c6 160000 --- a/ref_gl/gl-wes-v2 +++ b/ref_gl/gl-wes-v2 @@ -1 +1 @@ -Subproject commit c5d2f80ad936d30d3c0503a21df7467ce9c87779 +Subproject commit 73b552c67a44cf055321ef08dd26cc0ac23f585f diff --git a/ref_gl/nanogl b/ref_gl/nanogl index 00f19060..b5a05640 160000 --- a/ref_gl/nanogl +++ b/ref_gl/nanogl @@ -1 +1 @@ -Subproject commit 00f19060368987077d5936425e5b233b1d500ad6 +Subproject commit b5a056408b1fdf8e8c33c7cf988d7ba8f280d290 diff --git a/ref_gl/wscript b/ref_gl/wscript index f1a2468b..b9697b37 100644 --- a/ref_gl/wscript +++ b/ref_gl/wscript @@ -18,7 +18,7 @@ def options(opt): 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)') - + grp.add_option('--disable-gl', action='store_false', dest='GL', default=True, help = 'disable building OpenGL renderer(default: False)') @@ -30,8 +30,7 @@ def configure(conf): if conf.options.DEDICATED: return - if conf.options.SUPPORT_BSP2_FORMAT: - conf.env.append_unique('DEFINES', 'SUPPORT_BSP2_FORMAT') + conf.define_cond('SUPPORT_BSP2_FORMAT', conf.options.SUPPORT_BSP2_FORMAT) conf.env.NANOGL = conf.options.NANOGL conf.env.GLWES = conf.options.GLWES @@ -46,7 +45,7 @@ def configure(conf): if conf.env.GL_STATIC: conf.check( lib='GL' ) - conf.env.append_unique('DEFINES', 'REF_DLL') + conf.define('REF_DLL', 1) if conf.env.DEST_OS2 == 'android': conf.check_cc(lib='log') @@ -64,22 +63,14 @@ def build(bld): '../common', '../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: bld.shlib( source = source, target = 'ref_gl', features = 'c', includes = includes, - use = libs + link_gl(bld.env.GL_STATIC), - defines = static_gl(bld.env.GL_STATIC), + use = libs + ['GL'] if bld.env.GL_STATIC else [], + defines = ['XASH_GL_STATIC'] if bld.env.GL_STATIC else [], install_path = bld.env.LIBDIR, subsystem = bld.env.MSVC_SUBSYSTEM ) diff --git a/wscript b/wscript index cc2e2dd7..89f745a5 100644 --- a/wscript +++ b/wscript @@ -265,7 +265,7 @@ def configure(conf): else: 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: if conf.env.SINGLE_BINARY and i.singlebin: