2022-07-01 18:37:21 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2022-12-26 16:58:44 +01:00
|
|
|
from waflib.Tools import waf_unit_test
|
|
|
|
|
2022-07-01 18:37:21 +02:00
|
|
|
def options(opt):
|
2022-12-26 16:58:44 +01:00
|
|
|
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')
|
2022-07-01 18:37:21 +02:00
|
|
|
|
|
|
|
def configure(conf):
|
2022-08-01 12:34:44 +02:00
|
|
|
nortti = {
|
|
|
|
'msvc': ['/GR-'],
|
|
|
|
'default': ['-fno-rtti', '-fno-exceptions']
|
|
|
|
}
|
|
|
|
conf.env.append_unique('CXXFLAGS', conf.get_flags_by_compiler(nortti, conf.env.COMPILER_CC))
|
2022-08-06 19:16:04 +02:00
|
|
|
|
2022-12-26 16:58:44 +01:00
|
|
|
conf.env.FS_TESTS = conf.options.FS_TESTS
|
|
|
|
|
2022-08-06 19:16:04 +02:00
|
|
|
if conf.env.DEST_OS != 'android':
|
|
|
|
if conf.env.cxxshlib_PATTERN.startswith('lib'):
|
|
|
|
conf.env.cxxshlib_PATTERN = conf.env.cxxshlib_PATTERN[3:]
|
2022-07-01 18:37:21 +02:00
|
|
|
|
|
|
|
def build(bld):
|
2022-09-10 18:56:12 +02:00
|
|
|
bld(name = 'filesystem_includes', export_includes = '.')
|
2023-02-13 20:53:17 +01:00
|
|
|
|
|
|
|
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' ]
|
|
|
|
|
2022-07-01 18:37:21 +02:00
|
|
|
bld.shlib(target = 'filesystem_stdio',
|
2022-08-01 12:34:44 +02:00
|
|
|
features = 'cxx',
|
2022-07-11 02:58:59 +02:00
|
|
|
source = bld.path.ant_glob(['*.c', '*.cpp']),
|
2023-02-13 20:53:17 +01:00
|
|
|
use = libs,
|
2022-07-01 18:37:21 +02:00
|
|
|
install_path = bld.env.LIBDIR,
|
|
|
|
subsystem = bld.env.MSVC_SUBSYSTEM)
|
2022-12-26 16:58:44 +01:00
|
|
|
|
|
|
|
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',
|
2023-02-13 20:53:17 +01:00
|
|
|
use = libs + [ 'DL' ],
|
2022-12-26 16:58:44 +01:00
|
|
|
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)
|