PS: Do single transpile from DLL to C++ before all IL2CPP builds
This commit is contained in:
@@ -106,9 +106,11 @@ $bin = "$PSScriptRoot/TestBinaries"
|
||||
# We try to make the arguments as close as possible to a real Unity build
|
||||
# "--lump-runtime-library" was added to reduce the number of C++ files generated by UnityEngine (Unity 2019)
|
||||
# "--disable-runtime-lumping" replaced the above (Unity 2019.3)
|
||||
$arg = '--convert-to-cpp', '--compile-cpp', '--libil2cpp-static', '--configuration=Release', `
|
||||
'--emit-null-checks', '--enable-array-bounds-check', '--forcerebuild', `
|
||||
'--map-file-parser=$UnityPath\il2cpp\MapFileParser\MapFileParser.exe', '--dotnetprofile="unityaot"'
|
||||
$cppArg = '--convert-to-cpp', '-emit-null-checks', '--enable-array-bounds-check', '--dotnetprofile="unityaot"'
|
||||
|
||||
$compileArg = '--compile-cpp', '--libil2cpp-static', '--configuration=Release', `
|
||||
'--map-file-parser=$UnityPath\il2cpp\MapFileParser\MapFileParser.exe', '--dotnetprofile="unityaot"', `
|
||||
'--forcerebuild'
|
||||
|
||||
# Prepare output folders
|
||||
md $asm, $bin 2>&1 >$null
|
||||
@@ -128,20 +130,29 @@ gci "$src/*" -Include $cs | % {
|
||||
}
|
||||
}
|
||||
|
||||
# Transpile all of the DLLs to C++
|
||||
# We split this up from the binary compilation phase to avoid unnecessary DLL -> C++ transpiles for the same application
|
||||
|
||||
$dll = $assemblies | % {"$_.dll"}
|
||||
|
||||
gci "$asm/*" -Include $dll | % {
|
||||
$name = $_.BaseName
|
||||
echo "Converting assembly $($_.Name) to C++..."
|
||||
rm -Force -Recurse $cpp/$name 2>&1 >$null
|
||||
& $il2cpp $cppArg "--generatedcppdir=$cpp/$name", "--assembly=$_,$mscorlib" >$null
|
||||
}
|
||||
|
||||
# Run IL2CPP on all generated assemblies for both x86 and ARM
|
||||
# Earlier builds of Unity included mscorlib.dll automatically; in current versions we must specify its location
|
||||
|
||||
$dll = $assemblies | % {"$_.dll"}
|
||||
gci "$asm/*" -Include $dll | % {
|
||||
# x86
|
||||
$name = "GameAssembly-$($_.BaseName)-x86"
|
||||
echo "Running il2cpp for test assembly $name (Windows/x86)..."
|
||||
echo "Running il2cpp compiler for $name (Windows/x86)..."
|
||||
md $bin/$name 2>&1 >$null
|
||||
rm -Force -Recurse $cpp/$name 2>&1 >$null
|
||||
& $il2cpp $arg '--platform=WindowsDesktop', '--architecture=x86', `
|
||||
"--assembly=$_,$mscorlib", `
|
||||
& $il2cpp $compileArg '--platform=WindowsDesktop', '--architecture=x86', `
|
||||
"--outputpath=$bin/$name/$name.dll", `
|
||||
"--generatedcppdir=$cpp/$name"
|
||||
"--generatedcppdir=$cpp/$($_.BaseName)" >$null
|
||||
if ($LastExitCode -ne 0) {
|
||||
Write-Error "IL2CPP error - aborting"
|
||||
Exit
|
||||
@@ -152,13 +163,11 @@ gci "$asm/*" -Include $dll | % {
|
||||
|
||||
# x64
|
||||
$name = "GameAssembly-$($_.BaseName)-x64"
|
||||
echo "Running il2cpp for test assembly $name (Windows/x64)..."
|
||||
echo "Running il2cpp compiler for $name (Windows/x64)..."
|
||||
md $bin/$name 2>&1 >$null
|
||||
rm -Force -Recurse $cpp/$name 2>&1 >$null
|
||||
& $il2cpp $arg '--platform=WindowsDesktop', '--architecture=x64', `
|
||||
"--assembly=$_,$mscorlib", `
|
||||
& $il2cpp $compileArg '--platform=WindowsDesktop', '--architecture=x64', `
|
||||
"--outputpath=$bin/$name/$name.dll", `
|
||||
"--generatedcppdir=$cpp/$name"
|
||||
"--generatedcppdir=$cpp/$($_.BaseName)" >$null
|
||||
if ($LastExitCode -ne 0) {
|
||||
Write-Error "IL2CPP error - aborting"
|
||||
Exit
|
||||
@@ -169,16 +178,14 @@ gci "$asm/*" -Include $dll | % {
|
||||
# ARMv7
|
||||
if ($AndroidBuildEnabled) {
|
||||
$name = "$($_.BaseName)-ARMv7"
|
||||
echo "Running il2cpp for test assembly $name (Android/ARMv7)..."
|
||||
echo "Running il2cpp compiler for $name (Android/ARMv7)..."
|
||||
md $bin/$name 2>&1 >$null
|
||||
rm -Force -Recurse $cpp/$name 2>&1 >$null
|
||||
& $il2cpp $arg '--platform=Android', '--architecture=ARMv7', `
|
||||
"--assembly=$_,$mscorlib", `
|
||||
& $il2cpp $compileArg '--platform=Android', '--architecture=ARMv7', `
|
||||
"--outputpath=$bin/$name/$name.so", `
|
||||
"--generatedcppdir=$cpp/$name", `
|
||||
"--generatedcppdir=$cpp/$($_.BaseName)", `
|
||||
"--additional-include-directories=$AndroidPlayer/Tools/bdwgc/include" `
|
||||
"--additional-include-directories=$AndroidPlayer/Tools/libil2cpp/include" `
|
||||
"--tool-chain-path=$AndroidNDK"
|
||||
"--tool-chain-path=$AndroidNDK" >$null
|
||||
if ($LastExitCode -ne 0) {
|
||||
Write-Error "IL2CPP error - aborting"
|
||||
Exit
|
||||
@@ -190,16 +197,14 @@ gci "$asm/*" -Include $dll | % {
|
||||
# ARMv8 / A64
|
||||
if ($AndroidBuildEnabled) {
|
||||
$name = "$($_.BaseName)-ARM64"
|
||||
echo "Running il2cpp for test assembly $name (Android/ARM64)..."
|
||||
echo "Running il2cpp compiler for $name (Android/ARM64)..."
|
||||
md $bin/$name 2>&1 >$null
|
||||
rm -Force -Recurse $cpp/$name 2>&1 >$null
|
||||
& $il2cpp $arg '--platform=Android', '--architecture=ARM64', `
|
||||
"--assembly=$_,$mscorlib", `
|
||||
& $il2cpp $compileArg '--platform=Android', '--architecture=ARM64', `
|
||||
"--outputpath=$bin/$name/$name.so", `
|
||||
"--generatedcppdir=$cpp/$name", `
|
||||
"--generatedcppdir=$cpp/$($_.BaseName)", `
|
||||
"--additional-include-directories=$AndroidPlayer/Tools/bdwgc/include" `
|
||||
"--additional-include-directories=$AndroidPlayer/Tools/libil2cpp/include" `
|
||||
"--tool-chain-path=$AndroidNDK"
|
||||
"--tool-chain-path=$AndroidNDK" >$null
|
||||
if ($LastExitCode -ne 0) {
|
||||
Write-Error "IL2CPP error - aborting"
|
||||
Exit
|
||||
|
||||
Reference in New Issue
Block a user