engine: wscript: ensure we always add needed features when mixing C and C++ objects. Simplify bld call for all platforms

This commit is contained in:
Alibek Omarov 2024-10-23 23:22:23 +03:00
parent a15c1f99b2
commit f7eb8cd913

View file

@ -235,41 +235,41 @@ def build(bld):
is_cxx_link = True is_cxx_link = True
libs += ['opus', 'bzip2', 'MultiEmulator'] libs += ['opus', 'bzip2', 'MultiEmulator']
includes = ['server', 'client', 'client/vgui' ] rpath = bld.env.DEFAULT_RPATH
# 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']:
rpath = None
install_path = None
features = 'cxx c cxxprogram cprogram'
# Always build as shared library on Android
elif bld.env.DISABLE_LAUNCHER and bld.env.DEST_OS != 'android':
install_path = bld.env.BINDIR
if bld.env.STATIC:
features = 'cxx c cxxprogram_static cprogram_static'
elif is_cxx_link:
features = 'cxx c cxxprogram cprogram'
else:
features = 'c cprogram'
else:
install_path = bld.env.LIBDIR
if is_cxx_link:
features = 'cxx c cxxshlib cshlib'
else:
features = 'c cshlib'
bld(source = source, bld(source = source,
target = 'xash', target = 'xash',
features = 'c cxxprogram', features = features,
includes = includes, includes = 'server client client/vgui',
use = libs, use = libs,
install_path = None, install_path = install_path,
nro_install_path = bld.env.BINDIR, nro_install_path = bld.env.BINDIR,
nacp = 'platform/nswitch/xash3d-fwgs.nacp', nacp = 'platform/nswitch/xash3d-fwgs.nacp',
icon = 'platform/nswitch/icon.jpg', icon = 'platform/nswitch/icon.jpg',
sce_sys = 'platform/psvita/sce_sys', sce_sys = 'platform/psvita/sce_sys',
title_id = 'XASH10000', title_id = 'XASH10000',
app_name = 'xash3d-fwgs' app_name = 'xash3d-fwgs',
)
else:
# always build as shared library on Android
if bld.env.DISABLE_LAUNCHER and bld.env.DEST_OS != "android":
install_path = bld.env.BINDIR
program = 'cxxprogram' if is_cxx_link else 'cprogram'
if bld.env.STATIC:
program += '_static'
features = ['c', program]
else:
install_path = bld.env.LIBDIR
features = ['c', 'cxxshlib' if is_cxx_link else 'cshlib']
bld(source = source,
target = 'xash',
features = features,
includes = includes,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM, subsystem = bld.env.MSVC_SUBSYSTEM,
rpath = bld.env.DEFAULT_RPATH, rpath = rpath,
) )