mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-22 09:56:22 +01:00
wscript: refactor cflags appending, add optional polyhedral optimizations
This commit is contained in:
parent
ae624801ac
commit
7782fa09ac
55
wscript
55
wscript
@ -61,6 +61,9 @@ def options(opt):
|
|||||||
grp.add_option('--enable-lto', action = 'store_true', dest = 'LTO', default = False,
|
grp.add_option('--enable-lto', action = 'store_true', dest = 'LTO', default = False,
|
||||||
help = 'enable Link Time Optimization [default: %default]')
|
help = 'enable Link Time Optimization [default: %default]')
|
||||||
|
|
||||||
|
grp.add_option('--enable-poly-opt', action = 'store_true', dest = 'POLLY', default = False,
|
||||||
|
help = 'enable polyhedral optimization if possible [default: %default]')
|
||||||
|
|
||||||
opt.load('subproject')
|
opt.load('subproject')
|
||||||
|
|
||||||
opt.add_subproject(subdirs())
|
opt.add_subproject(subdirs())
|
||||||
@ -210,28 +213,46 @@ def configure(conf):
|
|||||||
'-Werror=declaration-after-statement'
|
'-Werror=declaration-after-statement'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
linkflags = conf.get_flags_by_type(linker_flags, conf.options.BUILD_TYPE, conf.env.COMPILER_CC)
|
||||||
conf.env.append_unique('LINKFLAGS', conf.get_flags_by_type(
|
|
||||||
linker_flags, conf.options.BUILD_TYPE, conf.env.COMPILER_CC))
|
|
||||||
|
|
||||||
cflags = conf.get_flags_by_type(compiler_c_cxx_flags, conf.options.BUILD_TYPE, conf.env.COMPILER_CC)
|
cflags = conf.get_flags_by_type(compiler_c_cxx_flags, conf.options.BUILD_TYPE, conf.env.COMPILER_CC)
|
||||||
if conf.env.COMPILER_CC == 'msvc':
|
|
||||||
conf.env.append_unique('CFLAGS', cflags)
|
# Here we don't differentiate C or C++ flags
|
||||||
conf.env.append_unique('CXXFLAGS', cflags)
|
if conf.options.LTO:
|
||||||
else:
|
lto_cflags = {
|
||||||
|
'msvc': ['/GL'],
|
||||||
|
'gcc': ['-flto'],
|
||||||
|
'clang': ['-flto']
|
||||||
|
}
|
||||||
|
|
||||||
|
lto_linkflags = {
|
||||||
|
'msvc': ['/LTCG'],
|
||||||
|
'gcc': ['-flto'],
|
||||||
|
'clang': ['-flto']
|
||||||
|
}
|
||||||
|
cflags += conf.get_flags_by_compiler(lto_cflags, conf.env.COMPILER_CC)
|
||||||
|
linkflags += conf.get_flags_by_compiler(lto_linkflags, conf.env.COMPILER_CC)
|
||||||
|
|
||||||
|
if conf.options.POLLY:
|
||||||
|
polly_cflags = {
|
||||||
|
'gcc': ['-fgraphite-identity'],
|
||||||
|
'clang': ['-mllvm', '-polly']
|
||||||
|
# msvc sosat :(
|
||||||
|
}
|
||||||
|
|
||||||
|
cflags += conf.get_flags_by_compiler(polly_cflags, conf.env.COMPILER_CC)
|
||||||
|
|
||||||
|
# And here C++ flags starts to be treated separately
|
||||||
|
cxxflags = list(cflags)
|
||||||
|
if conf.env.COMPILER_CC != 'msvc':
|
||||||
conf.check_cc(cflags=cflags, msg= 'Checking for required C flags')
|
conf.check_cc(cflags=cflags, msg= 'Checking for required C flags')
|
||||||
conf.check_cxx(cxxflags=cflags, msg= 'Checking for required C++ flags')
|
conf.check_cxx(cxxflags=cflags, msg= 'Checking for required C++ flags')
|
||||||
|
|
||||||
conf.env.append_unique('CFLAGS', cflags + conf.filter_cflags(compiler_optional_flags + c_compiler_optional_flags, cflags, False))
|
cflags += conf.filter_cflags(compiler_optional_flags + c_compiler_optional_flags, cflags, False)
|
||||||
conf.env.append_unique('CXXFLAGS', cflags + conf.filter_cflags(compiler_optional_flags, cflags, True))
|
cxxflags += conf.filter_cflags(compiler_optional_flags, cflags, True)
|
||||||
|
|
||||||
if conf.options.LTO:
|
conf.env.append_unique('CFLAGS', cflags)
|
||||||
if conf.env.COMPILER_CC == 'gcc' or conf.env.COMPILER_CC == 'clang':
|
conf.env.append_unique('CXXFLAGS', cxxflags)
|
||||||
conf.env.append_unique('CFLAGS', '-flto')
|
conf.env.append_unique('LINKFLAGS', linkflags)
|
||||||
conf.env.append_unique('LINKFLAGS', '-flto')
|
|
||||||
elif conf.env.COMPILER_CC == 'msvc':
|
|
||||||
conf.env.append_unique('CFLAGS', '/GL')
|
|
||||||
conf.env.append_unique('LINKFLAGS', '/LTCG')
|
|
||||||
|
|
||||||
conf.env.DEDICATED = conf.options.DEDICATED
|
conf.env.DEDICATED = conf.options.DEDICATED
|
||||||
# we don't need game launcher on dedicated
|
# we don't need game launcher on dedicated
|
||||||
|
Loading…
Reference in New Issue
Block a user