wscript: remove hacky logic determening valid target when crosscompiling to 32-bit x86

This commit is contained in:
Alibek Omarov 2025-05-27 20:50:08 +03:00
parent f9a9aedea5
commit 78ef00a269
6 changed files with 19 additions and 35 deletions

View File

@ -75,13 +75,8 @@ def configure(conf):
conf.fatal('Can\'t find libbacktrace submodule. Run `git submodule update --init --recursive`.')
return
if conf.env.DEST_SIZEOF_VOID_P == 8:
conf.define('BACKTRACE_ELF_SIZE', 64)
conf.define('BACKTRACE_XCOFF_SIZE', 64)
else:
conf.define('BACKTRACE_ELF_SIZE', 32)
conf.define('BACKTRACE_XCOFF_SIZE', 32)
conf.define('BACKTRACE_ELF_SIZE', 64 if conf.env.DEST_SIZEOF_VOID_P == 8 else 32)
conf.define('BACKTRACE_XCOFF_SIZE', 64 if conf.env.DEST_SIZEOF_VOID_P == 8 else 32)
conf.define('_ALL_SOURCE', 1)
conf.define('_GNU_SOURCE', 1)
conf.define('_POSIX_PTHREAD_SEMANTICS', 1)

2
3rdparty/maintui vendored

@ -1 +1 @@
Subproject commit 0b6ee5b2d8d65117f54b071f0fb3a68d63d4e725
Subproject commit a136560e3fecb2d4d965d798b0fad59c32ac0a9e

View File

@ -267,9 +267,7 @@ def get_optimization_flags(conf):
if conf.env.COMPILER_CC in ['gcc', 'clang'] and conf.env.DEST_OS not in ['android']:
# HLSDK by default compiles with these options under Linux
# no reason for us to not do the same
# TODO: fix DEST_CPU in force 32 bit mode
if conf.env.DEST_CPU == 'x86' or (conf.env.DEST_CPU == 'x86_64' and conf.env.DEST_SIZEOF_VOID_P == 4):
if conf.env.DEST_CPU == 'x86':
cflags.append('-march=pentium-m')
cflags.append('-mtune=core2')

View File

@ -28,16 +28,12 @@ def options(opt):
@conf
def check_vgui(conf):
if conf.env.DEST_CPU == 'x86' or (conf.env.DEST_CPU == 'x86_64' and conf.env.DEST_SIZEOF_VOID_P == 4):
vgui_dest_cpu = 'x86' # link with 32-bit binary when crosscompiling to 32-bit
else: vgui_dest_cpu = conf.env.DEST_CPU
if not conf.options.ENABLE_UNSUPPORTED_VGUI:
conf.start_msg('Does this architecture support VGUI?')
if vgui_dest_cpu != 'x86':
if conf.env.DEST_CPU != 'x86':
conf.end_msg('no')
Logs.warn('vgui is not supported on this CPU: ' + str(vgui_dest_cpu))
Logs.warn('vgui is not supported on this CPU: ' + str(conf.env.DEST_CPU))
return False
else: conf.end_msg('yes')
@ -64,25 +60,25 @@ def check_vgui(conf):
if conf.env.DEST_OS == 'win32':
conf.env.LIB_VGUI = ['vgui']
libpath = os.path.join(libpath, 'win32_vc6')
if vgui_dest_cpu != 'x86':
if conf.env.DEST_CPU != 'x86':
# for 32-bit x86 it's expected to be under win32_vc6
# for others, it's expected to be under win32_vc6 subdirectory matching CPU arch (x86_64 for 64-bit CPUs)
libpath = os.path.join(libpath, vgui_dest_cpu)
libpath = os.path.join(libpath, conf.env.DEST_CPU)
conf.env.LIBPATH_VGUI = [libpath]
elif conf.env.DEST_OS == 'linux':
conf.env.LIB_VGUI = [':vgui.so']
if vgui_dest_cpu != 'x86':
libpath = os.path.join(libpath, vgui_dest_cpu)
if conf.env.DEST_CPU != 'x86':
libpath = os.path.join(libpath, conf.env.DEST_CPU)
conf.env.LIBPATH_VGUI = [libpath]
elif conf.env.DEST_OS == 'darwin':
if vgui_dest_cpu != 'x86':
conf.env.LDFLAGS_VGUI = [os.path.join(libpath, vgui_dest_cpu, 'vgui.dylib')]
if conf.env.DEST_CPU != 'x86':
conf.env.LDFLAGS_VGUI = [os.path.join(libpath, conf.env.DEST_CPU, 'vgui.dylib')]
else:
conf.env.LDFLAGS_VGUI = [os.path.join(libpath, 'vgui.dylib')]
else:
# TODO: figure out what to do here
conf.env.LIB_VGUI = ['vgui']
conf.env.LIBPATH_VGUI = [os.path.join(libpath, conf.env.DEST_OS, vgui_dest_cpu)]
conf.env.LIBPATH_VGUI = [os.path.join(libpath, conf.env.DEST_OS, conf.env.DEST_CPU)]
conf.env.INCLUDES_VGUI = [os.path.abspath(os.path.join(vgui_dev, 'include'))]

10
waf vendored

File diff suppressed because one or more lines are too long

View File

@ -278,13 +278,8 @@ def configure(conf):
else:
force_32bit = conf.options.FORCE32
# FIXME: move this whole logic to force_32bit.py, and ensure
# DEST_SIZEOF_VOID_P is always set
if force_32bit:
Logs.info('WARNING: will build engine for 32-bit target')
conf.force_32bit(True)
else:
conf.env.DEST_SIZEOF_VOID_P = 4 if conf.check_32bit() else 8
conf.force_32bit()
cflags, linkflags = conf.get_optimization_flags()
cxxflags = list(cflags) # optimization flags are common between C and C++ but we need a copy