def load_darwin_x64_android_armv7_gcc_common_settings(conf): """ Setup all compiler and linker settings shared over all darwin_x64_android_armv7_gcc configurations """ env = conf.env # load the toolchains ndk_root = env['ANDROID_NDK_HOME'] toolchain_path = os.path.join(ndk_root, 'toolchains', 'arm-linux-androideabi-4.9', 'prebuilt', 'darwin-x86_64', 'bin') ndk_toolchains = { 'CC' : 'arm-linux-androideabi-gcc', 'CXX' : 'arm-linux-androideabi-g++', 'AR' : 'arm-linux-androideabi-ar', 'STRIP' : 'arm-linux-androideabi-strip', } if not conf.load_android_toolchains([toolchain_path], **ndk_toolchains): conf.fatal('[ERROR] android_armv7_gcc setup failed') if not conf.load_android_tools(): conf.fatal('[ERROR] android_armv7_gcc setup failed') # common settings target_arch_flag = [ '-march=armv7-a' # armeabi-v7a ] env['CFLAGS'] += target_arch_flag[:] env['CXXFLAGS'] += target_arch_flag[:] env['LINKFLAGS'] += target_arch_flag[:]
def load_win_x64_android_armv7_clang_common_settings(conf): """ Setup all compiler and linker settings shared over all win_x64_android_armv7_clang configurations """ env = conf.env # load the toolchains ndk_root = env['ANDROID_NDK_HOME'] gcc_toolchain_root = os.path.join(ndk_root, 'toolchains', 'arm-linux-androideabi-4.9', 'prebuilt', 'windows-x86_64') gcc_toolchain_path = os.path.join(gcc_toolchain_root, 'bin') clang_toolchain_path = os.path.join(ndk_root, 'toolchains', 'llvm', 'prebuilt', 'windows-x86_64', 'bin') ndk_toolchains = { 'CC': 'clang', 'CXX': 'clang++', 'AR': 'arm-linux-androideabi-ar', 'STRIP': 'arm-linux-androideabi-strip', } if not conf.load_android_toolchains( [clang_toolchain_path, gcc_toolchain_path], **ndk_toolchains): conf.fatal('[ERROR] android_armv7_clang setup failed') if not conf.load_android_tools(): conf.fatal('[ERROR] android_armv7_clang setup failed') # common settings gcc_toolchain = '--gcc-toolchain={}'.format(gcc_toolchain_root) target_arch = '--target=armv7-none-linux-androideabi' # <arch><sub>-<vendor>-<sys>-<abi> common_flags = [ gcc_toolchain, target_arch, ] env['CFLAGS'] += common_flags[:] env['CXXFLAGS'] += common_flags[:] env['LINKFLAGS'] += common_flags[:] azcg_dir = conf.srcnode.make_node( 'Tools/AzCodeGenerator/bin/vc140').abspath() if not os.path.exists(azcg_dir): azcg_dir = conf.srcnode.make_node( 'Tools/AzCodeGenerator/bin/vc120').abspath() if not os.path.exists(azcg_dir): conf.fatal( 'Unable to locate the AzCodeGenerator subfolder. Make sure that you have either the VS2013 or VS2015 binaries available' ) env['CODE_GENERATOR_PATH'] = [azcg_dir]
def load_darwin_x64_android_armv7_clang_common_settings(conf): """ Setup all compiler and linker settings shared over all darwin_x64_android_armv7_clang configurations """ env = conf.env # load the toolchains ndk_root = env['ANDROID_NDK_HOME'] gcc_toolchain_root = os.path.join(ndk_root, 'toolchains', 'arm-linux-androideabi-4.9', 'prebuilt', 'darwin-x86_64') gcc_toolchain_path = os.path.join(gcc_toolchain_root, 'bin') clang_toolchain_path = os.path.join(ndk_root, 'toolchains', 'llvm', 'prebuilt', 'darwin-x86_64', 'bin') ndk_toolchains = { 'CC' : 'clang', 'CXX' : 'clang++', 'AR' : 'arm-linux-androideabi-ar', 'STRIP' : 'arm-linux-androideabi-strip', } if not conf.load_android_toolchains([clang_toolchain_path, gcc_toolchain_path], **ndk_toolchains): conf.fatal('[ERROR] android_armv7_clang setup failed') if not conf.load_android_tools(): conf.fatal('[ERROR] android_armv7_clang setup failed') # common settings gcc_toolchain = '--gcc-toolchain={}'.format(gcc_toolchain_root) target_arch = '--target=armv7-none-linux-androideabi' # <arch><sub>-<vendor>-<sys>-<abi> common_flags = [ gcc_toolchain, target_arch, ] additional_compiler_flags = [ # Unless specified, OSX is generally case-preserving but case-insensitive. Windows is the same way, however # OSX seems to behave differently when it comes to casing at the OS level where a file can be showing as # upper-case in Finder and Terminal, the OS can see it as lower-case. '-Wno-nonportable-include-path', ] env['CFLAGS'] += common_flags[:] + additional_compiler_flags[:] env['CXXFLAGS'] += common_flags[:] + additional_compiler_flags[:] env['LINKFLAGS'] += common_flags[:]
def load_win_x64_android_armv7_gcc_common_settings(conf): """ Setup all compiler and linker settings shared over all win_x64_android_armv7_gcc configurations """ env = conf.env # load the toolchains ndk_root = env['ANDROID_NDK_HOME'] toolchain_path = os.path.join(ndk_root, 'toolchains', 'arm-linux-androideabi-4.9', 'prebuilt', 'windows-x86_64', 'bin') ndk_toolchains = { 'CC': 'arm-linux-androideabi-gcc', 'CXX': 'arm-linux-androideabi-g++', 'AR': 'arm-linux-androideabi-ar', 'STRIP': 'arm-linux-androideabi-strip', } if not conf.load_android_toolchains([toolchain_path], **ndk_toolchains): conf.fatal('[ERROR] android_armv7_gcc setup failed') if not conf.load_android_tools(): conf.fatal('[ERROR] android_armv7_gcc setup failed') # common settings target_arch_flag = [ '-march=armv7-a' # armeabi-v7a ] env['CFLAGS'] += target_arch_flag[:] env['CXXFLAGS'] += target_arch_flag[:] env['LINKFLAGS'] += target_arch_flag[:] azcg_dir = conf.Path('Tools/AzCodeGenerator/bin/vc141') if not os.path.exists(azcg_dir): azcg_dir = conf.Path('Tools/AzCodeGenerator/bin/vc140') if not os.path.exists(azcg_dir): azcg_dir = conf.Path('Tools/AzCodeGenerator/bin/vc120') if not os.path.exists(azcg_dir): conf.fatal( 'Unable to locate the AzCodeGenerator subfolder. Make sure that you have either VS2013, VS2015, or VS2017 binaries available' ) env['CODE_GENERATOR_PATH'] = [azcg_dir]
def load_darwin_x64_android_armv8_clang_common_settings(conf): """ Setup all compiler and linker settings shared over all darwin_x64_android_armv8_clang configurations """ env = conf.env # load the toolchains ndk_root = env['ANDROID_NDK_HOME'] gcc_toolchain_root = os.path.join(ndk_root, 'toolchains', 'aarch64-linux-android-4.9', 'prebuilt', 'darwin-x86_64') gcc_toolchain_path = os.path.join(gcc_toolchain_root, 'bin') clang_toolchain_path = os.path.join(ndk_root, 'toolchains', 'llvm', 'prebuilt', 'darwin-x86_64', 'bin') ndk_toolchains = { 'CC': 'clang', 'CXX': 'clang++', 'AR': 'aarch64-linux-android-ar', 'STRIP': 'aarch64-linux-android-strip', } if not conf.load_android_toolchains( [clang_toolchain_path, gcc_toolchain_path], **ndk_toolchains): conf.fatal('[ERROR] android_armv8_clang setup failed') if not conf.load_android_tools(): conf.fatal('[ERROR] android_armv8_clang setup failed') # common settings gcc_toolchain = '--gcc-toolchain={}'.format(gcc_toolchain_root) target_arch = '--target=aarch64-none-linux-android' # <arch><sub>-<vendor>-<sys>-<abi> common_flags = [ gcc_toolchain, target_arch, ] env['CFLAGS'] += common_flags[:] env['CXXFLAGS'] += common_flags[:] env['LINKFLAGS'] += common_flags[:]
def load_win_x64_android_armv7_gcc_common_settings(conf): """ Setup all compiler and linker settings shared over all win_x64_android_armv7_gcc configurations """ ################################ # make sure the android sdk/ndk installs are valid if not conf.validate_android_api_version(): return False if not conf.load_android_tools(): return False if not conf.validate_android_ndk_install(): return False ################################ # load the compiler toolchain ndk_root = conf.env['NDK_ROOT'] toolchain_path = os.path.join(ndk_root, 'toolchains', 'arm-linux-androideabi-4.9', 'prebuilt', 'windows-x86_64', 'bin') if not conf.load_android_toolchains( [toolchain_path], 'arm-linux-androideabi-gcc', 'arm-linux-androideabi-g++', 'arm-linux-androideabi-gcc', 'arm-linux-androideabi-g++', 'arm-linux-androideabi-ar', 'arm-linux-androideabi-strip'): return False ################################ # common settings env = conf.env platform_root = conf.get_corrected_android_ndk_platform_includes( ndk_root, 'arch-arm') stl_root = os.path.join(ndk_root, 'sources', 'cxx-stl', 'gnu-libstdc++', '4.9') env['INCLUDES'] += [ os.path.join(platform_root, 'usr', 'include'), os.path.join(platform_root, 'usr', 'include', 'SLES'), os.path.join(stl_root, 'include'), os.path.join(stl_root, 'libs', 'armeabi-v7a', 'include'), os.path.join(conf.path.abspath(), 'Code', 'SDKs', 'SDL2', 'src', 'include'), ] env['DEFINES'] += ['__ARM_NEON__'] system_root = '--sysroot=%s' % platform_root common_flags = [ system_root, '-march=armv7-a', # armv7-a architecture '-mfloat-abi=softfp', # float ABI: hardware code gen, soft calling convention '-mfpu=neon', # enable neon, implies -mfpu=VFPv3-D32 ] env['CFLAGS'] += common_flags[:] env['CXXFLAGS'] += common_flags[:] env['LIBPATH'] += [ os.path.join(stl_root, 'libs', 'armeabi-v7a'), os.path.join(platform_root, 'usr', 'lib'), ] env['LINKFLAGS'] += [ system_root, '-march=armv7-a', # armv7-a architecture '-Wl,--fix-cortex-a8' # required to fix a bug in some Cortex-A8 implementations for neon support ] env['ANDROID_ARCH'] = 'armeabi-v7a' ################################ # required 3rd party libs that need to be included in the apk env['EXT_LIBS'] += [ os.path.join(stl_root, 'libs', 'armeabi-v7a', 'libgnustl_shared.so'), os.path.join(ndk_root, 'prebuilt', 'android-arm', 'gdbserver', 'gdbserver') ] return True