-
Notifications
You must be signed in to change notification settings - Fork 195
/
android-toolchain-clang.xml
108 lines (84 loc) · 3.33 KB
/
android-toolchain-clang.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<xml>
<!-- Set architecture -->
<section if="HXCPP_X86">
<set name="ARCH" value="-x86" />
<set name="PLATFORM_NUMBER" value="21" unless="PLATFORM_NUMBER" />
<set name="ABITRIPLE" value="i686-linux-android" />
</section>
<section if="HXCPP_X86_64">
<set name="ARCH" value="-x86_64" />
<set name="PLATFORM_NUMBER" value="21" unless="PLATFORM_NUMBER" />
<set name="ABITRIPLE" value="x86_64-linux-android" />
</section>
<section if="HXCPP_ARMV7">
<set name="ARCH" value="-v7" />
<set name="PLATFORM_NUMBER" value="21" unless="PLATFORM_NUMBER" />
<set name="ABITRIPLE" value="armv7a-linux-androideabi" />
<set name="EXEPREFIX" value="arm-linux-androideabi" />
</section>
<section if="HXCPP_ARM64">
<set name="ARCH" value="-64"/>
<set name="PLATFORM_NUMBER" value="21" unless="PLATFORM_NUMBER" />
<set name="ABITRIPLE" value="aarch64-linux-android" />
</section>
<error value="Please set one of the architectures, eg HXCPP_ARM64, HXCPP_X86, ..." unless="ABITRIPLE" />
<set name="PLATFORM" value="android-${PLATFORM_NUMBER}" />
<set name="ANDROID_PLATFORM_DEFINE" value="HXCPP_ANDROID_PLATFORM=${PLATFORM_NUMBER}" />
<path name="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${ANDROID_HOST}/bin" />
<section unless="NDKV22+">
<set name="HXCPP_AR" value="arm-linux-androideabi-ar" />
<set name="EXEPREFIX" value="${ABITRIPLE}" unless="EXEPREFIX" />
</section>
<section if="NDKV22+">
<set name="HXCPP_AR" value="llvm-ar" />
<set name="EXEPREFIX" value="llvm" />
</section>
<include name="toolchain/gcc-toolchain.xml"/>
<compiler id="android-gcc" exe="clang++">
<exe name="clang++" />
<flag value="--target=${ABITRIPLE}${PLATFORM_NUMBER}" />
<!-- File Related -->
<include name="toolchain/common-defines.xml" />
<flag value="-I${HXCPP}/include"/>
<flag value="-Iinclude"/>
<objdir value="obj/android${OBJEXT}${ARCH}" />
<ext value=".obj"/>
<pchflag value="-x" />
<pchflag value="c++-header" />
<!-- Macros -->
<flag value="-DANDROID=ANDROID"/>
<flag value="-DHXCPP_CLANG"/>
<flag value="-DHX_ANDROID"/>
<flag value="-DHXCPP_LOAD_DEBUG" if="HXCPP_LOAD_DEBUG"/>
<flag value="-D${ANDROID_PLATFORM_DEFINE}"/>
<!-- Options -->
<cppflag value="-std=c++17" if="HXCPP_CPP17" />
<flag value="-flto" if="HXCPP_OPTIMIZE_LINK" unless="debug"/>
<flag value="-fvisibility=hidden"/>
<flag value="-ffunction-sections"/>
<flag value="-fstack-protector"/>
<flag value="-fexceptions"/>
<flag value="-g" if="HXCPP_DEBUG_LINK"/>
<flag value="-c"/>
<flag value="-fpic"/>
<flag value="-O2" unless="debug"/>
<!-- Warning Supression -->
<flag value="-Wno-invalid-offsetof" />
<flag value="-Wno-return-type-c-linkage" />
<flag value="-Wno-parentheses" />
</compiler>
<linker id="dll" exe="clang++" >
<exe name="clang++" />
<flag value ="-shared" />
<flag value="--target=${ABITRIPLE}${PLATFORM_NUMBER}" />
<!-- Build time error, not run time -->
<flag value="-Wl,--no-undefined" unless="HXCPP_ALLOW_UNDEFINED" />
<flag value ="-static-libstdc++" />
<!-- This shows the android link line, which may be so long that it breaks the tool
https://github.com/HaxeFoundation/hxcpp/pull/1091
<flag value ="-v" />
-->
<prefix value="lib"/>
<lib name="-llog"/>
</linker>
</xml>