mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
Add waf buildscripts, add updated game_launch
This commit is contained in:
80
engine/wscript
Normal file
80
engine/wscript
Normal file
@@ -0,0 +1,80 @@
|
||||
#! /usr/bin/env python
|
||||
# encoding: utf-8
|
||||
# mittorn, 2018
|
||||
|
||||
from waflib import Logs
|
||||
import os
|
||||
|
||||
top = '.'
|
||||
|
||||
def options(opt):
|
||||
# stub
|
||||
return
|
||||
|
||||
def configure(conf):
|
||||
# check for dedicated server build
|
||||
if conf.options.DEDICATED:
|
||||
conf.check( lib='rt' )
|
||||
conf.env.append_unique('DEFINES', 'SINGLE_BINARY')
|
||||
conf.env.append_unique('DEFINES', 'XASH_DEDICATED')
|
||||
else:
|
||||
# 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)]
|
||||
|
||||
# basic build: dedicated only, no dependencies
|
||||
if bld.env.DEST_OS != 'win32':
|
||||
libs = [ 'DL', 'M', 'PTHREAD' ]
|
||||
|
||||
source = bld.path.ant_glob([
|
||||
'common/*.c',
|
||||
'common/imagelib/*.c',
|
||||
'common/soundlib/*.c',
|
||||
'common/soundlib/libmpg/*.c',
|
||||
'server/*.c'])
|
||||
|
||||
# add client files and sdl2 library
|
||||
if not bld.env.DEDICATED:
|
||||
libs.append( 'SDL2' )
|
||||
source += bld.path.ant_glob([
|
||||
'client/*.c',
|
||||
'client/vgui/*.c',
|
||||
'client/avi/*.c',
|
||||
'platform/sdl/*.c'])
|
||||
else:
|
||||
if(bld.env.DEST_OS == 'linux'):
|
||||
libs.append('RT')
|
||||
|
||||
includes = ['common', 'server', 'client', 'client/vgui', '.', '../common', '../pm_shared' ]
|
||||
|
||||
if(bld.env.SINGLE_BINARY):
|
||||
bld(
|
||||
source = source,
|
||||
target = 'xash',
|
||||
features = 'c cprogram',
|
||||
includes = includes,
|
||||
use = libs
|
||||
)
|
||||
else:
|
||||
bld.shlib(
|
||||
source = source,
|
||||
target = 'xash',
|
||||
features = 'c',
|
||||
includes = includes,
|
||||
use = libs
|
||||
)
|
||||
Reference in New Issue
Block a user