2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-12-28 03:35:19 +01:00
xash3d-fwgs/ref/gl/wscript

77 lines
1.8 KiB
Python

#! /usr/bin/env python
# encoding: utf-8
# mittorn, 2018
from waflib import Logs
import os
top = '.'
def options(opt):
grp = opt.add_option_group('ref_gl options')
grp.add_option('--enable-static-gl', action='store_true', dest='GL_STATIC', default=False,
help = 'enable direct linking to opengl [default: %(default)s]')
# stub
return
def configure(conf):
conf.env.GL_STATIC = conf.options.GL_STATIC
if conf.env.GL_STATIC:
conf.check(lib='GL')
if conf.env.DEST_OS2 == 'android':
conf.check_cc(lib='log')
def build(bld):
libs = [ 'engine_includes', 'werror' ]
# on PSVita do not link any libraries that are already in the main executable, but add the includes target
if bld.env.DEST_OS == 'psvita':
libs += [ 'sdk_includes', 'vgl_shim' ]
else:
libs += [ 'public', 'M' ]
source = bld.path.ant_glob(['*.c', 'gl2_shim/*.c'])
includes = '.'
targets = {
'ref_gl': {
'enable': bld.env.GL,
'libs': ['GL'] if bld.env.GL_STATIC else [],
'defines': ['XASH_GL_STATIC=1'] if bld.env.GL_STATIC else [],
},
'ref_gles1': {
'enable': bld.env.NANOGL,
'libs': ['DL', 'nanogl', 'LOG'],
'defines': ['XASH_NANOGL=1'],
},
'ref_gles2': {
'enable': bld.env.GLWES,
'libs': ['DL', 'gl-wes-v2', 'LOG'],
'defines': ['XASH_WES=1'],
},
'ref_gl4es': {
'enable': bld.env.GL4ES,
'libs': ['DL', 'gl4es', 'LOG'],
'defines': ['XASH_GL_STATIC=1', 'XASH_GL4ES=1'],
},
'ref_gles3compat': {
'enable': bld.env.GLES3COMPAT,
'libs': [],
'defines': ['XASH_GLES3COMPAT=1'],
},
}
for k,v in targets.items():
if not v['enable']:
continue
bld.shlib(source = source,
target = k,
includes = includes,
use = libs + v['libs'],
defines = v['defines'] + ['REF_DLL=1'],
install_path = bld.env.LIBDIR,
subsystem = bld.env.MSVC_SUBSYSTEM)