-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create BionicNativeAot.target * Remove sed dependency. * Use batch files only on Windows.
- Loading branch information
1 parent
d2be14b
commit 4233b2b
Showing
7 changed files
with
90 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -336,3 +336,6 @@ ASALocalRun/ | |
*.dll | ||
*.dwo | ||
.DS_Store | ||
/android_clang.cmd | ||
/android_llvm-objcopy.cmd | ||
android_clang.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<PropertyGroup> | ||
<!--This is needed in order to build successfully bionic binaries--> | ||
<IsAndroid>$(RuntimeIdentifier.ToLower().StartsWith('android'))</IsAndroid> | ||
<IsAndroid Condition="'$(IsAndroid)'=='false'">$(RuntimeIdentifier.ToLower().StartsWith('linux-bionic'))</IsAndroid> | ||
<IsWindowsHost>$([MSBuild]::IsOSPlatform('Windows'))</IsWindowsHost> | ||
<IsLinuxHost>$([MSBuild]::IsOSPlatform('Linux'))</IsLinuxHost> | ||
<IsOSXHost>$([MSBuild]::IsOSPlatform('OSX'))</IsOSXHost> | ||
<RemoveSections Condition="'$(RemoveSections)' != '' And $([System.String]::ToLower('$(RemoveSections)')) != 'false'">true</RemoveSections> | ||
</PropertyGroup> | ||
|
||
<!--Following blocks are exclusive for NKD building--> | ||
<PropertyGroup Condition="$(IsAndroid) == 'true'"> | ||
<NdkPropertiesFile>$(ANDROID_NDK_ROOT)\source.properties</NdkPropertiesFile> | ||
<NdkHost Condition="$(IsWindowsHost) == 'true'">windows-x86_64</NdkHost> | ||
<NdkHost Condition="$(IsLinuxHost) == 'true'">linux-x86_64</NdkHost> | ||
<NdkHost Condition="$(IsOSXHost) == 'true'">darwin-x86_64</NdkHost> | ||
<SysRoot Condition="'$(SysRoot)' == ''">$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(NdkHost)/sysroot</SysRoot> | ||
<!--Retrieves NDK version--> | ||
<BaseRevision>$([System.IO.File]::ReadAllText('$(NdkPropertiesFile)'))</BaseRevision> | ||
<NdkVersion>$([System.Text.RegularExpressions.Regex]::Match('$(BaseRevision)', 'Pkg.BaseRevision\s*=\s*(\S+)').Groups[1].Value.Split('.')[0])</NdkVersion> | ||
<NdkVersion Condition="'$(NdkVersion)' == ''">0</NdkVersion> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="$(IsAndroid) == 'true'"> | ||
<!--OSX and Linux can use NDK directly--> | ||
<CppCompilerAndLinker Condition="$(IsWindowsHost) != 'true'">$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(NdkHost)/bin/clang</CppCompilerAndLinker> | ||
<ObjCopyName Condition="$(IsWindowsHost) != 'true'">$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(NdkHost)/bin/llvm-objcopy</ObjCopyName> | ||
<!--Windows should use batch files to work with NDK--> | ||
<CppCompilerAndLinker Condition="$(IsWindowsHost) == 'true'">android_clang.cmd</CppCompilerAndLinker> | ||
<ObjCopyName Condition="$(IsWindowsHost) == 'true'">android_llvm-objcopy.cmd</ObjCopyName> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition="$(IsAndroid) == 'true'"> | ||
<!--JNI libs needs to be compiled with -z noexecstack--> | ||
<LinkerArg Include="-z noexecstack"/> | ||
<!--Hack for passing a valid target argument on NDK linker invocation--> | ||
<LinkerArg Condition="$(RuntimeIdentifier.ToLower().EndsWith('-x64'))" Include="--target=x86_64-linux-android21"/> | ||
<LinkerArg Condition="$(RuntimeIdentifier.ToLower().EndsWith('-arm64'))" Include="--target=aarch64-linux-android21"/> | ||
</ItemGroup> | ||
|
||
<!--Hack for using NDK executables on Windows--> | ||
<Target Condition="$(IsAndroid) == 'true'" Name="PrepareNdkBatches" AfterTargets="Build" BeforeTargets="IlcCompile"> | ||
<PropertyGroup> | ||
<NdkHostBin Condition="$(IsWindowsHost) == 'true'">$(ANDROID_NDK_ROOT)\toolchains\llvm\prebuilt\$(NdkHost)\bin\</NdkHostBin> | ||
<NdkHostBin Condition="$(IsWindowsHost) != 'true'">$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(NdkHost)/bin/</NdkHostBin> | ||
</PropertyGroup> | ||
<!--Create Windows .cmd files--> | ||
<WriteLinesToFile Condition="$(IsWindowsHost) == 'true'" File="android_clang.cmd" Lines=""$(NdkHostBin)clang.exe" %*" Overwrite="true"/> | ||
<WriteLinesToFile Condition="$(IsWindowsHost) == 'true'" File="android_llvm-objcopy.cmd" Lines=""$(NdkHostBin)llvm-objcopy.exe" %*" Overwrite="true"/> | ||
</Target> | ||
<Target Condition="$(IsAndroid) == 'true'" Name="RemoveBatchFiles" AfterTargets="LinkNative"> | ||
<!--Remove batch files--> | ||
<ItemGroup> | ||
<BatchFiles Condition="$(IsWindowsHost) == 'true'" Include="android_clang.cmd"/> | ||
<BatchFiles Condition="$(IsWindowsHost) == 'true'" Include="android_llvm-objcopy.cmd"/> | ||
</ItemGroup> | ||
<Delete Files="@(BatchFiles)"/> | ||
</Target> | ||
|
||
<!--Hack for removing _init and _fini sections into the exports file--> | ||
<Target Name="RemoveSections" Condition="$(IsAndroid) == 'true'" AfterTargets="IlcCompile" BeforeTargets="LinkNative"> | ||
<PropertyGroup Condition="$(RemoveSections) != 'true'"> | ||
<RemoveSections Condition="$([System.Int32]::Parse($(NdkVersion.Split('.')[0]))) >= 26">true</RemoveSections> | ||
</PropertyGroup> | ||
<WriteLinesToFile Condition="$(RemoveSections) == 'true'" File="$(ExportsFile)" Lines="$([System.IO.File]::ReadAllText($(ExportsFile)).Replace('global: _init; _fini;','global: '))" Overwrite="true"/> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.