Browse Source

waf options for dedicated server and 64-bits

pull/2/head
mittorn 7 years ago
parent
commit
063eb151c4
  1. 61
      contib/mittorn/wscript

61
contib/mittorn/wscript

@ -10,33 +10,64 @@ top = '.'
def options(opt): def options(opt):
opt.load('compiler_c') opt.load('compiler_c')
# opt.load('msvs') # opt.load('msvs')
opt.add_option('--dedicated', action = 'store_true', help = 'build dedicated server only' )
opt.add_option('--64bits', dest = 'amd64', action = 'store_true', help = 'build 64-bit engine on x86_64' )
def configure(conf): def configure(conf):
conf.load('compiler_c') conf.load('compiler_c')
conf.env.append_unique('CFLAGS', '-O2') conf.env.append_unique('CFLAGS', '-O2')
conf.env.append_unique('DEFINES', 'XASH_SDL')
conf.env.append_unique('DEFINES', 'SINGLE_BINARY') conf.env.append_unique('DEFINES', 'SINGLE_BINARY')
conf.env.append_value('LINKFLAGS', '-ldl') conf.env.append_value('LINKFLAGS', '-ldl')
conf.env.append_value('LINKFLAGS', '-lm') conf.env.append_value('LINKFLAGS', '-lm')
conf.env.append_value('LINKFLAGS', '-pthread') conf.env.append_value('LINKFLAGS', '-pthread')
conf.env.append_value('LINKFLAGS', '-m32')
conf.env.append_value('CFLAGS', '-m32') # check for 64-bit builds
conf.check_cfg(path='sdl2-config', args='--cflags --libs', package='', uselib_store='SDL2') # TODO: check 32-bit toolchain and dependencies
if conf.env.DEST_CPU == 'x86_64' and not conf.options.amd64:
conf.env.append_value('LINKFLAGS', '-m32')
conf.env.append_value('CFLAGS', '-m32')
print('NOTE: will build engine with 64-bit toolchain using -m32')
else:
print('Warning: 64bit engine may be unstable')
# check for dedicated server build
if conf.options.dedicated:
conf.env.append_unique('DEFINES', 'XASH_DEDICATED')
conf.env.dedicated = True
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 build(bld): def build(bld):
bld( # basic build: dedicated only, no dependencies
target = 'xash', use = [];
features = 'c cprogram', source = bld.path.ant_glob([
includes = ['../common', '../pm_shared', 'common', 'server', 'client', 'client/vgui', '.' ],
source = bld.path.ant_glob([
'common/*.c', 'common/*.c',
'common/imagelib/*.c', 'common/imagelib/*.c',
'common/soundlib/*.c', 'common/soundlib/*.c',
'common/soundlib/libmpg/*.c', 'common/soundlib/libmpg/*.c',
'client/*.c', 'server/*.c'])
'client/vgui/*.c',
'client/avi/*.c', # add client files and sdl2 library
'server/*.c', if not bld.env.dedicated:
'platform/sdl/*.c']), use += ['SDL2']
use = ['SDL2', 'm', 'pthread'] source += bld.path.ant_glob([
'client/*.c',
'client/vgui/*.c',
'client/avi/*.c',
'platform/sdl/*.c'])
bld(
target = 'xash',
features = 'c cprogram',
includes = ['../common', '../pm_shared', 'common', 'server', 'client', 'client/vgui', '.' ],
source = source,
use = use
) )

Loading…
Cancel
Save