Skip to content

Commit 617b050

Browse files
authored
Fix android build with ndk 19 (#1208)
* Fix android build with ndk 19 * Set android platform for ndk 19 using meta json
1 parent 07a7be8 commit 617b050

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

toolchain/android-toolchain-clang.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141

4242
<exe name="clang++" />
4343
<flag value="--target=${ABITRIPLE}${HXCPP_ANDROID_PLATFORM}" />
44-
44+
<cppflag value="-stdlib=libc++" unless="NDKV20+" />
45+
4546
<!-- File Related -->
4647
<include name="toolchain/common-defines.xml" />
4748
<flag value="-I${HXCPP}/include"/>
@@ -88,6 +89,7 @@
8889
<!-- Build time error, not run time -->
8990
<flag value="-Wl,--no-undefined" unless="HXCPP_ALLOW_UNDEFINED" />
9091

92+
<flag value="-stdlib=libc++" unless="NDKV20+" />
9193
<flag value ="-static-libstdc++" />
9294
<!-- This shows the android link line, which may be so long that it breaks the tool
9395
https://github.com/HaxeFoundation/hxcpp/pull/1091

toolchain/android-toolchain.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<setup name="androidNdk" />
44

5-
<include name="toolchain/android-toolchain-clang.xml" if="NDKV20+" />
6-
<include name="toolchain/android-toolchain-gcc.xml" unless="NDKV20+" />
5+
<include name="toolchain/android-toolchain-clang.xml" if="NDKV19+" />
6+
<include name="toolchain/android-toolchain-gcc.xml" unless="NDKV19+" />
77

88
</xml>

tools/hxcpp/Setup.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ class Setup
519519
if (defines.exists('HXCPP_ANDROID_PLATFORM')) {
520520
Log.info("", "\x1b[33;1mUsing Android NDK platform: " + defines.get("HXCPP_ANDROID_PLATFORM") + "\x1b[0m");
521521
}
522-
else if (defines.exists('NDKV20+')) {
522+
else if (defines.exists('NDKV19+')) {
523523
if (defines.exists("PLATFORM_NUMBER")) {
524524
Log.warn("The PLATFORM_NUMBER define is deprecated. Please use the HXCPP_ANDROID_PLATFORM define instead.");
525525
defines.set("HXCPP_ANDROID_PLATFORM", Std.string(defines.get("PLATFORM_NUMBER")));

0 commit comments

Comments
 (0)