iOS - Linker Fixes

This commit is contained in:
Isaac Marovitz 2023-12-31 18:10:16 -08:00 committed by Emmanuel Hansen
parent cdf188a434
commit 5d919039d9

View File

@ -1,14 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifiers>linux-bionic-arm64;ios-arm64</RuntimeIdentifiers>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<LinkerFlavor Condition="'$(RuntimeIdentifier)'=='linux-bionic-arm64'">lld</LinkerFlavor> <LinkerFlavor Condition="'$(RuntimeIdentifier)'=='linux-bionic-arm64'">lld</LinkerFlavor>
<DefineConstants>$(DefineConstants);FORCE_EXTERNAL_BASE_DIR</DefineConstants> <DefineConstants>$(DefineConstants);FORCE_EXTERNAL_BASE_DIR</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<PublishAot>true</PublishAot> <PublishAot>true</PublishAot>
<NativeLib>Shared</NativeLib> <PublishAotUsingRuntimePack>true</PublishAotUsingRuntimePack>
<!-- Not sure why, but on iOS this results in an error. Result is still a .dylib. -->
<NativeLib Condition="'$(RuntimeIdentifier)'=='linux-bionic-arm64'">Shared</NativeLib>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer> <EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<InvariantGlobalization>true</InvariantGlobalization> <InvariantGlobalization>true</InvariantGlobalization>
@ -18,28 +20,62 @@
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OptimizationPreference>Speed</OptimizationPreference> <OptimizationPreference>Speed</OptimizationPreference>
</PropertyGroup> </PropertyGroup>
<!-- iOS Linking Fixes -->
<Target Condition="'$(RuntimeIdentifier)'=='ios-arm64'" Name="PrepareBeforeIlcCompile" BeforeTargets="IlcCompile">
<Exec Command="xcrun xcode-select -p" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="XcodeSelect" />
</Exec>
<PropertyGroup>
<XcodePath>$(XcodeSelect)</XcodePath>
<XcodePath>$([MSBuild]::EnsureTrailingSlash('$(XCodePath)'))</XcodePath>
</PropertyGroup>
<Message Importance="normal" Text="Found Xcode at $(XcodeSelect)" />
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Ryujinx.Audio.Backends.OpenAL\Ryujinx.Audio.Backends.OpenAL.csproj" /> <LinkerArg Include="-Wl,-ld_classic" />
<ProjectReference Include="..\Ryujinx.Audio.Backends.SDL2\Ryujinx.Audio.Backends.SDL2.csproj" /> <LinkerArg Include="-isysroot %22$(XcodePath)Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk%22"
<ProjectReference Include="..\Ryujinx.Input\Ryujinx.Input.csproj" /> Condition=" $(RuntimeIdentifier.Contains('simulator')) "/>
<ProjectReference Include="..\Ryujinx.Common\Ryujinx.Common.csproj" /> <LinkerArg Include="-isysroot %22$(XcodePath)Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk%22"
<ProjectReference Include="..\Ryujinx.HLE\Ryujinx.HLE.csproj" /> Condition=" !$(RuntimeIdentifier.Contains('simulator')) "/>
<ProjectReference Include="..\ARMeilleure\ARMeilleure.csproj" />
<ProjectReference Include="..\Ryujinx.Graphics.OpenGL\Ryujinx.Graphics.OpenGL.csproj" />
<ProjectReference Include="..\Ryujinx.Graphics.Vulkan\Ryujinx.Graphics.Vulkan.csproj" />
<ProjectReference Include="..\Ryujinx.Graphics.Gpu\Ryujinx.Graphics.Gpu.csproj" />
<ProjectReference Include="..\Ryujinx.Ui.Common\Ryujinx.Ui.Common.csproj" />
</ItemGroup> </ItemGroup>
</Target>
<Target Condition="'$(RuntimeIdentifier)'=='ios-arm64'" Name="FixDylib" AfterTargets="Publish">
<Exec Command="install_name_tool -id @rpath/$(TargetName).dylib $(NativeBinary)" ConsoleToMSBuild="true" />
</Target>
<Target Condition="'$(RuntimeIdentifier)'=='ios-arm64'" Name="FixSymbols" AfterTargets="Publish">
<RemoveDir Directories="$(PublishDir)$(TargetName).framework.dSYM"/>
<!-- create-xcframework (called from the export plugin wants the symbol files in a directory
with a slightly different name from the one created by dotnet publish, so we copy them over
to the correctly-named directory -->
<ItemGroup> <ItemGroup>
<RdXmlFile Include="rd.xml" /> <SymbolFiles Include="$(NativeBinary).dsym\**\*.*"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Rxmxnx.PInvoke.Extensions" />
<PackageReference Include="Silk.NET.Vulkan" />
<PackageReference Include="Silk.NET.Vulkan.Extensions.KHR" />
<LinkerArg Condition="'$(RuntimeIdentifier)'=='linux-bionic-arm64'" Include="-llog" />
</ItemGroup>
<ItemGroup>
<Folder Include="Jni\" />
</ItemGroup> </ItemGroup>
<Copy SourceFiles="@(SymbolFiles)" DestinationFolder="$(PublishDir)$(TargetName).framework.dSYM"/>
</Target>
<!-- End iOS Linking Fixes -->
<ItemGroup>
<ProjectReference Include="..\Ryujinx.Audio.Backends.OpenAL\Ryujinx.Audio.Backends.OpenAL.csproj" />
<ProjectReference Include="..\Ryujinx.Audio.Backends.SDL2\Ryujinx.Audio.Backends.SDL2.csproj" />
<ProjectReference Include="..\Ryujinx.Input\Ryujinx.Input.csproj" />
<ProjectReference Include="..\Ryujinx.Common\Ryujinx.Common.csproj" />
<ProjectReference Include="..\Ryujinx.HLE\Ryujinx.HLE.csproj" />
<ProjectReference Include="..\ARMeilleure\ARMeilleure.csproj" />
<ProjectReference Include="..\Ryujinx.Graphics.OpenGL\Ryujinx.Graphics.OpenGL.csproj" />
<ProjectReference Include="..\Ryujinx.Graphics.Vulkan\Ryujinx.Graphics.Vulkan.csproj" />
<ProjectReference Include="..\Ryujinx.Graphics.Gpu\Ryujinx.Graphics.Gpu.csproj" />
<ProjectReference Include="..\Ryujinx.Ui.Common\Ryujinx.Ui.Common.csproj" />
</ItemGroup>
<ItemGroup>
<RdXmlFile Include="rd.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Rxmxnx.PInvoke.Extensions" />
<PackageReference Include="Silk.NET.Vulkan" />
<PackageReference Include="Silk.NET.Vulkan.Extensions.KHR" />
<LinkerArg Condition="'$(RuntimeIdentifier)'=='linux-bionic-arm64'" Include="-llog" />
</ItemGroup>
<ItemGroup>
<Folder Include="Jni\" />
</ItemGroup>
</Project> </Project>