LNXSDK/Kha/Backends/Kinc-hxcpp/khacpp/toolchain/android-toolchain-clang.xml
2025-01-22 16:18:30 +01:00

102 lines
3.0 KiB
XML

<xml>
<!-- Set architecture -->
<section if="HXCPP_X86">
<set name="ARCH" value="-x86" />
<set name="PLATFORM_NUMBER" value="19" 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="19" 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 -->
<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}" />
<flag value ="-static-libstdc++" />
<flag value ="-v" />
<prefix value="lib"/>
<lib name="-llog"/>
</linker>
</xml>