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')
|
|
|
|
|
|
|
|
grp.add_option('--enable-static-gl', action='store_true', dest='GL_STATIC',
|
|
|
|
help = 'don\'t load opengl in runtime, instead link to libGL directly(default: False)')
|
|
|
|
|
|
|
|
grp.add_option('--enable-gles1', action='store_true', dest='NANOGL',
|
|
|
|
help = 'enable gles1 renderer by linking nanogl statically(put source to ref_gl directory)')
|
|
|
|
|
|
|
|
grp.add_option('--enable-gles2', action='store_true', dest='GLWES',
|
|
|
|
help = 'enable gles2 renderer by linking gl-wes-v2 statically(put source to ref_gl directory)')
|
2019-04-11 00:26:33 +02:00
|
|
|
|
|
|
|
grp.add_option('--disable-gl', action='store_false', dest='GL', default=True,
|
|
|
|
help = 'disable building OpenGL renderer(default: False)')
|
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
|
|
|
|
|
|
|
|
if conf.options.SUPPORT_BSP2_FORMAT:
|
|
|
|
conf.env.append_unique('DEFINES', 'SUPPORT_BSP2_FORMAT')
|
|
|
|
|
2019-03-30 01:10:43 +01:00
|
|
|
conf.env.NANOGL = conf.options.NANOGL
|
|
|
|
conf.env.GLWES = conf.options.GLWES
|
2019-04-11 00:41:52 +02:00
|
|
|
conf.env.GL = conf.options.GL
|
2019-03-30 01:10:43 +01:00
|
|
|
|
2019-04-10 23:15:48 +02:00
|
|
|
if conf.env.NANOGL:
|
|
|
|
conf.add_subproject('nanogl')
|
2019-03-30 01:10:43 +01:00
|
|
|
if conf.env.GLWES:
|
2019-04-10 23:15:48 +02:00
|
|
|
conf.add_subproject('gl-wes-v2')
|
2019-03-30 01:10:43 +01:00
|
|
|
|
|
|
|
conf.env.GL_STATIC = conf.options.GL_STATIC
|
|
|
|
if conf.env.GL_STATIC:
|
|
|
|
conf.check( lib='GL' )
|
|
|
|
|
2019-02-24 16:45:27 +01:00
|
|
|
conf.env.append_unique('DEFINES', 'REF_DLL')
|
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):
|
2019-03-21 15:31:18 +01:00
|
|
|
libs = [ 'public', 'M' ]
|
2019-02-18 19:25:26 +01:00
|
|
|
|
|
|
|
source = bld.path.ant_glob(['*.c'])
|
|
|
|
|
|
|
|
includes = ['.',
|
2019-02-23 19:49:46 +01:00
|
|
|
'../engine',
|
|
|
|
'../engine/common',
|
2019-02-18 19:25:26 +01:00
|
|
|
'../engine/server',
|
|
|
|
'../engine/client',
|
2019-03-19 23:17:46 +01:00
|
|
|
'../public',
|
2019-03-20 00:40:47 +01:00
|
|
|
'../common',
|
2019-02-18 19:25:26 +01:00
|
|
|
'../pm_shared' ]
|
|
|
|
|
2019-03-30 01:10:43 +01:00
|
|
|
def link_gl( glstatic ):
|
|
|
|
if glstatic: return ['GL']
|
|
|
|
else: return []
|
|
|
|
|
|
|
|
def static_gl( glstatic ):
|
|
|
|
if glstatic: return ['XASH_GL_STATIC']
|
|
|
|
else: return []
|
|
|
|
|
2019-04-11 00:26:33 +02:00
|
|
|
if bld.env.GL:
|
|
|
|
bld.shlib(
|
|
|
|
source = source,
|
|
|
|
target = 'ref_gl',
|
|
|
|
features = 'c',
|
|
|
|
includes = includes,
|
|
|
|
use = libs + link_gl(bld.env.GL_STATIC),
|
|
|
|
defines = static_gl(bld.env.GL_STATIC),
|
|
|
|
install_path = bld.env.LIBDIR,
|
|
|
|
subsystem = bld.env.MSVC_SUBSYSTEM
|
|
|
|
)
|
2019-03-30 01:10:43 +01:00
|
|
|
|
|
|
|
if bld.env.NANOGL:
|
2019-04-10 23:15:48 +02:00
|
|
|
bld.add_subproject('nanogl')
|
2019-03-30 01:10:43 +01:00
|
|
|
bld.shlib(
|
2019-04-04 22:13:17 +02:00
|
|
|
source = source,
|
2019-03-30 01:10:43 +01:00
|
|
|
target = 'ref_gles1',
|
|
|
|
features = 'c',
|
|
|
|
includes = includes,
|
2019-04-04 22:13:17 +02:00
|
|
|
use = libs + ['DL', 'nanogl'],
|
|
|
|
defines = ['XASH_NANOGL'],
|
2019-03-30 01:10:43 +01:00
|
|
|
install_path = bld.env.LIBDIR,
|
|
|
|
subsystem = bld.env.MSVC_SUBSYSTEM)
|
|
|
|
|
|
|
|
if bld.env.GLWES:
|
2019-04-10 23:15:48 +02:00
|
|
|
bld.add_subproject('gl-wes-v2')
|
2019-03-30 01:10:43 +01:00
|
|
|
bld.shlib(
|
2019-04-04 22:13:17 +02:00
|
|
|
source = source,
|
2019-03-30 01:10:43 +01:00
|
|
|
target = 'ref_gles2',
|
|
|
|
features = 'c',
|
|
|
|
includes = includes,
|
2019-04-04 22:13:17 +02:00
|
|
|
use = libs + ['DL', 'gl-wes-v2'],
|
|
|
|
defines = ['XASH_WES'],
|
2019-03-30 01:10:43 +01:00
|
|
|
install_path = bld.env.LIBDIR,
|
|
|
|
subsystem = bld.env.MSVC_SUBSYSTEM)
|