|
|
|
#! /usr/bin/env python
|
|
|
|
# encoding: utf-8
|
|
|
|
# mittorn, 2018
|
|
|
|
|
|
|
|
from waflib import Logs
|
|
|
|
import os
|
|
|
|
|
|
|
|
top = '.'
|
|
|
|
|
|
|
|
def options(opt):
|
|
|
|
opt.add_option(
|
|
|
|
'--vgui', action = 'store', type='string', dest = 'VGUI_DEV',
|
|
|
|
help = 'path to vgui-dev repo', default='' )
|
|
|
|
opt.add_option(
|
|
|
|
'--no-vgui', action = 'store_true', dest = 'NO_VGUI',
|
|
|
|
help = 'disable vgui_support', default=False )
|
|
|
|
|
|
|
|
# stub
|
|
|
|
return
|
|
|
|
|
|
|
|
def configure(conf):
|
|
|
|
conf.env.NO_VGUI = conf.options.NO_VGUI
|
|
|
|
if conf.options.DEDICATED or conf.options.NO_VGUI:
|
|
|
|
return
|
|
|
|
|
|
|
|
conf.start_msg('Checking for VGUI')
|
|
|
|
|
|
|
|
if not conf.options.VGUI_DEV:
|
|
|
|
conf.end_msg('no')
|
|
|
|
conf.fatal("Provide a path to vgui-dev repository using --vgui key")
|
|
|
|
|
|
|
|
if conf.env.DEST_CPU != 'x86' and not (conf.env.DEST_CPU == 'x86_64' and not conf.options.ALLOW64):
|
|
|
|
conf.end_msg('no')
|
|
|
|
conf.fatal('vgui is not supported on this CPU: ' + conf.env.DEST_CPU)
|
|
|
|
|
|
|
|
if conf.env.DEST_OS == 'win32':
|
|
|
|
conf.env.LIB_VGUI = ['vgui']
|
|
|
|
conf.env.LIBPATH_VGUI = [os.path.abspath(os.path.join(conf.options.VGUI_DEV, 'lib/win32_vc6/'))]
|
|
|
|
else:
|
|
|
|
if conf.env.DEST_OS == 'linux':
|
|
|
|
conf.env.LIB_VGUI = [':vgui.so']
|
|
|
|
elif conf.env.DEST_OS == 'darwin':
|
|
|
|
conf.env.LIB_VGUI = ['vgui.dylib']
|
|
|
|
else:
|
|
|
|
conf.fatal('vgui is not supported on this OS: ' + conf.env.DEST_OS)
|
|
|
|
conf.env.LIBPATH_VGUI = [os.path.abspath(os.path.join(conf.options.VGUI_DEV, 'lib'))]
|
|
|
|
conf.env.INCLUDES_VGUI = [os.path.abspath(os.path.join(conf.options.VGUI_DEV, 'include'))]
|
|
|
|
|
|
|
|
conf.env.HAVE_VGUI = 1
|
|
|
|
conf.end_msg('yes: {0}, {1}, {2}'.format(conf.env.LIB_VGUI, conf.env.LIBPATH_VGUI, conf.env.INCLUDES_VGUI))
|
|
|
|
|
|
|
|
def get_subproject_name(ctx):
|
|
|
|
return os.path.basename(os.path.realpath(str(ctx.path)))
|
|
|
|
|
|
|
|
def build(bld):
|
|
|
|
bld.load_envs()
|
|
|
|
bld.env = bld.all_envs[get_subproject_name(bld)]
|
|
|
|
|
|
|
|
if bld.env.DEDICATED or bld.env.NO_VGUI:
|
|
|
|
return
|
|
|
|
|
|
|
|
libs = []
|
|
|
|
|
|
|
|
# basic build: dedicated only, no dependencies
|
|
|
|
if bld.env.DEST_OS != 'win32':
|
|
|
|
libs = [ 'DL', 'M' ]
|
|
|
|
|
|
|
|
libs.append('VGUI')
|
|
|
|
|
|
|
|
source = bld.path.ant_glob(['*.cpp'])
|
|
|
|
|
|
|
|
includes = [ '.', '../common', '../engine' ]
|
|
|
|
|
|
|
|
bld.shlib(
|
|
|
|
source = source,
|
|
|
|
target = 'vgui_support',
|
|
|
|
features = 'cxx',
|
|
|
|
includes = includes,
|
|
|
|
use = libs,
|
|
|
|
install_path = bld.env.LIBDIR,
|
|
|
|
subsystem = bld.env.MSVC_SUBSYSTEM
|
|
|
|
)
|