Browse Source

client: wscript: feature parity with CMake, try to use file globs and exclude list to make maintenance easier

fix-cwd-path
Alibek Omarov 2 years ago
parent
commit
c3522346e9
  1. 140
      cl_dll/wscript
  2. 79
      scripts/waifulib/vgui.py

140
cl_dll/wscript

@ -6,27 +6,70 @@ from waflib import Utils
import os import os
def options(opt): def options(opt):
# stub grp = opt.add_option_group('Client options')
return
grp.add_option('--enable-vgui', action = 'store_true', dest = 'USE_VGUI', default = False,
help = 'Enable VGUI1')
grp.add_option('--enable-vgui2', action = 'store_true', dest = 'USE_VGUI2', default = False,
help = 'Enable VGUI2. UNDONE')
grp.add_option('--enable-novgui-motd', action = 'store_true', dest = 'USE_NOVGUI_MOTD', default = False,
help = 'Prefer non-VGUI MOTD when USE_VGUI is enabled')
grp.add_option('--enable-novgui-scoreboard', action = 'store_true', dest = 'USE_NOVGUI_SCOREBOARD', default = False,
help = 'Prefer non-VGUI Scoreboard when USE_VGUI is enabled')
grp.add_option('--disable-goldsrc-support', action = 'store_false', dest = 'GOLDSOURCE_SUPPORT',
default=True, help = 'disable GoldSource compatibility')
opt.load('vgui')
def configure(conf): def configure(conf):
if conf.env.DEST_OS == 'win32': conf.env.USE_VGUI = conf.options.USE_VGUI
conf.check_cxx(lib='user32') conf.env.USE_NOVGUI_MOTD = conf.options.USE_NOVGUI_MOTD
conf.env.USE_NOVGUI_SCOREBOARD = conf.options.USE_NOVGUI_SCOREBOARD
conf.env.USE_VOICEMGR = conf.options.USE_VOICEMGR
conf.env.GOLDSOURCE_SUPPORT = conf.options.GOLDSOURCE_SUPPORT
if conf.env.USE_VGUI:
conf.load('vgui')
if not conf.check_vgui():
conf.fatal('VGUI was enabled but VGUI cannot be used')
def build(bld):
libs = []
defines = ['CLIENT_DLL']
includes = ['.',
'../dlls',
'../common',
'../engine',
'../pm_shared',
'../game_shared',
'../public']
excluded_files = ['GameStudioModelRenderer_Sample.cpp',
'game_shared/voice_vgui_tweakdlg.cpp',
'game_shared/voice_gamemgr.cpp',
'game_shared/voice_status.cpp']
if conf.env.GOLDSRC: if bld.env.USE_VGUI:
if conf.env.DEST_OS == 'win32': defines += ['USE_VGUI']
conf.check_cxx(lib='winmm') libs += ['VGUI']
if bld.env.USE_NOVGUI_MOTD:
defines += ['USE_NOVGUI_MOTD']
else: else:
conf.check_cc(lib='dl') excluded_files += ['MOTD.cpp']
def build(bld): if bld.env.USE_NOVGUI_SCOREBOARD:
source = bld.path.parent.ant_glob([ defines += ['USE_NOVGUI_SCOREBOARD']
'pm_shared/*.c' else:
]) excluded_files += ['scoreboard.cpp']
source += bld.path.ant_glob([ else:
'hl/*.cpp' includes += ['../utils/fake_vgui/include']
]) excluded_files += ['voice_status.cpp',
'vgui_*.cpp',
'game_shared/vgui_*.cpp',
'game_shared/voice_banmgr.cpp']
source = bld.path.ant_glob('**/*.cpp', excl=excluded_files)
source += bld.path.parent.ant_glob('game_shared/*.cpp', excl=excluded_files)
source += bld.path.parent.ant_glob([ source += bld.path.parent.ant_glob([
'pm_shared/*.c',
'dlls/crossbow.cpp', 'dlls/crossbow.cpp',
'dlls/crowbar.cpp', 'dlls/crowbar.cpp',
'dlls/egon.cpp', 'dlls/egon.cpp',
@ -42,78 +85,21 @@ def build(bld):
'dlls/squeakgrenade.cpp', 'dlls/squeakgrenade.cpp',
'dlls/tripmine.cpp' 'dlls/tripmine.cpp'
]) ])
source += [
'GameStudioModelRenderer.cpp',
'MOTD.cpp',
'StudioModelRenderer.cpp',
'ammo.cpp',
'ammo_secondary.cpp',
'ammohistory.cpp',
'battery.cpp',
'cdll_int.cpp',
'com_weapons.cpp',
'death.cpp',
'demo.cpp',
'entity.cpp',
'ev_hldm.cpp',
'ev_common.cpp',
'events.cpp',
'flashlight.cpp',
'geiger.cpp',
'health.cpp',
'hud.cpp',
'hud_msg.cpp',
'hud_redraw.cpp',
'hud_spectator.cpp',
'hud_update.cpp',
'in_camera.cpp',
'input.cpp',
'input_goldsource.cpp',
'input_mouse.cpp',
'input_xash3d.cpp',
'menu.cpp',
'message.cpp',
'parsemsg.cpp',
'saytext.cpp',
'scoreboard.cpp',
'status_icons.cpp',
'statusbar.cpp',
'studio_util.cpp',
'text_message.cpp',
'train.cpp',
'tri.cpp',
'util.cpp',
'view.cpp'
]
includes = [
'.',
'hl/',
'../dlls',
'../common',
'../engine',
'../pm_shared',
'../game_shared',
'../public',
'../utils/fake_vgui/include'
]
defines = ['CLIENT_DLL']
if bld.env.GOLDSRC:
defines += ['GOLDSOURCE_SUPPORT']
libs = []
if bld.env.DEST_OS == 'win32': if bld.env.DEST_OS == 'win32':
libs += ["USER32"] libs += ['USER32']
if bld.env.GOLDSOURCE_SUPPORT:
defines += ['GOLDSOURCE_SUPPORT']
if bld.env.GOLDSRC:
if bld.env.DEST_OS == 'win32': if bld.env.DEST_OS == 'win32':
libs += ["WINMM"] libs += ["WINMM"]
else: else:
libs += ['DL'] libs += ['DL']
if bld.env.DEST_OS not in ['android', 'dos']: if bld.env.DEST_OS not in ['android', 'dos']:
install_path = os.path.join(bld.env.GAMEDIR, bld.env.CLIENT_DIR) install_path = os.path.join(bld.env.GAMEDIR, bld.env.CLIENT_INSTALL_DIR)
else: else:
install_path = bld.env.PREFIX install_path = bld.env.PREFIX

79
scripts/waifulib/vgui.py

@ -0,0 +1,79 @@
#! /usr/bin/env python
# encoding: utf-8
# mittorn, 2018
from waflib.Configure import conf
import os
VGUI_SUPPORTED_OS = ['win32', 'darwin', 'linux']
VGUI_FRAGMENT = '''#include <VGUI.h>
int main() { return 0; }'''
def options(opt):
grp = opt.add_option_group('VGUI options')
vgui_dev_path = os.path.join(opt.path.path_from(opt.path), 'vgui_support', 'vgui-dev')
grp.add_option('--vgui', action = 'store', dest = 'VGUI_DEV', default=vgui_dev_path,
help = 'path to vgui-dev repo [default: %default]')
grp.add_option('--skip-vgui-sanity-check', action = 'store_false', dest = 'VGUI_SANITY_CHECK', default=True,
help = 'skip checking VGUI sanity [default: %default]' )
return
@conf
def check_vgui(conf):
conf.start_msg('Does this architecture support VGUI?')
if conf.env.DEST_CPU != 'x86' and not (conf.env.DEST_CPU == 'x86_64' and not conf.options.ALLOW64):
conf.end_msg('no')
Logs.warn('vgui is not supported on this CPU: ' + str(conf.env.DEST_CPU))
return False
else: conf.end_msg('yes')
conf.start_msg('Does this OS support VGUI?')
if conf.env.DEST_OS not in VGUI_SUPPORTED_OS:
conf.end_msg('no')
Logs.warn('vgui is not supported on this OS: ' + str(conf.env.DEST_OS))
return False
else: conf.end_msg('yes')
conf.start_msg('Does this toolchain able to link VGUI?')
if conf.env.DEST_OS == 'win32' and conf.env.COMPILER_CXX == 'g++':
conf.end_msg('no')
# we have ABI incompatibility ONLY on MinGW
Logs.warn('vgui can\'t be linked with MinGW')
return False
else: conf.end_msg('yes')
conf.start_msg('Configuring VGUI by provided path')
vgui_dev = conf.options.VGUI_DEV
if conf.env.DEST_OS == 'win32':
conf.env.LIB_VGUI = ['vgui']
conf.env.LIBPATH_VGUI = [os.path.abspath(os.path.join(vgui_dev, 'lib/win32_vc6/'))]
else:
libpath = os.path.abspath(os.path.join(vgui_dev, 'lib'))
if conf.env.DEST_OS == 'linux':
conf.env.LIB_VGUI = [':vgui.so']
conf.env.LIBPATH_VGUI = [libpath]
elif conf.env.DEST_OS == 'darwin':
conf.env.LDFLAGS_VGUI = [os.path.join(libpath, 'vgui.dylib')]
else:
conf.fatal('vgui is not supported on this OS: ' + conf.env.DEST_OS)
conf.env.INCLUDES_VGUI = [os.path.abspath(os.path.join(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))
if conf.env.HAVE_VGUI and conf.options.VGUI_SANITY_CHECK:
try:
conf.check_cxx(fragment=VGUI_FRAGMENT,
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.")
return True
Loading…
Cancel
Save