2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-23 18:30:50 +01:00
xash3d-fwgs/engine/wscript

99 lines
2.9 KiB
Plaintext
Raw Normal View History

#! /usr/bin/env python
# encoding: utf-8
# mittorn, 2018
from waflib import Logs
import os
top = '.'
def options(opt):
grp = opt.add_option_group('Engine options')
grp.add_option('--enable-stdin-input', action = 'store_true', dest = 'USE_SELECT', default = False,
help = 'enable console input from stdin (always enabled for dedicated) [default: %default]')
opt.load('sdl2')
def configure(conf):
# check for dedicated server build
if conf.options.DEDICATED:
2019-09-19 16:07:41 +02:00
if conf.env.DEST_OS == 'linux':
conf.check_cc( lib='rt' )
conf.define('XASH_DEDICATED', 1)
2019-09-19 16:07:41 +02:00
elif conf.env.DEST_OS == 'android': # Android doesn't need SDL2
for i in ['android', 'log', 'EGL']:
conf.check_cc(lib = i)
2018-12-20 08:15:08 +01:00
else:
conf.load('sdl2')
if not conf.env.HAVE_SDL2:
conf.fatal('SDL2 not availiable! If you want to build dedicated server, specify --dedicated')
conf.define('XASH_SDL', 1)
if conf.options.USE_SELECT == None:
conf.options.USE_SELECT = conf.options.DEDICATED
2019-09-19 16:07:41 +02:00
conf.define_cond('SINGLE_BINARY', conf.env.SINGLE_BINARY)
conf.define_cond('XASH_USE_SELECT', conf.options.USE_SELECT)
conf.define_cond('SUPPORT_BSP2_FORMAT', conf.options.SUPPORT_BSP2_FORMAT)
conf.define_cond('XASH_64BIT', conf.env.DEST_SIZEOF_VOID_P != 4)
conf.define_cond('DBGHELP', conf.env.DEST_OS == 'win32')
conf.define_cond('PSAPI_VERSION', conf.env.DEST_OS == 'win32') # will be defined as 1
2019-05-30 06:38:53 +02:00
def build(bld):
libs = [ 'public' ]
2018-10-22 00:47:12 +02:00
source = bld.path.ant_glob([
'common/*.c',
2018-10-22 00:47:12 +02:00
'common/imagelib/*.c',
'common/soundlib/*.c',
'common/soundlib/libmpg/*.c',
'server/*.c'])
2018-06-14 19:34:51 +02:00
# basic build: dedicated only, no dependencies
if bld.env.DEST_OS != 'win32':
libs += [ 'DL' , 'M', 'PTHREAD' ]
2018-10-22 00:47:12 +02:00
source += bld.path.ant_glob(['platform/posix/*.c'])
2018-06-14 19:34:51 +02:00
else:
libs += ['USER32', 'SHELL32', 'GDI32', 'ADVAPI32', 'DBGHELP', 'PSAPI', 'WS2_32' ]
2018-06-14 19:34:51 +02:00
source += bld.path.ant_glob(['platform/win32/*.c'])
if bld.env.DEST_OS == 'linux':
source += bld.path.ant_glob(['platform/linux/*.c'])
if bld.env.HAVE_SDL2:
libs.append('SDL2')
source += bld.path.ant_glob(['platform/sdl/*.c'])
2019-09-19 16:07:41 +02:00
if bld.env.DEST_OS == 'android':
libs += ['LOG', 'EGL', 'ANDROID']
2019-09-19 16:07:41 +02:00
source += bld.path.ant_glob(['platform/android/*.cpp', 'platform/android/*.c', 'platform/linux/*.c'])
# add client files
if not bld.env.DEDICATED:
source += bld.path.ant_glob([
'client/*.c',
'client/vgui/*.c',
'client/avi/*.c'])
else:
if bld.env.DEST_OS == 'linux':
libs.append('RT')
# HACK: public headers must be put before common, so we don't get wrong mathlib included
includes = ['common', 'server', 'client', 'client/vgui', '.', '../public', '../common', '../pm_shared' ]
if bld.env.SINGLE_BINARY:
install_path = bld.env.BINDIR
features = 'c cprogram'
else:
install_path = bld.env.LIBDIR
features = 'c cshlib'
2019-09-19 16:07:41 +02:00
bld(source = source,
target = 'xash',
features = features,
includes = includes,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM
)