Skip to content

Commit

Permalink
waifulib/xcompile: add android-from-none for new host-clang versions,…
Browse files Browse the repository at this point in the history
… support hardfloat abi in host-clang
  • Loading branch information
mittorn committed Nov 1, 2023
1 parent d68ae53 commit ca985f3
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions scripts/waifulib/xcompile.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,15 @@ def sysroot(self):

def cflags(self, cxx = False):
cflags = []

if self.ndk_rev <= ANDROID_NDK_SYSROOT_FLAG_MAX:
android_from_none = False
if self.is_host() and self.is_arm() and self.is_hardfp():
# clang android target may change with ndk
# override target to none while compiling and
# add some android options manually
android_from_none = True
cflags += ['--target=arm-none-eabi']

if self.ndk_rev <= ANDROID_NDK_SYSROOT_FLAG_MAX and not android_from_none:
cflags += ['--sysroot=%s' % (self.sysroot())]
else:
if self.is_host():
Expand All @@ -274,8 +281,10 @@ def cflags(self, cxx = False):
]

cflags += ['-I%s' % (self.system_stl())]
if not self.is_clang():
cflags += ['-DANDROID', '-D__ANDROID__']
if not self.is_clang() or android_from_none:
cflags += ['-DANDROID', '-D__ANDROID__=1']
if android_from_none:
cflags += [ '-D__linux__=1', '-fPIC'] # TODO: compare with linux target?

if cxx and not self.is_clang() and self.toolchain not in ['4.8','4.9']:
cflags += ['-fno-sized-deallocation']
Expand All @@ -292,7 +301,7 @@ def cflags(self, cxx = False):
cflags += ['-mthumb', '-mfpu=neon', '-mcpu=cortex-a9']

if self.is_hardfp():
cflags += ['-D_NDK_MATH_NO_SOFTFP=1', '-mfloat-abi=hard', '-DLOAD_HARDFP', '-DSOFTFP_LINK']
cflags += ['-D_NDK_MATH_NO_SOFTFP=1', '-mfloat-abi=hard', '-DLOAD_HARDFP', '-DSOFTFP_LINK', '-DGLES_SOFTFLOAT']

if self.is_host():
# Clang builtin redefine w/ different calling convention bug
Expand Down

0 comments on commit ca985f3

Please sign in to comment.