Browse Source

wscript: adapt main and ref_gl wscripts to new directory layout, add flag to build all renderers at once

pull/2/head
Alibek Omarov 2 years ago
parent
commit
b1e2e84a11
  1. 107
      ref/gl/wscript
  2. 36
      wscript

107
ref/gl/wscript

@ -13,18 +13,6 @@ def options(opt):
grp.add_option('--enable-static-gl', action='store_true', dest='GL_STATIC', default=False, grp.add_option('--enable-static-gl', action='store_true', dest='GL_STATIC', default=False,
help = 'enable direct linking to opengl [default: %default]') help = 'enable direct linking to opengl [default: %default]')
grp.add_option('--enable-gles1', action='store_true', dest='NANOGL', default=False,
help = 'enable gles1 renderer [default: %default]')
grp.add_option('--enable-gles2', action='store_true', dest='GLWES', default=False,
help = 'enable gles2 renderer [default: %default]')
grp.add_option('--enable-gl4es', action='store_true', dest='GL4ES', default=False,
help = 'enable gles2 renderer [default: %default]')
grp.add_option('--disable-gl', action='store_false', dest='GL', default=True,
help = 'disable opengl [default: %default]')
# stub # stub
return return
@ -35,16 +23,6 @@ def configure(conf):
conf.define_cond('SUPPORT_BSP2_FORMAT', conf.options.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
conf.env.GL4ES = conf.options.GL4ES
conf.env.GL = conf.options.GL
if conf.env.NANOGL:
conf.add_subproject('nanogl')
if conf.env.GLWES:
conf.add_subproject('gl-wes-v2')
conf.env.GL_STATIC = conf.options.GL_STATIC conf.env.GL_STATIC = conf.options.GL_STATIC
if conf.env.GL_STATIC: if conf.env.GL_STATIC:
conf.check(lib='GL') conf.check(lib='GL')
@ -59,61 +37,38 @@ def build(bld):
source = bld.path.ant_glob(['*.c']) source = bld.path.ant_glob(['*.c'])
includes = '.' includes = '.'
if bld.env.GL: targets = {
bld.shlib( 'ref_gl': {
source = source, 'enable': bld.env.GL,
target = 'ref_gl', 'libs': ['GL'] if bld.env.GL_STATIC else [],
features = 'c', 'defines': ['XASH_GL_STATIC'] if bld.env.GL_STATIC else [],
includes = includes, },
use = libs + (['GL'] if bld.env.GL_STATIC else []), 'ref_gles1': {
defines = ['XASH_GL_STATIC'] if bld.env.GL_STATIC else [], 'enable': bld.env.NANOGL,
install_path = bld.env.LIBDIR, 'libs': ['DL', 'nanogl'],
subsystem = bld.env.MSVC_SUBSYSTEM 'defines': ['XASH_NANOGL'],
) },
'ref_gles2': {
if bld.env.NANOGL: 'enable': bld.env.GLWES,
bld.add_subproject('nanogl') 'libs': ['DL', 'gl-wes-v2'],
bld.shlib( 'defines': ['XASH_WES'],
source = source, },
target = 'ref_gles1', 'ref_gl4es': {
features = 'c', 'enable': bld.env.GL4ES,
includes = includes, 'libs': ['DL', 'gl4es', 'LOG'],
use = libs + ['DL', 'nanogl'], 'defines': ['XASH_GL_STATIC', 'XASH_GL4ES'],
defines = ['XASH_NANOGL'], },
install_path = bld.env.LIBDIR, }
subsystem = bld.env.MSVC_SUBSYSTEM)
for k,v in targets.items():
if bld.env.GLWES: if not v['enable']:
bld.add_subproject('gl-wes-v2') continue
bld.shlib(
source = source, bld.shlib(source = source,
target = 'ref_gles2', target = k,
features = 'c',
includes = includes,
use = libs + ['DL', 'gl-wes-v2'],
defines = ['XASH_WES'],
install_path = bld.env.LIBDIR,
subsystem = bld.env.MSVC_SUBSYSTEM)
if bld.env.GL4ES:
gl4es_srcdir = bld.path.find_node('gl4es/src')
bld.stlib(
source = gl4es_srcdir.ant_glob(['gl/*.c', 'gl/*/*.c', 'glx/hardext.c']),
target = 'gl4es',
features = 'c',
includes = ['gl4es/src', 'gl4es/src/gl', 'gl4es/src/glx', 'gl4es/include'],
defines = ['NOX11', 'NO_GBM', 'NO_INIT_CONSTRUCTOR', 'DEFAULT_ES=2', 'NOEGL', 'EXTERNAL_GETPROCADDRESS=GL4ES_GetProcAddress', 'NO_LOADER', 'STATICLIB'],
cflags = ['-w', '-fvisibility=hidden', '-std=gnu99'],
use = libs,
subsystem = bld.env.MSVC_SUBSYSTEM)
bld.shlib(
source = source,
target = 'ref_gl4es',
features = 'c', features = 'c',
includes = includes, includes = includes,
use = libs + ['DL', 'gl4es', 'LOG'], use = libs + v['libs'],
defines = ['XASH_GL4ES', 'XASH_GL_STATIC'], defines = v['defines'],
install_path = bld.env.LIBDIR, install_path = bld.env.LIBDIR,
subsystem = bld.env.MSVC_SUBSYSTEM) subsystem = bld.env.MSVC_SUBSYSTEM)

36
wscript

@ -39,8 +39,11 @@ SUBDIRS = [
Subproject('dllemu'), Subproject('dllemu'),
# disable only by engine feature, makes no sense to even parse subprojects in dedicated mode # disable only by engine feature, makes no sense to even parse subprojects in dedicated mode
Subproject('ref/gl', lambda x: not x.env.DEDICATED), Subproject('3rdparty/nanogl', lambda x: not x.env.DEDICATED and x.env.NANOGL),
Subproject('ref/soft', lambda x: not x.env.DEDICATED), Subproject('3rdparty/gl-wes-v2', lambda x: not x.env.DEDICATED and x.env.GLWES),
Subproject('3rdparty/gl4es', lambda x: not x.env.DEDICATED and x.env.GL4ES),
Subproject('ref/gl', lambda x: not x.env.DEDICATED and (x.env.GL or x.env.NANOGL or x.env.GLWES or x.env.GL4ES)),
Subproject('ref/soft', lambda x: not x.env.DEDICATED and x.env.SOFT),
Subproject('3rdparty/mainui', lambda x: not x.env.DEDICATED), Subproject('3rdparty/mainui', lambda x: not x.env.DEDICATED),
Subproject('3rdparty/vgui_support', lambda x: not x.env.DEDICATED), Subproject('3rdparty/vgui_support', lambda x: not x.env.DEDICATED),
Subproject('stub/client', lambda x: not x.env.DEDICATED), Subproject('stub/client', lambda x: not x.env.DEDICATED),
@ -54,9 +57,6 @@ SUBDIRS = [
Subproject('utils/run-fuzzer', lambda x: x.env.ENABLE_FUZZER), Subproject('utils/run-fuzzer', lambda x: x.env.ENABLE_FUZZER),
] ]
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')
@ -84,6 +84,26 @@ def options(opt):
grp.add_option('--disable-werror', action = 'store_true', dest = 'DISABLE_WERROR', default = False, grp.add_option('--disable-werror', action = 'store_true', dest = 'DISABLE_WERROR', default = False,
help = 'disable compilation abort on warning') help = 'disable compilation abort on warning')
grp = opt.add_option_group('Renderers options')
grp.add_option('--enable-all-renderers', action='store_true', dest='ALL_RENDERERS', default=False,
help = 'enable all renderers supported by Xash3D FWGS [default: %default]')
grp.add_option('--enable-gles1', action='store_true', dest='NANOGL', default=False,
help = 'enable gles1 renderer [default: %default]')
grp.add_option('--enable-gles2', action='store_true', dest='GLWES', default=False,
help = 'enable gles2 renderer [default: %default]')
grp.add_option('--enable-gl4es', action='store_true', dest='GL4ES', default=False,
help = 'enable gles2 renderer [default: %default]')
grp.add_option('--disable-gl', action='store_false', dest='GL', default=True,
help = 'disable opengl renderer [default: %default]')
grp.add_option('--disable-soft', action='store_false', dest='SOFT', default=True,
help = 'disable opengl renderer [default: %default]')
grp = opt.add_option_group('Utilities options') grp = opt.add_option_group('Utilities options')
grp.add_option('--enable-utils', action = 'store_true', dest = 'ENABLE_UTILS', default = False, grp.add_option('--enable-utils', action = 'store_true', dest = 'ENABLE_UTILS', default = False,
@ -241,6 +261,12 @@ def configure(conf):
conf.env.DEDICATED = conf.options.DEDICATED conf.env.DEDICATED = conf.options.DEDICATED
conf.env.SINGLE_BINARY = conf.options.SINGLE_BINARY or conf.env.DEDICATED conf.env.SINGLE_BINARY = conf.options.SINGLE_BINARY or conf.env.DEDICATED
conf.env.NANOGL = conf.options.NANOGL or conf.options.ALL_RENDERERS
conf.env.GLWES = conf.options.GLWES or conf.options.ALL_RENDERERS
conf.env.GL4ES = conf.options.GL4ES or conf.options.ALL_RENDERERS
conf.env.GL = conf.options.GL or conf.options.ALL_RENDERERS
conf.env.SOFT = conf.options.SOFT or conf.options.ALL_RENDERERS
if conf.env.DEST_OS != 'win32': if conf.env.DEST_OS != 'win32':
conf.check_cc(lib='dl', mandatory=False) conf.check_cc(lib='dl', mandatory=False)

Loading…
Cancel
Save