Browse Source

wscript: target 64bit architecture by default

pull/322/head
nillerusr 8 months ago
parent
commit
ab527be41a
  1. 49
      wscript

49
wscript

@ -26,6 +26,21 @@ FC_CHECK='''extern "C" {
int main() { return (int)FcInit(); } int main() { return (int)FcInit(); }
''' '''
CPP_64BIT_CHECK='''
#define TEST(a) (sizeof(void*) == a ? 1 : -1)
int g_Test[TEST(8)];
int main () { return 0; }
'''
CPP_32BIT_CHECK='''
#define TEST(a) (sizeof(void*) == a ? 1 : -1)
int g_Test[TEST(4)];
int main () { return 0; }
'''
Context.Context.line_just = 55 # should fit for everything on 80x26 Context.Context.line_just = 55 # should fit for everything on 80x26
projects={ projects={
@ -155,6 +170,11 @@ def get_taskgen_count(self):
except: idx = 0 # don't set tg_idx_count to not increase counter except: idx = 0 # don't set tg_idx_count to not increase counter
return idx return idx
@Configure.conf
def run_test(self, fragment, msg):
result = self.check_cxx(fragment=fragment, msg=msg, mandatory = False)
return False if result == None else True
def define_platform(conf): def define_platform(conf):
conf.env.DEDICATED = conf.options.DEDICATED conf.env.DEDICATED = conf.options.DEDICATED
conf.env.TESTS = conf.options.TESTS conf.env.TESTS = conf.options.TESTS
@ -162,6 +182,12 @@ def define_platform(conf):
conf.env.GL = conf.options.GL and not conf.options.TESTS and not conf.options.DEDICATED conf.env.GL = conf.options.GL and not conf.options.TESTS and not conf.options.DEDICATED
conf.env.OPUS = conf.options.OPUS conf.env.OPUS = conf.options.OPUS
arch32 = conf.run_test(CPP_32BIT_CHECK, 'Testing 32bit support')
arch64 = conf.run_test(CPP_64BIT_CHECK, 'Testing 64bit support')
if not (arch32 ^ arch64):
conf.fatal('Your compiler sucks')
if conf.options.DEDICATED: if conf.options.DEDICATED:
conf.options.SDL = False conf.options.SDL = False
conf.define('DEDICATED', 1) conf.define('DEDICATED', 1)
@ -186,7 +212,7 @@ def define_platform(conf):
conf.env.SDL = 1 conf.env.SDL = 1
conf.define('USE_SDL', 1) conf.define('USE_SDL', 1)
if conf.options.ALLOW64: if arch64:
conf.define('PLATFORM_64BITS', 1) conf.define('PLATFORM_64BITS', 1)
if conf.env.DEST_OS == 'linux': if conf.env.DEST_OS == 'linux':
@ -252,11 +278,14 @@ def define_platform(conf):
'NDEBUG' 'NDEBUG'
]) ])
conf.define('GIT_COMMIT_HASH', conf.env.GIT_VERSION)
def options(opt): def options(opt):
grp = opt.add_option_group('Common options') grp = opt.add_option_group('Common options')
grp.add_option('-8', '--64bits', action = 'store_true', dest = 'ALLOW64', default = False, grp.add_option('-4', '--32bits', action = 'store_true', dest = 'TARGET32', default = False,
help = 'allow targetting 64-bit engine(Linux/Windows/OSX x86 only) [default: %default]') help = 'allow targetting 32-bit engine(Linux/Windows/OSX x86 only) [default: %default]')
grp.add_option('-d', '--dedicated', action = 'store_true', dest = 'DEDICATED', default = False, grp.add_option('-d', '--dedicated', action = 'store_true', dest = 'DEDICATED', default = False,
help = 'build dedicated server [default: %default]') help = 'build dedicated server [default: %default]')
@ -410,9 +439,10 @@ def configure(conf):
# subsystem=bld.env.MSVC_SUBSYSTEM # subsystem=bld.env.MSVC_SUBSYSTEM
# TODO: wrapper around bld.stlib, bld.shlib and so on? # TODO: wrapper around bld.stlib, bld.shlib and so on?
conf.env.MSVC_SUBSYSTEM = 'WINDOWS,5.01' conf.env.MSVC_SUBSYSTEM = 'WINDOWS,5.01'
conf.env.MSVC_TARGETS = ['x86'] # explicitly request x86 target for MSVC conf.env.MSVC_TARGETS = ['x64'] # explicitly request x86 target for MSVC
if conf.options.ALLOW64: if conf.options.TARGET32:
conf.env.MSVC_TARGETS = ['x64'] conf.env.MSVC_TARGETS = ['x32']
if sys.platform == 'win32': if sys.platform == 'win32':
conf.load('msvc_pdb_ext msdev msvs') conf.load('msvc_pdb_ext msdev msvs')
conf.load('subproject xcompile compiler_c compiler_cxx gitversion clang_compilation_database strip_on_install_v2 waf_unit_test enforce_pic') conf.load('subproject xcompile compiler_c compiler_cxx gitversion clang_compilation_database strip_on_install_v2 waf_unit_test enforce_pic')
@ -421,9 +451,6 @@ def configure(conf):
elif conf.env.DEST_OS == 'darwin': elif conf.env.DEST_OS == 'darwin':
conf.load('mm_hook') conf.load('mm_hook')
define_platform(conf)
conf.define('GIT_COMMIT_HASH', conf.env.GIT_VERSION)
if conf.env.TOGLES: if conf.env.TOGLES:
projects['game'] += ['togles'] projects['game'] += ['togles']
elif conf.env.GL: elif conf.env.GL:
@ -435,11 +462,13 @@ def configure(conf):
if conf.options.OPUS or conf.env.DEST_OS == 'android': if conf.options.OPUS or conf.env.DEST_OS == 'android':
projects['game'] += ['engine/voice_codecs/opus'] projects['game'] += ['engine/voice_codecs/opus']
conf.env.BIT32_MANDATORY = not conf.options.ALLOW64 conf.env.BIT32_MANDATORY = conf.options.TARGET32
if conf.env.BIT32_MANDATORY: if conf.env.BIT32_MANDATORY:
Logs.info('WARNING: will build engine for 32-bit target') Logs.info('WARNING: will build engine for 32-bit target')
conf.load('force_32bit') conf.load('force_32bit')
define_platform(conf)
if conf.options.DISABLE_WARNS: if conf.options.DISABLE_WARNS:
compiler_optional_flags = ['-w'] compiler_optional_flags = ['-w']
else: else:

Loading…
Cancel
Save