Browse Source

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

pull/2/head
Alibek Omarov 1 year ago committed by GitHub
parent
commit
273bccdc9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      engine/wscript

14
engine/wscript

@ -49,14 +49,14 @@ def configure(conf):
# re-enable undefined reference errors # re-enable undefined reference errors
conf.env.CXXFLAGS += ['-Wl,--no-undefined'] conf.env.CXXFLAGS += ['-Wl,--no-undefined']
conf.env.CFLAGS += ['-Wl,--no-undefined'] conf.env.CFLAGS += ['-Wl,--no-undefined']
# allow the SDL2 sanity check to complete properly by linking in libstdc++ and lm normally # allow the SDL2 sanity check to complete properly by linking in lm normally
conf.env.LDFLAGS += ['-lstdc++', '-lm'] conf.env.LDFLAGS += ['-lm']
conf.load('sdl2') conf.load('sdl2')
if not conf.env.HAVE_SDL2: if not conf.env.HAVE_SDL2:
conf.fatal('SDL2 not availiable! Install switch-sdl2!') conf.fatal('SDL2 not availiable! Install switch-sdl2!')
conf.define('XASH_SDL', 2) conf.define('XASH_SDL', 2)
# then remove them to avoid them getting linked to shared objects # 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') conf.env.LDFLAGS.remove('-lm')
elif conf.env.DEST_OS == 'psvita': 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 # 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 # 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(), # we can't do this right away because std::filesystem will complain about not having pathconf(),
# which we have defined in sys_nswitch.c # 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': if bld.env.DEST_OS == 'psvita':
libs += [ 'VRTLD' ] libs += [ 'VRTLD' ]
@ -225,13 +225,9 @@ def build(bld):
# Switch and PSVita have custom parameters # Switch and PSVita have custom parameters
if bld.env.DEST_OS in ['nswitch', 'psvita']: 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, bld(source = source,
target = 'xash', target = 'xash',
features = ['c', program], features = 'c cxxprogram',
includes = includes, includes = includes,
use = libs, use = libs,
install_path = None, install_path = None,

Loading…
Cancel
Save