#! /usr/bin/env python # encoding: utf-8 # a1batross, mittorn, 2018 from waflib import Utils import os def options(opt): grp = opt.add_option_group('Client options') 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): conf.env.USE_VGUI = conf.options.USE_VGUI 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', '../dlls/gearbox', '../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 bld.env.USE_VGUI: defines += ['USE_VGUI'] libs += ['VGUI'] if bld.env.USE_NOVGUI_MOTD: defines += ['USE_NOVGUI_MOTD'] else: excluded_files += ['MOTD.cpp'] if bld.env.USE_NOVGUI_SCOREBOARD: defines += ['USE_NOVGUI_SCOREBOARD'] else: excluded_files += ['scoreboard.cpp'] else: 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([ 'pm_shared/*.c', 'dlls/crossbow.cpp', 'dlls/crowbar.cpp', 'dlls/egon.cpp', 'dlls/gauss.cpp', 'dlls/glock.cpp', 'dlls/handgrenade.cpp', 'dlls/hornetgun.cpp', 'dlls/mp5.cpp', 'dlls/python.cpp', 'dlls/rpg.cpp', 'dlls/satchel.cpp', 'dlls/shotgun.cpp', 'dlls/squeakgrenade.cpp', 'dlls/tripmine.cpp', 'dlls/gearbox/displacer.cpp', 'dlls/gearbox/knife.cpp', 'dlls/gearbox/eagle.cpp', 'dlls/gearbox/grapple.cpp', 'dlls/gearbox/m249.cpp', 'dlls/gearbox/penguin.cpp', 'dlls/gearbox/pipewrench.cpp', 'dlls/gearbox/shockrifle.cpp', 'dlls/gearbox/sniperrifle.cpp', 'dlls/gearbox/sporelauncher.cpp' ]) if bld.env.DEST_OS == 'win32': libs += ['USER32'] if bld.env.GOLDSOURCE_SUPPORT: defines += ['GOLDSOURCE_SUPPORT'] if bld.env.DEST_OS == 'win32': libs += ["WINMM"] else: libs += ['DL'] if bld.env.DEST_OS not in ['android', 'dos']: install_path = os.path.join(bld.env.GAMEDIR, bld.env.CLIENT_INSTALL_DIR) else: install_path = bld.env.PREFIX bld.shlib( source = source, target = 'client' + bld.env.POSTFIX, name = 'client', features = 'c cxx', includes = includes, defines = defines, use = libs, install_path = install_path, subsystem = bld.env.MSVC_SUBSYSTEM, idx = bld.get_taskgen_count() )