You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Add C# iOS support
This support is experimental and requires .NET 8 Known issues: - Requires macOS due to use of lipo and xcodebuild - arm64 simulator templates are not currently included in the official packaging
This commit is contained in:
@@ -29,5 +29,7 @@
|
||||
<None Include="$(GodotSdkPackageVersionsFilePath)" Pack="true" PackagePath="Sdk">
|
||||
<Link>Sdk\SdkPackageVersions.props</Link>
|
||||
</None>
|
||||
<None Include="Sdk\iOSNativeAOT.props" Pack="true" PackagePath="Sdk" />
|
||||
<None Include="Sdk\iOSNativeAOT.targets" Pack="true" PackagePath="Sdk" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -59,6 +59,18 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Auto-detect the target Godot platform if it was not specified. -->
|
||||
<PropertyGroup Condition=" '$(GodotTargetPlatform)' == '' ">
|
||||
<GodotTargetPlatform Condition=" $(RuntimeIdentifier.StartsWith('ios')) ">ios</GodotTargetPlatform>
|
||||
<GodotTargetPlatform Condition=" '$(GodotTargetPlatform)' == '' and $(RuntimeIdentifier.StartsWith('android')) ">android</GodotTargetPlatform>
|
||||
<GodotTargetPlatform Condition=" '$(GodotTargetPlatform)' == '' and $(RuntimeIdentifier.StartsWith('browser')) ">web</GodotTargetPlatform>
|
||||
|
||||
<GodotTargetPlatform Condition=" '$(GodotTargetPlatform)' == '' and $(RuntimeIdentifier.StartsWith('linux')) ">linuxbsd</GodotTargetPlatform>
|
||||
<GodotTargetPlatform Condition=" '$(GodotTargetPlatform)' == '' and $(RuntimeIdentifier.StartsWith('freebsd')) ">linuxbsd</GodotTargetPlatform>
|
||||
<GodotTargetPlatform Condition=" '$(GodotTargetPlatform)' == '' and $(RuntimeIdentifier.StartsWith('osx')) ">macos</GodotTargetPlatform>
|
||||
<GodotTargetPlatform Condition=" '$(GodotTargetPlatform)' == '' and $(RuntimeIdentifier.StartsWith('win')) ">windows</GodotTargetPlatform>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Auto-detect the target Godot platform if it was not specified and there's no runtime identifier information. -->
|
||||
<PropertyGroup Condition=" '$(GodotTargetPlatform)' == '' ">
|
||||
<GodotTargetPlatform Condition=" '$([MSBuild]::IsOsPlatform(Linux))' ">linuxbsd</GodotTargetPlatform>
|
||||
<GodotTargetPlatform Condition=" '$([MSBuild]::IsOsPlatform(FreeBSD))' ">linuxbsd</GodotTargetPlatform>
|
||||
@@ -97,4 +109,6 @@
|
||||
|
||||
<DefineConstants>$(GodotDefineConstants);$(DefineConstants)</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(MSBuildThisFileDirectory)\iOSNativeAOT.props" Condition=" '$(GodotTargetPlatform)' == 'ios' " />
|
||||
</Project>
|
||||
|
||||
@@ -20,4 +20,8 @@
|
||||
<PackageReference Include="GodotSharp" Version="$(PackageVersion_GodotSharp)" />
|
||||
<PackageReference Include="GodotSharpEditor" Version="$(PackageVersion_GodotSharp)" Condition=" '$(Configuration)' == 'Debug' " />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- iOS-specific build targets -->
|
||||
<Import Project="$(MSBuildThisFileDirectory)\iOSNativeAOT.targets" Condition=" '$(GodotTargetPlatform)' == 'ios' " />
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<PublishAot>true</PublishAot>
|
||||
<PublishAotUsingRuntimePack>true</PublishAotUsingRuntimePack>
|
||||
<UseNativeAOTRuntime>true</UseNativeAOTRuntime>
|
||||
<TrimmerSingleWarn>false</TrimmerSingleWarn>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,58 @@
|
||||
<Project>
|
||||
<ItemGroup>
|
||||
<TrimmerRootAssembly Include="GodotSharp" />
|
||||
<TrimmerRootAssembly Include="$(TargetName)" />
|
||||
<LinkerArg Include="-install_name '@rpath/$(TargetName)$(NativeBinaryExt)'" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<LinkStandardCPlusPlusLibrary>true</LinkStandardCPlusPlusLibrary>
|
||||
<FindXCode Condition=" '$(XCodePath)' == '' and '$([MSBuild]::IsOsPlatform(OSX))' ">true</FindXCode>
|
||||
<XCodePath Condition=" '$(XCodePath)' == '' ">/Applications/Xcode.app/Contents/Developer</XCodePath>
|
||||
<XCodePath>$([MSBuild]::EnsureTrailingSlash('$(XCodePath)'))</XCodePath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="PrepareBeforeIlcCompile"
|
||||
BeforeTargets="IlcCompile">
|
||||
|
||||
<Copy SourceFiles="%(ResolvedRuntimePack.PackageDirectory)/runtimes/$(RuntimeIdentifier)/native/icudt.dat" DestinationFolder="$(PublishDir)"/>
|
||||
|
||||
<!-- We need to find the path to Xcode so we can set manual linker args to the correct SDKs
|
||||
Once https://github.com/dotnet/runtime/issues/88737 is released, we can take this out
|
||||
-->
|
||||
|
||||
<Exec Command="xcrun xcode-select -p" ConsoleToMSBuild="true" Condition=" '$(FindXCode)' == 'true' ">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="XcodeSelect" />
|
||||
</Exec>
|
||||
|
||||
<PropertyGroup Condition=" '$(FindXCode)' == 'true' ">
|
||||
<XCodePath>$(XcodeSelect)</XCodePath>
|
||||
<XCodePath>$([MSBuild]::EnsureTrailingSlash('$(XCodePath)'))</XCodePath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Message Importance="normal" Text="Found XCode at $(XcodeSelect)" Condition=" '$(FindXCode)' == 'true' "/>
|
||||
|
||||
<ItemGroup>
|
||||
<LinkerArg Include="-isysroot %22$(XCodePath)Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk%22"
|
||||
Condition=" $(RuntimeIdentifier.Contains('simulator')) "/>
|
||||
<LinkerArg Include="-isysroot %22$(XCodePath)Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk%22"
|
||||
Condition=" !$(RuntimeIdentifier.Contains('simulator')) "/>
|
||||
</ItemGroup>
|
||||
|
||||
</Target>
|
||||
|
||||
<Target 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>
|
||||
<SymbolFiles Include="$(NativeBinary).dsym\**\*.*"/>
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(SymbolFiles)" DestinationFolder="$(PublishDir)$(TargetName).framework.dSYM"/>
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user