2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-25 11:19:59 +01:00
xash3d-fwgs/filesystem/wscript
2023-03-11 07:09:14 +03:00

53 lines
1.6 KiB
Python

#!/usr/bin/env python
from waflib.Tools import waf_unit_test
def options(opt):
grp = opt.add_option_group('filesystem_stdio options')
grp.add_option('--enable-fs-tests', action='store_true', dest = 'FS_TESTS', default = False,
help = 'enable filesystem_stdio tests')
def configure(conf):
nortti = {
'msvc': ['/GR-'],
'default': ['-fno-rtti', '-fno-exceptions']
}
conf.env.append_unique('CXXFLAGS', conf.get_flags_by_compiler(nortti, conf.env.COMPILER_CC))
conf.env.FS_TESTS = conf.options.FS_TESTS
if conf.env.DEST_OS != 'android':
if conf.env.cxxshlib_PATTERN.startswith('lib'):
conf.env.cxxshlib_PATTERN = conf.env.cxxshlib_PATTERN[3:]
def build(bld):
bld(name = 'filesystem_includes', export_includes = '.')
libs = [ 'filesystem_includes' ]
# on PSVita do not link any libraries that are already in the main executable, but add the includes target
if bld.env.DEST_OS == 'psvita':
libs += [ 'sdk_includes' ]
else:
libs += [ 'public' ]
bld.shlib(target = 'filesystem_stdio',
features = 'cxx',
source = bld.path.ant_glob(['*.c', '*.cpp']),
use = libs,
install_path = bld.env.LIBDIR,
subsystem = bld.env.MSVC_SUBSYSTEM)
if bld.env.FS_TESTS:
# build in same module, so dynamic linking will work
# for now (until we turn libpublic to shared module lol)
bld.program(features = 'test',
source = 'tests/caseinsensitive.c',
target = 'test_caseinsensitive',
use = libs + [ 'DL' ],
rpath = '$ORIGIN',
subsystem = bld.env.CONSOLE_SUBSYSTEM,
install_path = None)
bld.add_post_fun(waf_unit_test.summary)
bld.add_post_fun(waf_unit_test.set_exit_code)