From 9aff6ca63379f39d117fcdf6c675f200e710f1dd Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 28 Oct 2019 01:47:18 +0300 Subject: [PATCH] engine: wscript: support building for MotoMAGX --- engine/wscript | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/engine/wscript b/engine/wscript index 38f9826f..7963e047 100644 --- a/engine/wscript +++ b/engine/wscript @@ -20,12 +20,26 @@ def options(opt): grp.add_option('--enable-custom-swap', action = 'store_true', dest = 'CUSTOM_SWAP', default = False, help = 'enable custom swap allocator. For devices with no swap support') + grp.add_option('--enable-magx', action = 'store_true', dest = 'MAGX', default = False, + help = 'enable targetting for MotoMAGX phones [default: %default]') + grp.add_option('--enable-legacy-sdl', action = 'store_true', dest = 'SDL12', default = False, help = 'enable using SDL1.2 instead of SDL2(not recommended) [default: %default') opt.load('sdl2') def configure(conf): + conf.env.MAGX = conf.options.MAGX + if conf.options.MAGX: + # useless to change toolchain path, as toolchain meant to be placed in this path + toolchain_path = '/opt/toolchains/motomagx/arm-eabi2/lib/' + conf.env.INCLUDES_MAGX = [toolchain_path + i for i in ['ezx-z6/include', 'qt-2.3.8/include']] + conf.env.LIBPATH_MAGX = [toolchain_path + i for i in ['ezx-z6/lib', 'qt-2.3.8/lib']] + conf.env.LINKFLAGS_MAGX = ['-Wl,-rpath-link=' + i for i in conf.env.LIBPATH_MAGX] + for lib in ['qte-mt', 'ezxappbase', 'ezxpm', 'log_util']: + conf.check_cc(lib=lib, use='MAGX', uselib_store='MAGX') + conf.options.SDL12 = True + # check for dedicated server build if conf.options.DEDICATED: if conf.env.DEST_OS == 'linux': @@ -69,6 +83,7 @@ def configure(conf): conf.define_cond('PSAPI_VERSION', conf.env.DEST_OS == 'win32') # will be defined as 1 def build(bld): + is_cxx_link = False libs = [ 'public' ] source = bld.path.ant_glob([ 'common/*.c', @@ -96,6 +111,11 @@ def build(bld): libs.append('SDL2') source += bld.path.ant_glob(['platform/sdl/*.c']) + if bld.env.MAGX: + libs.append('MAGX') + source += bld.path.ant_glob(['platform/magx/*.cpp']) + is_cxx_link = True + if bld.env.DEST_OS == 'android': libs += ['LOG', 'EGL', 'ANDROID'] source += bld.path.ant_glob(['platform/android/*.cpp', 'platform/android/*.c', 'platform/linux/*.c']) @@ -112,10 +132,10 @@ def build(bld): if bld.env.SINGLE_BINARY: install_path = bld.env.BINDIR - features = 'c cprogram' + features = ['c', 'cxxprogram' if is_cxx_link else 'cprogram'] else: install_path = bld.env.LIBDIR - features = 'c cshlib' + features = ['c', 'cxxshlib' if is_cxx_link else 'cshlib'] bld(source = source, target = 'xash',