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): @@ -13,18 +13,6 @@ def options(opt):
grp.add_option('--enable-static-gl', action='store_true', dest='GL_STATIC', default=False,
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
return
@ -35,16 +23,6 @@ def configure(conf): @@ -35,16 +23,6 @@ def configure(conf):
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
if conf.env.GL_STATIC:
conf.check(lib='GL')
@ -59,61 +37,38 @@ def build(bld): @@ -59,61 +37,38 @@ def build(bld):
source = bld.path.ant_glob(['*.c'])
includes = '.'
if bld.env.GL:
bld.shlib(
source = source,
target = 'ref_gl',
features = 'c',
includes = includes,
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
)
if bld.env.NANOGL:
bld.add_subproject('nanogl')
bld.shlib(
source = source,
target = 'ref_gles1',
features = 'c',
includes = includes,
use = libs + ['DL', 'nanogl'],
defines = ['XASH_NANOGL'],
install_path = bld.env.LIBDIR,
subsystem = bld.env.MSVC_SUBSYSTEM)
if bld.env.GLWES:
bld.add_subproject('gl-wes-v2')
bld.shlib(
source = source,
target = 'ref_gles2',
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',
targets = {
'ref_gl': {
'enable': bld.env.GL,
'libs': ['GL'] if bld.env.GL_STATIC else [],
'defines': ['XASH_GL_STATIC'] if bld.env.GL_STATIC else [],
},
'ref_gles1': {
'enable': bld.env.NANOGL,
'libs': ['DL', 'nanogl'],
'defines': ['XASH_NANOGL'],
},
'ref_gles2': {
'enable': bld.env.GLWES,
'libs': ['DL', 'gl-wes-v2'],
'defines': ['XASH_WES'],
},
'ref_gl4es': {
'enable': bld.env.GL4ES,
'libs': ['DL', 'gl4es', 'LOG'],
'defines': ['XASH_GL_STATIC', 'XASH_GL4ES'],
},
}
for k,v in targets.items():
if not v['enable']:
continue
bld.shlib(source = source,
target = k,
features = 'c',
includes = includes,
use = libs + ['DL', 'gl4es', 'LOG'],
defines = ['XASH_GL4ES', 'XASH_GL_STATIC'],
use = libs + v['libs'],
defines = v['defines'],
install_path = bld.env.LIBDIR,
subsystem = bld.env.MSVC_SUBSYSTEM)

36
wscript

@ -39,8 +39,11 @@ SUBDIRS = [ @@ -39,8 +39,11 @@ SUBDIRS = [
Subproject('dllemu'),
# 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('ref/soft', lambda x: not x.env.DEDICATED),
Subproject('3rdparty/nanogl', lambda x: not x.env.DEDICATED and x.env.NANOGL),
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/vgui_support', lambda x: not x.env.DEDICATED),
Subproject('stub/client', lambda x: not x.env.DEDICATED),
@ -54,9 +57,6 @@ SUBDIRS = [ @@ -54,9 +57,6 @@ SUBDIRS = [
Subproject('utils/run-fuzzer', lambda x: x.env.ENABLE_FUZZER),
]
def subdirs():
return map(lambda x: x.name, SUBDIRS)
def options(opt):
grp = opt.add_option_group('Common options')
@ -84,6 +84,26 @@ def options(opt): @@ -84,6 +84,26 @@ def options(opt):
grp.add_option('--disable-werror', action = 'store_true', dest = 'DISABLE_WERROR', default = False,
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.add_option('--enable-utils', action = 'store_true', dest = 'ENABLE_UTILS', default = False,
@ -241,6 +261,12 @@ def configure(conf): @@ -241,6 +261,12 @@ def configure(conf):
conf.env.DEDICATED = conf.options.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':
conf.check_cc(lib='dl', mandatory=False)

Loading…
Cancel
Save