<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Library</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <LangVersion>latest</LangVersion>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <PublishTrimmed>true</PublishTrimmed>
    <PublishAot>true</PublishAot>
    <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
    <EnablePreviewFeatures>true</EnablePreviewFeatures>
    
    <StripSymbols>true</StripSymbols>

    <!-- TODO: Disabled for now to get faster build times -->
    <Nullable>disable</Nullable>
    
    <!-- Seems to not be required as long as we're providing the RuntimeIdentifier when calling dotnet publish/build -->
    <!-- <RuntimeIdentifiers>osx-x64;osx-arm64;linux-x64;ios-arm64;iossimulator-arm64;iossimulator-x64</RuntimeIdentifiers> -->

    <MixInSwift>true</MixInSwift>
  </PropertyGroup>

  <PropertyGroup>
    <MacOSMinVersion>13.0</MacOSMinVersion>
    <iOSMinVersion>16.0</iOSMinVersion>
  </PropertyGroup>
  
  <!-- Compiler Customization -->

  <!-- Merge exported Symbols List -->
  <Target Name="MergeExportedSymbolsList" 
          BeforeTargets="LinkNative"
          Condition="$(MixInSwift) And ($(RuntimeIdentifier.Contains('osx')) Or $(RuntimeIdentifier.Contains('ios')))">
  </Target>

  <!-- 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/iPhoneSimulator17.0.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/iPhoneOS17.0.sdk" />

        <!-- Set min iOS version -->
        <LinkerArg Include="-mios-version-min=$(iOSMinVersion)" />
      </ItemGroup>
    </When>
  </Choose>
  
  <!-- Item Excludes -->
  <PropertyGroup>
    <DefaultItemExcludes>$(DefaultItemExcludes);.gitignore;*.sln.DotSettings;</DefaultItemExcludes>
  </PropertyGroup>

  <!-- Target Assembly Reference -->
  <ItemGroup>
    <ProjectReference Include="..\INPUT_PROJECT_NAME\INPUT_PROJECT_NAME.csproj" />
    <!-- ADD REFERENCES HERE (DO NOT DELETE THIS)-->
  </ItemGroup>

  <!-- Assembly References -->
  <ItemGroup>
		
  </ItemGroup>

</Project>