2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-23 02:15:55 +01:00

vgui_support: wscript: refactor, use shared get_subproject_name, rename no-vgui to disable-vgui to follow automake-style convention, add vGUI library sanity check

This commit is contained in:
Alibek Omarov 2018-12-13 08:05:31 +03:00
parent 6debd84a2e
commit 9ce9fa8cb5

View File

@ -4,6 +4,7 @@
from waflib import Logs from waflib import Logs
import os import os
from fwgslib import get_subproject_name
top = '.' top = '.'
@ -11,10 +12,15 @@ def options(opt):
opt.add_option( opt.add_option(
'--vgui', action = 'store', type='string', dest = 'VGUI_DEV', '--vgui', action = 'store', type='string', dest = 'VGUI_DEV',
help = 'path to vgui-dev repo', default='' ) help = 'path to vgui-dev repo', default='' )
opt.add_option( opt.add_option(
'--no-vgui', action = 'store_true', dest = 'NO_VGUI', '--disable-vgui', action = 'store_true', dest = 'NO_VGUI',
help = 'disable vgui_support', default=False ) help = 'disable vgui_support', default=False )
opt.add_option(
'--skip-vgui-sanity-check', action = 'store_false', dest = 'VGUI_SANITY_CHECK',
help = 'Skip checking VGUI sanity', default=True )
# stub # stub
return return
@ -23,7 +29,7 @@ def configure(conf):
if conf.options.DEDICATED or conf.options.NO_VGUI: if conf.options.DEDICATED or conf.options.NO_VGUI:
return return
conf.start_msg('Checking for VGUI') conf.start_msg('Configuring VGUI by provided path')
if not conf.options.VGUI_DEV: if not conf.options.VGUI_DEV:
conf.end_msg('no') conf.end_msg('no')
@ -49,8 +55,23 @@ def configure(conf):
conf.env.HAVE_VGUI = 1 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)) 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): if conf.env.HAVE_VGUI and conf.options.VGUI_SANITY_CHECK:
return os.path.basename(os.path.realpath(str(ctx.path))) try:
conf.check_cxx(
fragment='''
#include <VGUI.h>
#include <VGUI_App.h>
int main( int argc, char **argv )
{
vgui::App *app = vgui::App::getInstance();
app->main(argc, argv);
return 0;
}''',
msg = 'Checking for library VGUI sanity',
use = 'VGUI',
execute = False)
except conf.errors.ConfigurationError:
conf.fatal("Can't compile simple program. Check your path to vgui-dev repository.")
def build(bld): def build(bld):
bld.load_envs() bld.load_envs()