2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-22 01:45:19 +01:00

wscript: move werror flags into uselib

This commit is contained in:
Alibek Omarov 2024-01-30 15:04:57 +03:00
parent f67736180b
commit bfcaba54dc
12 changed files with 18 additions and 22 deletions

View File

@ -125,7 +125,7 @@ def build(bld):
bld(name = 'engine_includes', export_includes = '. common common/imagelib', use = 'filesystem_includes')
is_cxx_link = False
libs = [ 'engine_includes', 'public', 'dllemu' ]
libs = [ 'engine_includes', 'public', 'dllemu', 'werror' ]
# basic build: dedicated only
source = bld.path.ant_glob([

View File

@ -18,7 +18,7 @@ def configure(conf):
def build(bld):
bld(name = 'filesystem_includes', export_includes = '.')
libs = [ 'filesystem_includes', 'sdk_includes' ]
libs = [ 'filesystem_includes', 'sdk_includes', 'werror' ]
# 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':

View File

@ -33,7 +33,7 @@ def build(bld):
bld(source = source,
target = 'xash3d', # hl.exe
features = 'c cxx cxxprogram',
use = 'sdk_includes DL USER32 SHELL32',
use = 'sdk_includes DL USER32 SHELL32 werror',
rpath = bld.env.DEFAULT_RPATH,
install_path = bld.env.BINDIR,
subsystem = bld.env.MSVC_SUBSYSTEM

View File

@ -19,7 +19,7 @@ def build(bld):
bld.stlib(source = bld.path.ant_glob('*.c'),
target = 'public',
features = 'c',
use = 'sdk_includes',
use = 'sdk_includes werror',
subsystem = bld.env.MSVC_SUBSYSTEM)
if bld.env.TESTS:

View File

@ -12,7 +12,7 @@ def configure(conf):
def build(bld):
source = bld.path.ant_glob( [ '*.c' ] )
includes = [ '.' ]
libs = [ 'engine_includes', 'sdk_includes' ]
libs = [ 'engine_includes', 'sdk_includes', 'werror' ]
bld.env.LDFLAGS += ['-fPIC']
bld.env.CFLAGS += ['-fPIC']
bld.stlib(

View File

@ -12,7 +12,7 @@ def configure(conf):
def build(bld):
source = bld.path.ant_glob( [ '*.c' ] )
includes = [ '.' ]
libs = [ 'engine_includes', 'sdk_includes' ]
libs = [ 'engine_includes', 'sdk_includes', 'werror' ]
bld.env.LDFLAGS += ['-fPIC']
bld.env.CFLAGS += ['-fPIC']
bld.stlib(

View File

@ -32,7 +32,7 @@ def configure(conf):
conf.check_cc(lib='log')
def build(bld):
libs = [ 'engine_includes' ]
libs = [ 'engine_includes', 'werror' ]
# 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', 'vgl_shim' ]

View File

@ -22,7 +22,7 @@ def configure(conf):
conf.env.append_unique('DEFINES', 'REF_DLL')
def build(bld):
libs = [ 'engine_includes' ]
libs = [ 'engine_includes', 'werror' ]
# 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' ]

View File

@ -20,7 +20,7 @@ def build(bld):
target = 'mdldec',
features = 'c cprogram',
includes = '.',
use = 'engine_includes public M',
use = 'engine_includes public M werror',
install_path = bld.env.BINDIR,
subsystem = bld.env.CONSOLE_SUBSYSTEM
)

View File

@ -18,14 +18,13 @@ def configure(conf):
def add_runner_target(bld, lib, func):
source = bld.path.ant_glob('*.c')
includes = '.'
libs = [ 'DL' ]
bld(
source = source,
target = 'run-fuzzer-' + func,
features = 'c cprogram',
includes = includes,
use = libs,
use = 'DL werror',
defines = ['FUNC="Fuzz_' + func + '"', 'LIB="' + lib + '"'],
install_path = bld.env.BINDIR,
subsystem = bld.env.CONSOLE_SUBSYSTEM

View File

@ -13,7 +13,7 @@ def build(bld):
target = 'xar',
features = 'c cprogram',
includes = '.',
use = 'public filesystem_includes',
use = 'public filesystem_includes werror',
rpath = bld.env.DEFAULT_RPATH,
install_path = bld.env.BINDIR,
subsystem = bld.env.CONSOLE_SUBSYSTEM

17
wscript
View File

@ -340,11 +340,8 @@ def configure(conf):
opt_cxxflags = [] # TODO:
cflags = conf.filter_cflags(opt_flags + opt_cflags, cflags)
cxxflags = conf.filter_cxxflags(opt_flags + opt_cxxflags, cxxflags)
conf.env.append_unique('CFLAGS', cflags)
conf.env.append_unique('CXXFLAGS', cxxflags)
conf.env.CFLAGS_werror = conf.filter_cflags(opt_flags + opt_cflags, cflags)
conf.env.CXXFLAGS_werror = conf.filter_cxxflags(opt_flags + opt_cxxflags, cxxflags)
conf.env.TESTS = conf.options.TESTS
conf.env.ENABLE_UTILS = conf.options.ENABLE_UTILS
@ -425,7 +422,7 @@ def configure(conf):
tgmath_usable = conf.check_cc(fragment='''#include<tgmath.h>
const float val = 2, val2 = 3;
int main(void){ return (int)(-asin(val) + cos(val2)); }''',
msg='Checking if tgmath.h is usable', mandatory=False, use='M')
msg='Checking if tgmath.h is usable', mandatory=False, use='M werror')
conf.define_cond('HAVE_TGMATH_H', tgmath_usable)
else:
conf.undefine('HAVE_TGMATH_H')
@ -443,7 +440,7 @@ def configure(conf):
int t2[(((64 * GB -1) % 671088649) == 268434537)
&& (((TB - (64 * GB -1) + 255) % 1792151290) == 305159546)? 1: -1];
int main(void) { return 0; }''',
msg='Checking if _FILE_OFFSET_BITS can be defined to 64', mandatory=False)
msg='Checking if _FILE_OFFSET_BITS can be defined to 64', mandatory=False, use='werror')
if file_offset_bits_usable:
conf.define('_FILE_OFFSET_BITS', 64)
else: conf.undefine('_FILE_OFFSET_BITS')
@ -455,9 +452,9 @@ int main(int argc, char **argv) { strcasestr(argv[1], argv[2]); return 0; }'''
int main(int argc, char **argv) { strchrnul(argv[1], 'x'); return 0; }'''
def check_gnu_function(frag, msg, define):
if conf.check_cc(msg=msg, mandatory=False, fragment=frag):
if conf.check_cc(msg=msg, mandatory=False, fragment=frag, use='werror'):
conf.define(define, 1)
elif conf.check_cc(msg='... with _GNU_SOURCE?', mandatory=False, fragment=frag, defines='_GNU_SOURCE=1'):
elif conf.check_cc(msg='... with _GNU_SOURCE?', mandatory=False, fragment=frag, defines='_GNU_SOURCE=1', use='werror'):
conf.define(define, 1)
conf.define('_GNU_SOURCE', 1)
check_gnu_function(strcasestr_frag, 'Checking for strcasestr', 'HAVE_STRCASESTR')
@ -484,7 +481,7 @@ int main(int argc, char **argv) { strchrnul(argv[1], 'x'); return 0; }'''
frag='''#include <opus_custom.h>
int main(void) { return !opus_custom_encoder_init((OpusCustomEncoder *)1, (const OpusCustomMode *)1, 1); }'''
if conf.check_cc(msg='Checking if opus supports custom modes', defines='CUSTOM_MODES=1', use='opus', fragment=frag, mandatory=False):
if conf.check_cc(msg='Checking if opus supports custom modes', defines='CUSTOM_MODES=1', use='opus werror', fragment=frag, mandatory=False):
conf.env.HAVE_SYSTEM_OPUS = True
conf.define('XASH_LOW_MEMORY', conf.options.LOW_MEMORY)