Skip to content

Commit

Permalink
Make Silk.NET buildable on Linux by skipping iOS and Mac Catalyst stu…
Browse files Browse the repository at this point in the history
…ff. (#2017)
  • Loading branch information
alexrp committed Apr 9, 2024
1 parent 81cfc10 commit e3729eb
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bindings-regeneration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
run: dotnet tool install Nuke.GlobalTool --global
- name: Install Workloads
# TODO: This is slow. Maybe we can make a docker container with this already done?
run: dotnet workload install android ios maccatalyst maui
run: dotnet workload install android ios maccatalyst
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v1.9
name: Setup Windows 11 SDK
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
with:
dotnet-version: 7.0.102
- name: Install Workloads
run: dotnet workload install android ios maccatalyst maui
run: dotnet workload install android ios maccatalyst
- name: Test
if: ${{ github.repository != 'dotnet/Silk.NET' || !startsWith(github.ref, 'refs/tags/') }}
# skip Clean, Restore, and Compile as this will build the affect the whole solution.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/public-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
7.0.*
- name: Install Workloads for Restore
# TODO: This is slow. Maybe we can make a docker container with this already done?
run: dotnet workload install android ios maccatalyst maui
run: dotnet workload install android ios maccatalyst
- name: Ensure Public API Declared
run: ./build.sh EnsureApiDeclared
env:
Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

</div>

<div>
<div>
<!-- End exclude from NuGet readme. -->
<!-- Begin include in NuGet readme.
![Silk.NET Logo](https://raw.githubusercontent.com/dotnet/Silk.NET/main/documentation/readme/silkdotnet_v3_horizontal_96.svg)
Expand Down Expand Up @@ -74,16 +74,18 @@ In addition, the Silk.NET working group help drive larger user-facing changes pr
<h1 align="center">Building from source</h1>

Prerequisites
- **Must**: .NET 6 SDK
- **Should**: [NUKE](https://nuke.build) (build system). Install using `dotnet tool install Nuke.GlobalTool --global`
- **Should**: Android, iOS, and MAUI .NET 6 workloads (use `dotnet workload install android ios maccatalyst maui` to install them)
- **Should**: Android SDK version 30 with NDK tools installed. On Windows, for best results this should be installed into `C:\ProgramData\Android\android-sdk`.
- **Could**: Java JDK (for gradle)
- **Could**: Visual Studio 2022 Community version 17.0 or later
- .NET 6 SDK and .NET 7 SDK
- Android, iOS, and Mac Catalyst workloads (use `dotnet workload install android ios maccatalyst` to install them)
- On Linux, `ios` and `maccatalyst` should be omitted as they are not available
- Android SDK version 30 with NDK tools installed
- On Windows, for best results this should be installed into `C:\ProgramData\Android\android-sdk`
- Java 11 JDK
- Visual Studio 2022 Community version 17.0 or later (optional)

Instructions
- Clone the repository (recursively)
- Run build.sh, build.cmd, build.ps1, or `nuke compile`.
- On Linux, you may need to pass `--msbuild-properties AndroidSdkDirectory=/path/to/android/sdk`
- Use the DLLs. To get nupkgs you can use with NuGet instead, use `nuke pack`.

There are more advanced build actions you can do too, such as FullBuild, Pack, FullPack, among others which you can view by doing `nuke --plan`.
Expand Down Expand Up @@ -127,7 +129,7 @@ Silk.NET is a [.NET Foundation](https://www.dotnetfoundation.org/projects) proje
<div>
<a href="https://www.jetbrains.com/?from=Silk.NET" align="right"><img src="https://raw.githubusercontent.com/dotnet/Silk.NET/main/documentation/readme/jetbrains.svg" alt="JetBrains" class="logo-footer" width="72" align="left">
<a><br/>

Special thanks to [JetBrains](https://www.jetbrains.com/?from=Silk.NET) for supporting us with open-source licenses for their IDEs. </a>
</div>

Expand Down
3 changes: 2 additions & 1 deletion src/Lab/Experiments/TriangleNET6/TriangleNET6.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios</TargetFrameworks>
<TargetFrameworks>net6.0;net6.0-android</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOsPlatform('Linux'))">$(TargetFrameworks);net6.0-ios</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>preview</LangVersion>
<RuntimeIdentifiers Condition="'$(RuntimeIdentifiers)' == '' And '$(TargetFramework)' == 'net6.0'">$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifiers>
Expand Down
3 changes: 2 additions & 1 deletion src/Maths/Silk.NET.Maths/Silk.NET.Maths.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0-android;net6.0-ios</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0-android</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOsPlatform('Linux'))">$(TargetFrameworks);net6.0-ios</TargetFrameworks>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
3 changes: 2 additions & 1 deletion src/Vulkan/Silk.NET.Vulkan/Silk.NET.Vulkan.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOsPlatform('Linux'))">$(TargetFrameworks);net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>preview</LangVersion>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net6.0-android</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOsPlatform('Linux'))">$(TargetFrameworks);net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<LangVersion>8</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
</PropertyGroup>

<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1>Silk.NET.Input.Sdl</_Parameter1>
Expand Down
5 changes: 3 additions & 2 deletions src/Windowing/Silk.NET.Windowing/Silk.NET.Windowing.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net6.0-android</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOsPlatform('Linux'))">$(TargetFrameworks);net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<SilkMetapackage>true</SilkMetapackage>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Silk.NET.Windowing.Common\Silk.NET.Windowing.Common.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net6.0-android' And '$(TargetFramework)' != 'net6.0-ios' And '$(TargetFramework)' != 'net6.0-maccatalyst' And '$(TargetFramework)' != 'net6.0'">
<ProjectReference Include="..\Silk.NET.Windowing.Glfw\Silk.NET.Windowing.Glfw.csproj" />
<ProjectReference Include="..\Silk.NET.Windowing.Sdl\Silk.NET.Windowing.Sdl.csproj" />
Expand Down

0 comments on commit e3729eb

Please sign in to comment.