Skip to content

Commit

Permalink
Update NuGet tooling
Browse files Browse the repository at this point in the history
- Add officially supported RID for Linux and macOS
- Ensure reproducible builds with fixed image versions
- Add additional dependencies
- Add dirty workaround (for now) for macOS builds
  • Loading branch information
eXpl0it3r committed Jun 9, 2023
1 parent 39d7c47 commit fe8145e
Show file tree
Hide file tree
Showing 16 changed files with 401 additions and 213 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@

# Build folders
build/
cmake-build-*/

# Cache/IDE folders
.cache/
.vscode/
.idea/
.vs/

# System files
.DS_Store
14 changes: 4 additions & 10 deletions tools/nuget/CSFML/CSFML.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="16.0">

<PropertyGroup>
<TargetFramework>netstandard1.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>

<!-- Workaround to remove the NETStandard.Library NuGet reference without breaking everything -->
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>

<Version>2.5.1</Version>
<Version>2.5.2</Version>
<Authors>Laurent Gomila</Authors>
<PackageTags>sfml csfml</PackageTags>
<Copyright>Copyright © Laurent Gomila</Copyright>
Expand All @@ -22,10 +19,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="all" />

<!-- Workaround to remove the NETStandard.Library NuGet reference without breaking everything -->
<PackageReference Include="NETStandard.Library" Version="1.6.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="all" />
</ItemGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion tools/nuget/CSFML/build/netframework/CSFML.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CSFMLIgnoreAnyCPU>false</CSFMLIgnoreAnyCPU>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion tools/nuget/CSFML/build/netframework/CSFML.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Target Name="CSFMLAnyCPUError" Condition="$(CSFMLIgnoreAnyCPU) != true and $(Platform) == 'AnyCPU'" BeforeTargets="Build">
<Error Text="CSFML doesn't support 'Any CPU' on the .NET Framework. Consider switching to .NET Core. If this is not possible, change your platform to x64 or x86, or set the MSBuild property 'CSFMLIgnoreAnyCPU' to true and manually load the appropriate native library at runtime." />
Expand Down
17 changes: 11 additions & 6 deletions tools/nuget/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,22 @@ All build scripts follow the same routine:
This generic script doesn't install any of its dependencies. As such, you must have cmake and make installed, as well as all [SFML Dependencies](https://www.sfml-dev.org/tutorials/2.5/compile-with-cmake.php#installing-dependencies) available to cmake.

* `build.macos.sh`
* A [Bash](https://www.gnu.org/software/bash/) script to build libraries for macOS. The [Runtime Identifier](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog#macos-rids) of the macOS distribution must be specified as parameter to the script.
* A [Bash](https://www.gnu.org/software/bash/) script to build libraries for macOS. The [Runtime Identifier](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog#macos-rids) of the macOS distribution must be specified as parameter to the script. Latest macOS SDKs can be downloaded [here](https://github.com/phracker/MacOSX-SDKs/releases).
Currently supported RIDs are:
* osx.10.15-x64
* osx.11.0-x64
* osx.11.0-arm64 (requires SFML 2.6)
* `osx-x64` (uses macOS SDK 10.12)
* `osx.11.0-x64`
* `osx.11.0-arm64` (requires SFML 2.6)

* `build.docker.sh`, `build.docker.ps1`
* A script to build the native libraries for a Linux distribution in a Docker container. If no RID is specified as a parameter, all supported RIDs will be built. Currently, the supported RIDs are:
* `alpine-x64`
* `linux-x64` (uses Ubuntu)
* `linux-musl-x64` (uses Apline)
* `linux-arm` (uses Arm32v7 Ubuntu)
* `linux-arm64` (uses Arm64v8 Ubuntu )
* `alpine-x64`
* `debian-x64` (compatible with derivatives such as Ubuntu and Linux Mint)
* `fedora-x64`
* `ubuntu-x64`
* `fedora-x64`

* `pushnuget.ps1`, `pushnuget.sh`
* A script to automatically build and push the NuGet package to nuget.org. Make sure that all the native libraries are in `CSFML/runtimes/` before running this.
Expand Down
35 changes: 28 additions & 7 deletions tools/nuget/build.docker.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ Param(
$ErrorActionPreference = "Stop"

if (-not $RID ) {
Write-Output "No RID specified, building all known RIDs"
./build.docker.ps1 "alpine-x64"
./build.docker.ps1 "debian-x64"
./build.docker.ps1 "fedora-x64"
Write-Output "No RID specified, building all common RIDs"
./build.docker.ps1 "linux-x64"
./build.docker.ps1 "linux-musl-x64"
./build.docker.ps1 "linux-arm"
./build.docker.ps1 "linux-arm64"
exit
}

Expand All @@ -18,15 +19,35 @@ $Shell = $null

switch ($RID) {
'alpine-x64' {
$Image = 'alpine'
$Image = 'alpine:3.7'
$Shell = '/bin/sh'
}
'debian-x64' {
$Image = 'debian'
$Image = 'debian:bullseye'
$Shell = '/bin/bash'
}
'ubuntu-x64' {
$Image = 'ubuntu:22.04'
$Shell = '/bin/bash'
}
'fedora-x64' {
$Image = 'fedora'
$Image = 'fedora:37'
$Shell = '/bin/bash'
}
'linux-x64' {
$Image = 'ubuntu:22.04'
$Shell = '/bin/bash'
}
'linux-musl-x64' {
$Image = 'alpine:3.15'
$Shell = '/bin/sh'
}
'linux-arm' {
$Image = 'arm32v7/ubuntu:22.04'
$Shell = '/bin/bash'
}
'linux-arm64' {
$Image = 'arm64v8/ubuntu:22.04'
$Shell = '/bin/bash'
}
Default {
Expand Down
Loading

0 comments on commit fe8145e

Please sign in to comment.