2019-02-18 19:25:26 +01:00
|
|
|
#! /usr/bin/env python
|
|
|
|
# encoding: utf-8
|
|
|
|
# mittorn, 2018
|
|
|
|
|
|
|
|
from waflib import Logs
|
|
|
|
import os
|
|
|
|
|
|
|
|
top = '.'
|
|
|
|
|
|
|
|
def options(opt):
|
2019-03-30 01:10:43 +01:00
|
|
|
grp = opt.add_option_group('ref_gl options')
|
|
|
|
|
2019-10-11 02:46:17 +02:00
|
|
|
grp.add_option('--enable-static-gl', action='store_true', dest='GL_STATIC', default=False,
|
2024-05-25 03:58:28 +02:00
|
|
|
help = 'enable direct linking to opengl [default: %(default)s]')
|
2019-03-30 01:10:43 +01:00
|
|
|
|
2019-02-18 19:25:26 +01:00
|
|
|
# stub
|
|
|
|
return
|
|
|
|
|
|
|
|
def configure(conf):
|
|
|
|
# check for dedicated server build
|
|
|
|
if conf.options.DEDICATED:
|
|
|
|
return
|
|
|
|
|
2019-10-11 02:10:08 +02:00
|
|
|
conf.define_cond('SUPPORT_BSP2_FORMAT', conf.options.SUPPORT_BSP2_FORMAT)
|
2019-02-18 19:25:26 +01:00
|
|
|
|
2019-03-30 01:10:43 +01:00
|
|
|
conf.env.GL_STATIC = conf.options.GL_STATIC
|
|
|
|
if conf.env.GL_STATIC:
|
2019-11-04 23:01:33 +01:00
|
|
|
conf.check(lib='GL')
|
2019-03-30 01:10:43 +01:00
|
|
|
|
2019-10-11 02:10:08 +02:00
|
|
|
conf.define('REF_DLL', 1)
|
2019-05-02 17:07:03 +02:00
|
|
|
if conf.env.DEST_OS2 == 'android':
|
|
|
|
conf.check_cc(lib='log')
|
2019-02-24 16:45:27 +01:00
|
|
|
|
2019-02-18 19:25:26 +01:00
|
|
|
def build(bld):
|
2024-01-30 13:04:57 +01:00
|
|
|
libs = [ 'engine_includes', 'werror' ]
|
2023-02-13 20:53:17 +01:00
|
|
|
# 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':
|
2023-02-21 23:32:47 +01:00
|
|
|
libs += [ 'sdk_includes', 'vgl_shim' ]
|
2023-02-13 20:53:17 +01:00
|
|
|
else:
|
|
|
|
libs += [ 'public', 'M' ]
|
2019-02-18 19:25:26 +01:00
|
|
|
|
2023-10-12 02:40:15 +02:00
|
|
|
source = bld.path.ant_glob(['*.c', 'gl2_shim/*.c'])
|
2022-09-10 19:05:35 +02:00
|
|
|
includes = '.'
|
2019-02-18 19:25:26 +01:00
|
|
|
|
2022-09-10 19:54:34 +02:00
|
|
|
targets = {
|
|
|
|
'ref_gl': {
|
|
|
|
'enable': bld.env.GL,
|
|
|
|
'libs': ['GL'] if bld.env.GL_STATIC else [],
|
2024-10-09 01:01:10 +02:00
|
|
|
'defines': ['XASH_GL_STATIC=1'] if bld.env.GL_STATIC else [],
|
2022-09-10 19:54:34 +02:00
|
|
|
},
|
|
|
|
'ref_gles1': {
|
|
|
|
'enable': bld.env.NANOGL,
|
2022-11-16 23:08:11 +01:00
|
|
|
'libs': ['DL', 'nanogl', 'LOG'],
|
2024-10-09 01:01:10 +02:00
|
|
|
'defines': ['XASH_NANOGL=1'],
|
2022-09-10 19:54:34 +02:00
|
|
|
},
|
|
|
|
'ref_gles2': {
|
|
|
|
'enable': bld.env.GLWES,
|
2022-11-16 23:08:11 +01:00
|
|
|
'libs': ['DL', 'gl-wes-v2', 'LOG'],
|
2024-10-09 01:01:10 +02:00
|
|
|
'defines': ['XASH_WES=1'],
|
2022-09-10 19:54:34 +02:00
|
|
|
},
|
|
|
|
'ref_gl4es': {
|
|
|
|
'enable': bld.env.GL4ES,
|
|
|
|
'libs': ['DL', 'gl4es', 'LOG'],
|
2024-10-09 01:01:10 +02:00
|
|
|
'defines': ['XASH_GL_STATIC=1', 'XASH_GL4ES=1'],
|
2022-09-10 19:54:34 +02:00
|
|
|
},
|
2023-10-04 23:24:40 +02:00
|
|
|
'ref_gles3compat': {
|
|
|
|
'enable': bld.env.GLES3COMPAT,
|
2024-01-30 15:40:59 +01:00
|
|
|
'libs': [],
|
2024-10-09 01:01:10 +02:00
|
|
|
'defines': ['XASH_GLES3COMPAT=1'],
|
2023-10-04 23:24:40 +02:00
|
|
|
},
|
2022-09-10 19:54:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for k,v in targets.items():
|
|
|
|
if not v['enable']:
|
|
|
|
continue
|
|
|
|
|
|
|
|
bld.shlib(source = source,
|
|
|
|
target = k,
|
2020-02-25 06:58:36 +01:00
|
|
|
features = 'c',
|
|
|
|
includes = includes,
|
2022-09-10 19:54:34 +02:00
|
|
|
use = libs + v['libs'],
|
|
|
|
defines = v['defines'],
|
2020-02-25 06:58:36 +01:00
|
|
|
install_path = bld.env.LIBDIR,
|
|
|
|
subsystem = bld.env.MSVC_SUBSYSTEM)
|