Skip to content

Commit e3729eb

Browse files
authored
Make Silk.NET buildable on Linux by skipping iOS and Mac Catalyst stuff. (#2017)
1 parent 81cfc10 commit e3729eb

File tree

9 files changed

+25
-18
lines changed

9 files changed

+25
-18
lines changed

.github/workflows/bindings-regeneration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
run: dotnet tool install Nuke.GlobalTool --global
4949
- name: Install Workloads
5050
# TODO: This is slow. Maybe we can make a docker container with this already done?
51-
run: dotnet workload install android ios maccatalyst maui
51+
run: dotnet workload install android ios maccatalyst
5252
- uses: GuillaumeFalourd/[email protected]
5353
name: Setup Windows 11 SDK
5454
with:

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
with:
4949
dotnet-version: 7.0.102
5050
- name: Install Workloads
51-
run: dotnet workload install android ios maccatalyst maui
51+
run: dotnet workload install android ios maccatalyst
5252
- name: Test
5353
if: ${{ github.repository != 'dotnet/Silk.NET' || !startsWith(github.ref, 'refs/tags/') }}
5454
# skip Clean, Restore, and Compile as this will build the affect the whole solution.

.github/workflows/public-api.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
7.0.*
4343
- name: Install Workloads for Restore
4444
# TODO: This is slow. Maybe we can make a docker container with this already done?
45-
run: dotnet workload install android ios maccatalyst maui
45+
run: dotnet workload install android ios maccatalyst
4646
- name: Ensure Public API Declared
4747
run: ./build.sh EnsureApiDeclared
4848
env:

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
</div>
1414

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

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

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

8991
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`.
@@ -127,7 +129,7 @@ Silk.NET is a [.NET Foundation](https://www.dotnetfoundation.org/projects) proje
127129
<div>
128130
<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">
129131
<a><br/>
130-
132+
131133
Special thanks to [JetBrains](https://www.jetbrains.com/?from=Silk.NET) for supporting us with open-source licenses for their IDEs. </a>
132134
</div>
133135

src/Lab/Experiments/TriangleNET6/TriangleNET6.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios</TargetFrameworks>
5+
<TargetFrameworks>net6.0;net6.0-android</TargetFrameworks>
6+
<TargetFrameworks Condition="!$([MSBuild]::IsOsPlatform('Linux'))">$(TargetFrameworks);net6.0-ios</TargetFrameworks>
67
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
78
<LangVersion>preview</LangVersion>
89
<RuntimeIdentifiers Condition="'$(RuntimeIdentifiers)' == '' And '$(TargetFramework)' == 'net6.0'">$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifiers>

src/Maths/Silk.NET.Maths/Silk.NET.Maths.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0-android;net6.0-ios</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0-android</TargetFrameworks>
5+
<TargetFrameworks Condition="!$([MSBuild]::IsOsPlatform('Linux'))">$(TargetFrameworks);net6.0-ios</TargetFrameworks>
56
<Nullable>enable</Nullable>
67
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
78
<GenerateDocumentationFile>true</GenerateDocumentationFile>

src/Vulkan/Silk.NET.Vulkan/Silk.NET.Vulkan.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0</TargetFrameworks>
5+
<TargetFrameworks Condition="!$([MSBuild]::IsOsPlatform('Linux'))">$(TargetFrameworks);net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
56
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
67
<LangVersion>preview</LangVersion>
78
</PropertyGroup>

src/Windowing/Silk.NET.Windowing.Sdl/Silk.NET.Windowing.Sdl.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net6.0-android</TargetFrameworks>
5+
<TargetFrameworks Condition="!$([MSBuild]::IsOsPlatform('Linux'))">$(TargetFrameworks);net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
56
<LangVersion>8</LangVersion>
67
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
78
<Nullable>enable</Nullable>
89
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
910
</PropertyGroup>
10-
11+
1112
<ItemGroup>
1213
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
1314
<_Parameter1>Silk.NET.Input.Sdl</_Parameter1>

src/Windowing/Silk.NET.Windowing/Silk.NET.Windowing.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

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

89
<ItemGroup>
910
<ProjectReference Include="..\Silk.NET.Windowing.Common\Silk.NET.Windowing.Common.csproj" />
1011
</ItemGroup>
11-
12+
1213
<ItemGroup Condition="'$(TargetFramework)' != 'net6.0-android' And '$(TargetFramework)' != 'net6.0-ios' And '$(TargetFramework)' != 'net6.0-maccatalyst' And '$(TargetFramework)' != 'net6.0'">
1314
<ProjectReference Include="..\Silk.NET.Windowing.Glfw\Silk.NET.Windowing.Glfw.csproj" />
1415
<ProjectReference Include="..\Silk.NET.Windowing.Sdl\Silk.NET.Windowing.Sdl.csproj" />

0 commit comments

Comments
 (0)