xash3d-fwgs/game_launch/wscript

59 lines
1.2 KiB
Python

#! /usr/bin/env python
# encoding: utf-8
# a1batross, mittorn, 2018
from waflib import Logs
import os
top = '.'
def options(opt):
# stub
return
def configure(conf):
if(conf.env.SINGLE_BINARY):
return
# check for dedicated server build
if conf.env.DEST_OS != 'win32' and not conf.env.DEDICATED:
# TODO: add way to specify SDL2 path, move to separate function
try:
conf.check_cfg(
path='sdl2-config',
args='--cflags --libs',
package='',
msg='Checking for SDL2',
uselib_store='SDL2')
except conf.errors.ConfigurationError:
conf.fatal('SDL2 not availiable! If you want to build dedicated server, specify --dedicated')
conf.env.append_unique('DEFINES', 'XASH_SDL')
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)]
source = 'game.cpp'
includes = '. ../common'
libs = []
if bld.env.DEST_OS != 'win32':
libs += [ 'DL' ]
if not bld.env.DEDICATED:
libs += [ 'SDL2' ]
else:
# compile resource on Windows
bld.load('winres')
source += 'game.rc'
bld(
source = source,
target = 'xash3d', # hl.exe
features = 'c cprogram',
includes = includes,
use = libs
)