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

engine: nswitch: fix compiling by removing stdc++ from SDL2 dependencies as we link it later (#1519)

This commit is contained in:
Alibek Omarov 2023-12-02 20:25:51 +03:00 committed by GitHub
parent f0a2362da3
commit 273bccdc9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,14 +49,14 @@ def configure(conf):
# re-enable undefined reference errors
conf.env.CXXFLAGS += ['-Wl,--no-undefined']
conf.env.CFLAGS += ['-Wl,--no-undefined']
# allow the SDL2 sanity check to complete properly by linking in libstdc++ and lm normally
conf.env.LDFLAGS += ['-lstdc++', '-lm']
# allow the SDL2 sanity check to complete properly by linking in lm normally
conf.env.LDFLAGS += ['-lm']
conf.load('sdl2')
if not conf.env.HAVE_SDL2:
conf.fatal('SDL2 not availiable! Install switch-sdl2!')
conf.define('XASH_SDL', 2)
# then remove them to avoid them getting linked to shared objects
conf.env.LDFLAGS.remove('-lstdc++')
conf.env.LIB_SDL2.remove('stdc++') # remove libstdc++ linking from SDL2, we link it later
conf.env.LDFLAGS.remove('-lm')
elif conf.env.DEST_OS == 'psvita':
# allow the SDL2 sanity check to complete properly by linking in some deps missing from the pkg-config file
@ -189,7 +189,7 @@ def build(bld):
# HACK: link in the entirety of libstdc++ so that dynamic libs could use all of it without manual exporting
# we can't do this right away because std::filesystem will complain about not having pathconf(),
# which we have defined in sys_nswitch.c
bld.env.LDFLAGS += ['-Wl,--whole-archive', '-lstdc++', '-Wl,--no-whole-archive', '-lm']
bld.env.LDFLAGS += ['-v', '-Wl,--whole-archive', '-lstdc++', '-Wl,--no-whole-archive', '-lm']
if bld.env.DEST_OS == 'psvita':
libs += [ 'VRTLD' ]
@ -225,13 +225,9 @@ def build(bld):
# Switch and PSVita have custom parameters
if bld.env.DEST_OS in ['nswitch', 'psvita']:
program = 'cxxprogram'
if bld.env.DEST_OS == 'nswitch':
program = 'cprogram' # avoid linking with g++, we link standard library explicitly
bld(source = source,
target = 'xash',
features = ['c', program],
features = 'c cxxprogram',
includes = includes,
use = libs,
install_path = None,