Skip to content
Permalink
Browse files

[Build] Android: Updated to NDK r19 (with proper version check) and r…

…emove our custom libc++abi (first step for #460 and #379)
  • Loading branch information
xen2 committed Jul 30, 2019
1 parent f70d74c commit abe058e2c25e2976bfcc96c379156c3ed1e77554
@@ -44,7 +44,7 @@ Ask for help or report issues:
* `Desktop development with C++` with `Windows 10 SDK (10.0.17763.0)` or later, and `VC++ 2017 version 15.9 v14.16 latest v141 tools` or later (both should be enabled by default)
* `.NET Core cross-platform development`
* Optional (to target UWP): `Universal Windows Platform development` with `Windows 10 SDK (10.0.17763.0)`
* Optional (to target iOS/Android): `Mobile development with .NET` and `Android NDK R13B+` individual component
* Optional (to target iOS/Android): `Mobile development with .NET` and `Android SDK setup (API level 27)` individual component, then in Visual Studio go to `Tools > Android > Android SDK Manager` and install `NDK` (version 19+) from `Tools` tab.
3. [FBX SDK 2019.0 VS2015](https://www.autodesk.com/developer-network/platform-technologies/fbx-sdk-2019-0)

### Build Xenko

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -9,7 +9,6 @@

<ItemGroup>
<XenkoNativePathLibs2 Condition="'$(XenkoPlatform)' == 'iOS' or '$(XenkoPlatform)' == 'macOS'" Include="$(XenkoDependenciesDir)\NativePath\iOS\libCelt.a" />
<XenkoNativePathLibs2 Condition="'$(XenkoPlatform)' == 'Android'" Include="libCelt.a;libCompilerRt.a;libc++abi.a" />
<XenkoNativePathLibs2 Condition="'$(XenkoPlatform)' == 'Linux'" Include="libCelt.a;libCompilerRt.a" />
<XenkoNativePathLibs2 Condition="'$(XenkoPlatform)' == 'Linux' Or '$(XenkoPlatform)' == 'Android'" Include="libCelt.a;libCompilerRt.a" />
</ItemGroup>
</Project>
@@ -9,7 +9,6 @@

<ItemGroup>
<XenkoNativePathLibs2 Condition="'$(XenkoPlatform)' == 'iOS' or '$(XenkoPlatform)' == 'macOS'" Include="$(XenkoDependenciesDir)\NativePath\iOS\libCelt.a;$(XenkoDependenciesDir)\NativePath\iOS\libDetour.a;$(XenkoDependenciesDir)\NativePath\iOS\libRecast.a" />
<XenkoNativePathLibs2 Condition="'$(XenkoPlatform)' == 'Android'" Include="libCelt.a;libCompilerRt.a;libDetour.a;libRecast.a;libc++abi.a" />
<XenkoNativePathLibs2 Condition="'$(XenkoPlatform)' == 'Linux'" Include="libCelt.a;libCompilerRt.a;libDetour.a;libRecast.a" />
<XenkoNativePathLibs2 Condition="'$(XenkoPlatform)' == 'Linux' Or '$(XenkoPlatform)' == 'Android'" Include="libCelt.a;libCompilerRt.a;libDetour.a;libRecast.a" />
</ItemGroup>
</Project>
@@ -10,7 +10,6 @@
<ItemGroup>
<XenkoNativePathLibs2 Condition="'$(XenkoPlatform)' == 'iOS' or '$(XenkoPlatform)' == 'macOS'"
Include="$(XenkoDependenciesDir)\NativePath\iOS\libDetour.a;$(XenkoDependenciesDir)\NativePath\iOS\libRecast.a" />
<XenkoNativePathLibs2 Condition="'$(XenkoPlatform)' == 'Android'" Include="libDetour.a;libRecast.a;libc++abi.a" />
<XenkoNativePathLibs2 Condition="'$(XenkoPlatform)' == 'Linux'" Include="libDetour.a;libRecast.a" />
<XenkoNativePathLibs2 Condition="'$(XenkoPlatform)' == 'Linux' Or '$(XenkoPlatform)' == 'Android'" Include="libDetour.a;libRecast.a" />
</ItemGroup>
</Project>
@@ -12,8 +12,6 @@
</ItemGroup>

<PropertyGroup>
<XenkoNativeAndroidGCC>-nostdlib -ldl -lstdc++ -lc -lm</XenkoNativeAndroidGCC>

<!--Use "-v" to debug the tooling -->
<XenkoNativeToolingDebug></XenkoNativeToolingDebug>

@@ -196,39 +194,42 @@
<Delete Files="@(XenkoNativePathLibs2->'$(XenkoNativeOutputPath)\%(Filename).a', ' ')" />
</Target>

<!-- RELEASE.TXT does not seem to exist anymore
<PropertyGroup Condition="Exists('$(AndroidNdkDirectory)\RELEASE.TXT')">
<XenkoNativeAndroidIs64Bit Condition="'$([System.Text.RegularExpressions.Regex]::Match($([System.IO.File]::ReadAllText(`$(AndroidNdkDirectory)\RELEASE.TXT`)), `r\d\d\w?\s\(64-bit\)`).Success)' == 'true'">-x86_64</XenkoNativeAndroidIs64Bit>
<XenkoNativeAndroidIs64Bit Condition="'$([System.Text.RegularExpressions.Regex]::Match($([System.IO.File]::ReadAllText(`$(AndroidNdkDirectory)\RELEASE.TXT`)), `r\d\d\w?\s\(64-bit\)`).Success)' == 'false'"></XenkoNativeAndroidIs64Bit>
</PropertyGroup>
-->

<PropertyGroup>
<XenkoNativeAndroidIs64Bit>-x86_64</XenkoNativeAndroidIs64Bit>
</PropertyGroup>

<Target Name="CompileNativeClang_Android" Inputs="@(XenkoNativeCFile);@(XenkoNativeHFile)" Outputs="@(XenkoNativeOutput)" Condition="'$(XenkoPlatform)' == 'Android' And $(DesignTimeBuild) != true And $(BuildingProject) != false" BeforeTargets="CoreCompile" DependsOnTargets="_XenkoRegisterNativeOutputs">
<Error Text="The AndroidNdkDirectory environment variable is not set!" Condition="'$(AndroidNdkDirectory)' == ''" />
<PropertyGroup>
<XenkoNativeAndroidClang>-lc++abi -lm --sysroot=&quot;$(AndroidNdkDirectory)\toolchains\llvm\prebuilt\windows-x86_64\sysroot&quot;</XenkoNativeAndroidClang>

<_XenkoNativeAndroidNdkSourceProperties Condition="Exists('$(AndroidNdkDirectory)\source.properties')">$([System.IO.File]::ReadAllText('$(AndroidNdkDirectory)\source.properties'))</_XenkoNativeAndroidNdkSourceProperties>
<XenkoNativeAndroidNdkVersion>$([System.Text.RegularExpressions.Regex]::Match($(_XenkoNativeAndroidNdkSourceProperties), `Pkg\.Revision = (.*)`).Groups[1].Value)</XenkoNativeAndroidNdkVersion>
<XenkoNativeAndroidNdkVersionMinimum>19.0</XenkoNativeAndroidNdkVersionMinimum>

<!-- Try to guess Android SDK version from build parameters, otherwise fallback to 27 (8.1) -->
<XenkoNativeAndroidPlatformVersion Condition="'$(_AndroidApiLevel)' != ''">$(_AndroidApiLevel)</XenkoNativeAndroidPlatformVersion>
<XenkoNativeAndroidPlatformVersion Condition="'$(XenkoNativeAndroidPlatformVersion)' == ''">27</XenkoNativeAndroidPlatformVersion>
</PropertyGroup>

<Error Condition="'$(XenkoNativeAndroidNdkVersion)' == ''" Text="Could not figure out Android NDK version from $(AndroidNdkDirectory). There should be a source.properties file with Pkg.Revision properly set." />
<Error Condition="$([System.Version]::Parse('$(XenkoNativeAndroidNdkVersionMinimum)').CompareTo($([System.Version]::Parse('$(XenkoNativeAndroidNdkVersion)')))) >= 0" Text="The Android NDK version is too old. Found: $(XenkoNativeAndroidNdkVersion), Expected: $(XenkoNativeAndroidNdkVersionMinimum), Location: $(AndroidNdkDirectory)" />

<MakeDir Directories="$(XenkoNativeOutputPath)\armeabi-v7a"/>
<Exec Condition="'%(XenkoNativeCFile.Extension)' != '.cpp'" Command="&quot;$(XenkoDependenciesDir)\LLVM\clang.exe&quot; $(XenkoNativeClang) -o &quot;$(OutputObjectPath)\%(XenkoNativeCFile.Filename)_armeabi-v7a.o&quot; -c &quot;%(XenkoNativeCFile.FullPath)&quot; -DANDROID -target armv7-none-android" />
<Exec Condition="'%(XenkoNativeCFile.Extension)' == '.cpp'" Command="&quot;$(XenkoDependenciesDir)\LLVM\clang.exe&quot; $(XenkoNativeClangCPP) $(XenkoNativeClang) -o &quot;$(OutputObjectPath)\%(XenkoNativeCFile.Filename)_armeabi-v7a.o&quot; -c &quot;%(XenkoNativeCFile.FullPath)&quot; -DANDROID -target armv7-none-android" />
<Exec Command="&quot;$(AndroidNdkDirectory)\toolchains\arm-linux-androideabi-4.9\prebuilt\windows$(XenkoNativeAndroidIs64Bit)\bin\arm-linux-androideabi-gcc.exe&quot; $(XenkoNativeToolingDebug) -shared -o &quot;$(XenkoNativeOutputPath)\armeabi-v7a\$(XenkoNativeOutputName)$(XenkoNativeLibraryTargetExt)&quot; @(XenkoNativeCFile->'&quot;$(OutputObjectPath)\%(Filename)_armeabi-v7a.o&quot;', ' ') --sysroot=&quot;$(AndroidNdkDirectory)\platforms\android-9\arch-arm&quot; @(XenkoNativePathLibs2->'&quot;$(XenkoDependenciesDir)\NativePath\Android\armeabi-v7a\%(Filename).a&quot;', ' ') &quot;$(XenkoDependenciesDir)\NativePath\Android\armeabi-v7a\libNativePath.a&quot; $(XenkoNativeAndroidGCC)" />
<Exec Condition="'%(XenkoNativeCFile.Extension)' != '.cpp'" Command="&quot;$(XenkoDependenciesDir)\LLVM\clang.exe&quot; $(XenkoNativeClang) -o &quot;$(OutputObjectPath)\%(XenkoNativeCFile.Filename)_armeabi-v7a.o&quot; -c &quot;%(XenkoNativeCFile.FullPath)&quot; -DANDROID -fPIC --target=armv7-linux-android$(XenkoNativeAndroidPlatformVersion)" />
<Exec Condition="'%(XenkoNativeCFile.Extension)' == '.cpp'" Command="&quot;$(XenkoDependenciesDir)\LLVM\clang.exe&quot; $(XenkoNativeClangCPP) $(XenkoNativeClang) -o &quot;$(OutputObjectPath)\%(XenkoNativeCFile.Filename)_armeabi-v7a.o&quot; -c &quot;%(XenkoNativeCFile.FullPath)&quot; -DANDROID -fPIC --target=armv7-linux-android$(XenkoNativeAndroidPlatformVersion)" />
<Exec Command="&quot;$(AndroidNdkDirectory)\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe&quot; $(XenkoNativeToolingDebug) -shared -o &quot;$(XenkoNativeOutputPath)\armeabi-v7a\$(XenkoNativeOutputName)$(XenkoNativeLibraryTargetExt)&quot; @(XenkoNativeCFile->'&quot;$(OutputObjectPath)\%(Filename)_armeabi-v7a.o&quot;', ' ') --sysroot=&quot;$(AndroidNdkDirectory)\platforms\android-9\arch-arm&quot; @(XenkoNativePathLibs2->'&quot;$(XenkoDependenciesDir)\NativePath\Android\armeabi-v7a\%(Filename).a&quot;', ' ') &quot;$(XenkoDependenciesDir)\NativePath\Android\armeabi-v7a\libNativePath.a&quot; $(XenkoNativeAndroidClang) --target=armv7-linux-android$(XenkoNativeAndroidPlatformVersion)" />

<MakeDir Directories="$(XenkoNativeOutputPath)\arm64-v8a"/>
<Exec Condition="'%(XenkoNativeCFile.Extension)' != '.cpp'" Command="&quot;$(XenkoDependenciesDir)\LLVM\clang.exe&quot; $(XenkoNativeClang) -o &quot;$(OutputObjectPath)\%(XenkoNativeCFile.Filename)_arm64-v8a.o&quot; -c &quot;%(XenkoNativeCFile.FullPath)&quot; -DANDROID -target aarch64-none-android" />
<Exec Condition="'%(XenkoNativeCFile.Extension)' == '.cpp'" Command="&quot;$(XenkoDependenciesDir)\LLVM\clang.exe&quot; $(XenkoNativeClangCPP) $(XenkoNativeClang) -o &quot;$(OutputObjectPath)\%(XenkoNativeCFile.Filename)_arm64-v8a.o&quot; -c &quot;%(XenkoNativeCFile.FullPath)&quot; -DANDROID -target aarch64-none-android" />
<Exec Command="&quot;$(AndroidNdkDirectory)\toolchains\aarch64-linux-android-4.9\prebuilt\windows$(XenkoNativeAndroidIs64Bit)\bin\aarch64-linux-android-gcc.exe&quot; $(XenkoNativeToolingDebug) -shared -o &quot;$(XenkoNativeOutputPath)\arm64-v8a\$(XenkoNativeOutputName)$(XenkoNativeLibraryTargetExt)&quot; @(XenkoNativeCFile->'&quot;$(OutputObjectPath)\%(Filename)_arm64-v8a.o&quot;', ' ') --sysroot=&quot;$(AndroidNdkDirectory)\platforms\android-21\arch-arm64&quot; @(XenkoNativePathLibs2->'&quot;$(XenkoDependenciesDir)\NativePath\Android\arm64-v8a\%(Filename).a&quot;', ' ') &quot;$(XenkoDependenciesDir)\NativePath\Android\arm64-v8a\libNativePath.a&quot; $(XenkoNativeAndroidGCC)" />
<Exec Condition="'%(XenkoNativeCFile.Extension)' != '.cpp'" Command="&quot;$(XenkoDependenciesDir)\LLVM\clang.exe&quot; $(XenkoNativeClang) -o &quot;$(OutputObjectPath)\%(XenkoNativeCFile.Filename)_arm64-v8a.o&quot; -c &quot;%(XenkoNativeCFile.FullPath)&quot; -DANDROID -fPIC --target=aarch64-linux-android$(XenkoNativeAndroidPlatformVersion)" />
<Exec Condition="'%(XenkoNativeCFile.Extension)' == '.cpp'" Command="&quot;$(XenkoDependenciesDir)\LLVM\clang.exe&quot; $(XenkoNativeClangCPP) $(XenkoNativeClang) -o &quot;$(OutputObjectPath)\%(XenkoNativeCFile.Filename)_arm64-v8a.o&quot; -c &quot;%(XenkoNativeCFile.FullPath)&quot; -DANDROID -fPIC --target=aarch64-linux-android$(XenkoNativeAndroidPlatformVersion)" />
<Exec Command="&quot;$(AndroidNdkDirectory)\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe&quot; $(XenkoNativeToolingDebug) -shared -o &quot;$(XenkoNativeOutputPath)\arm64-v8a\$(XenkoNativeOutputName)$(XenkoNativeLibraryTargetExt)&quot; @(XenkoNativeCFile->'&quot;$(OutputObjectPath)\%(Filename)_arm64-v8a.o&quot;', ' ') --sysroot=&quot;$(AndroidNdkDirectory)\platforms\android-21\arch-arm64&quot; @(XenkoNativePathLibs2->'&quot;$(XenkoDependenciesDir)\NativePath\Android\arm64-v8a\%(Filename).a&quot;', ' ') &quot;$(XenkoDependenciesDir)\NativePath\Android\arm64-v8a\libNativePath.a&quot; $(XenkoNativeAndroidClang) --target=aarch64-linux-android$(XenkoNativeAndroidPlatformVersion)" />

<MakeDir Directories="$(XenkoNativeOutputPath)\x86"/>
<Exec Condition="'%(XenkoNativeCFile.Extension)' != '.cpp'" Command="&quot;$(XenkoDependenciesDir)\LLVM\clang.exe&quot; $(XenkoNativeClang) -o &quot;$(OutputObjectPath)\%(XenkoNativeCFile.Filename)_x86.o&quot; -c &quot;%(XenkoNativeCFile.FullPath)&quot; -DANDROID -target i386-none-android" />
<Exec Condition="'%(XenkoNativeCFile.Extension)' == '.cpp'" Command="&quot;$(XenkoDependenciesDir)\LLVM\clang.exe&quot; $(XenkoNativeClangCPP) $(XenkoNativeClang) -o &quot;$(OutputObjectPath)\%(XenkoNativeCFile.Filename)_x86.o&quot; -c &quot;%(XenkoNativeCFile.FullPath)&quot; -DANDROID -target i386-none-android" />
<Exec Command="&quot;$(AndroidNdkDirectory)\toolchains\x86-4.9\prebuilt\windows$(XenkoNativeAndroidIs64Bit)\bin\i686-linux-android-gcc.exe&quot; $(XenkoNativeToolingDebug) -shared -o &quot;$(XenkoNativeOutputPath)\x86\$(XenkoNativeOutputName)$(XenkoNativeLibraryTargetExt)&quot; @(XenkoNativeCFile->'&quot;$(OutputObjectPath)\%(Filename)_x86.o&quot;', ' ') --sysroot=&quot;$(AndroidNdkDirectory)\platforms\android-9\arch-x86&quot; @(XenkoNativePathLibs2->'&quot;$(XenkoDependenciesDir)\NativePath\Android\x86\%(Filename).a&quot;', ' ') &quot;$(XenkoDependenciesDir)\NativePath\Android\x86\libNativePath.a&quot; $(XenkoNativeAndroidGCC)" />
<Exec Condition="'%(XenkoNativeCFile.Extension)' != '.cpp'" Command="&quot;$(XenkoDependenciesDir)\LLVM\clang.exe&quot; $(XenkoNativeClang) -o &quot;$(OutputObjectPath)\%(XenkoNativeCFile.Filename)_x86.o&quot; -c &quot;%(XenkoNativeCFile.FullPath)&quot; -DANDROID -fPIC --target=i386-linux-android$(XenkoNativeAndroidPlatformVersion)" />
<Exec Condition="'%(XenkoNativeCFile.Extension)' == '.cpp'" Command="&quot;$(XenkoDependenciesDir)\LLVM\clang.exe&quot; $(XenkoNativeClangCPP) $(XenkoNativeClang) -o &quot;$(OutputObjectPath)\%(XenkoNativeCFile.Filename)_x86.o&quot; -c &quot;%(XenkoNativeCFile.FullPath)&quot; -DANDROID -fPIC --target=i386-linux-android$(XenkoNativeAndroidPlatformVersion)" />
<Exec Command="&quot;$(AndroidNdkDirectory)\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe&quot; $(XenkoNativeToolingDebug) -shared -o &quot;$(XenkoNativeOutputPath)\x86\$(XenkoNativeOutputName)$(XenkoNativeLibraryTargetExt)&quot; @(XenkoNativeCFile->'&quot;$(OutputObjectPath)\%(Filename)_x86.o&quot;', ' ') --sysroot=&quot;$(AndroidNdkDirectory)\platforms\android-9\arch-x86&quot; @(XenkoNativePathLibs2->'&quot;$(XenkoDependenciesDir)\NativePath\Android\x86\%(Filename).a&quot;', ' ') &quot;$(XenkoDependenciesDir)\NativePath\Android\x86\libNativePath.a&quot; $(XenkoNativeAndroidClang) --target=i386-linux-android$(XenkoNativeAndroidPlatformVersion)" />

<MakeDir Directories="$(XenkoNativeOutputPath)\x86_64"/>
<Exec Condition="'%(XenkoNativeCFile.Extension)' != '.cpp'" Command="&quot;$(XenkoDependenciesDir)\LLVM\clang.exe&quot; $(XenkoNativeClang) -o &quot;$(OutputObjectPath)\%(XenkoNativeCFile.Filename)_x86_64.o&quot; -c &quot;%(XenkoNativeCFile.FullPath)&quot; -DANDROID -target x86_64-none-android" />
<Exec Condition="'%(XenkoNativeCFile.Extension)' == '.cpp'" Command="&quot;$(XenkoDependenciesDir)\LLVM\clang.exe&quot; $(XenkoNativeClangCPP) $(XenkoNativeClang) -o &quot;$(OutputObjectPath)\%(XenkoNativeCFile.Filename)_x86_64.o&quot; -c &quot;%(XenkoNativeCFile.FullPath)&quot; -DANDROID -target x86_64-none-android" />
<Exec Command="&quot;$(AndroidNdkDirectory)\toolchains\x86_64-4.9\prebuilt\windows$(XenkoNativeAndroidIs64Bit)\bin\x86_64-linux-android-gcc.exe&quot; $(XenkoNativeToolingDebug) -shared -o &quot;$(XenkoNativeOutputPath)\x86_64\$(XenkoNativeOutputName)$(XenkoNativeLibraryTargetExt)&quot; @(XenkoNativeCFile->'&quot;$(OutputObjectPath)\%(Filename)_x86_64.o&quot;', ' ') --sysroot=&quot;$(AndroidNdkDirectory)\platforms\android-21\arch-x86_64&quot; @(XenkoNativePathLibs2->'&quot;$(XenkoDependenciesDir)\NativePath\Android\x86_64\%(Filename).a&quot;', ' ') &quot;$(XenkoDependenciesDir)\NativePath\Android\x86_64\libNativePath.a&quot; $(XenkoNativeAndroidGCC)" />
<Exec Condition="'%(XenkoNativeCFile.Extension)' != '.cpp'" Command="&quot;$(XenkoDependenciesDir)\LLVM\clang.exe&quot; $(XenkoNativeClang) -o &quot;$(OutputObjectPath)\%(XenkoNativeCFile.Filename)_x86_64.o&quot; -c &quot;%(XenkoNativeCFile.FullPath)&quot; -DANDROID -fPIC --target=x86_64-linux-android$(XenkoNativeAndroidPlatformVersion)" />
<Exec Condition="'%(XenkoNativeCFile.Extension)' == '.cpp'" Command="&quot;$(XenkoDependenciesDir)\LLVM\clang.exe&quot; $(XenkoNativeClangCPP) $(XenkoNativeClang) -o &quot;$(OutputObjectPath)\%(XenkoNativeCFile.Filename)_x86_64.o&quot; -c &quot;%(XenkoNativeCFile.FullPath)&quot; -DANDROID -fPIC --target=x86_64-linux-android$(XenkoNativeAndroidPlatformVersion)" />
<Exec Command="&quot;$(AndroidNdkDirectory)\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe&quot; $(XenkoNativeToolingDebug) -shared -o &quot;$(XenkoNativeOutputPath)\x86_64\$(XenkoNativeOutputName)$(XenkoNativeLibraryTargetExt)&quot; @(XenkoNativeCFile->'&quot;$(OutputObjectPath)\%(Filename)_x86_64.o&quot;', ' ') --sysroot=&quot;$(AndroidNdkDirectory)\platforms\android-21\arch-x86_64&quot; @(XenkoNativePathLibs2->'&quot;$(XenkoDependenciesDir)\NativePath\Android\x86_64\%(Filename).a&quot;', ' ') &quot;$(XenkoDependenciesDir)\NativePath\Android\x86_64\libNativePath.a&quot; $(XenkoNativeAndroidClang) --target=x86_64-linux-android$(XenkoNativeAndroidPlatformVersion)" />

<!-- Workaround: forcing C# rebuild so that timestamp are up to date (ideally we should have separate input/output groups for C# and Native) -->
<Delete Files="@(IntermediateAssembly)"/>

0 comments on commit abe058e

Please sign in to comment.
You can’t perform that action at this time.