mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-11 14:42:05 +08:00
wscript: adapt main and ref_gl wscripts to new directory layout, add flag to build all renderers at once
This commit is contained in:
+31
-76
@@ -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):
|
||||
|
||||
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):
|
||||
source = bld.path.ant_glob(['*.c'])
|
||||
includes = '.'
|
||||
|
||||
if bld.env.GL:
|
||||
bld.shlib(
|
||||
source = source,
|
||||
target = 'ref_gl',
|
||||
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 + (['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',
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user