feat: add ios/macos configuration

This commit is contained in:
Hugo Pointcheval 2023-11-06 22:25:12 +01:00
parent bee735b029
commit 50dcf9b6d5
Signed by: hugo
GPG Key ID: 3AAC487E131E00BC
2 changed files with 90 additions and 0 deletions

View File

@ -0,0 +1,7 @@
namespace __MainDummyNamespace;
// TODO: This is a temporary workaround to allow the .NET compiler to generate an iOS native dylib
public static class __MainDummyClass
{
public static void Main() { }
}

View File

@ -77,6 +77,89 @@
<Exec Command="sed -i -z $(ExportsPatch) $(ExportsFile)" />
</Target>
<PropertyGroup>
<MacOSMinVersion>13.0</MacOSMinVersion>
<iOSMinVersion>16.0</iOSMinVersion>
</PropertyGroup>
<!-- Set min macOS version -->
<Choose>
<When Condition="$(RuntimeIdentifier.Contains('osx'))">
<ItemGroup>
<LinkerArg Include="-mmacosx-version-min=$(MacOSMinVersion)" />
</ItemGroup>
</When>
</Choose>
<!-- Culture stuff for iOS Support -->
<Choose>
<When Condition="$(RuntimeIdentifier.Contains('ios'))">
<!-- If globalization is not required, you can enable this instead of providing an icudt.dat file on iOS -->
<!-- <PropertyGroup>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup> -->
<!-- When this is set, an icudt.dat must be placed in the resulting bundle -->
<ItemGroup>
<RuntimeHostConfigurationOption Include="ICU_DAT_FILE_PATH" Value="icudt.dat" />
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(RuntimeIdentifier.Contains('ios'))">
<ItemGroup>
<!-- Link to Swift on iOS (it's automatic when targeting macOS) -->
<LinkerArg Include="-L/usr/lib/swift" />
</ItemGroup>
</When>
</Choose>
<!-- TODO: Temporary workarounds for iOS/iOS Simulator support -->
<Choose>
<When Condition="$(RuntimeIdentifier.Contains('ios'))">
<PropertyGroup>
<PublishAotUsingRuntimePack>true</PublishAotUsingRuntimePack>
<_IsAppleMobileLibraryMode>false</_IsAppleMobileLibraryMode>
</PropertyGroup>
</When>
</Choose>
<Choose>
<When Condition="$(RuntimeIdentifier.Contains('iossimulator'))">
<ItemGroup>
<!-- TODO: Temporary workaround for iOS Simulator support -->
<LinkerArg Include="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk" />
<!-- Set min iOS version -->
<LinkerArg Include="-mios-simulator-version-min=$(iOSMinVersion)" />
</ItemGroup>
</When>
</Choose>
<!-- TODO: Temporary workarounds for iOS support -->
<Choose>
<When Condition="$(RuntimeIdentifier.Contains('ios-'))">
<ItemGroup>
<!-- TODO: Temporary workaround for iOS support -->
<LinkerArg Include="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk" />
<!-- Set min iOS version -->
<LinkerArg Include="-mios-version-min=$(iOSMinVersion)" />
</ItemGroup>
</When>
</Choose>
<!-- Strip Symbols in Release Builds -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<StripSymbols>true</StripSymbols>
</PropertyGroup>
<!-- Item Excludes -->
<PropertyGroup>
<DefaultItemExcludes>$(DefaultItemExcludes);.gitignore;*.sln.DotSettings;</DefaultItemExcludes>
</PropertyGroup>
<!-- Project References -->
<ItemGroup>
<ProjectReference Include="..\MyLib.Managed\MyLib.Managed.csproj" />