Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial work on getting the sdl redist to work
- Loading branch information
1 parent
2288036
commit f982fef
Showing
6 changed files
with
201 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: OpenTK SDL Redistributable | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
jobs: | ||
build: | ||
env: | ||
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | ||
|
||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- name: Install X11 dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install xorg-dev | ||
- uses: actions/checkout@v3 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 6.0.x | ||
- name: Download dependencies and create Nuget Package | ||
run: ./make_nuget.ps1 "" ${{ github.run_number }} | ||
shell: pwsh | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: NugetPackage | ||
path: ./artifacts/*.nupkg | ||
- name: Deploy Nuget Package | ||
run: dotnet nuget push ./artifacts/*.nupkg -k $NUGET_API_KEY -s https://api.nuget.org/v3/index.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/bin | ||
/obj | ||
/docs | ||
/include | ||
/*.nupkg | ||
/artifacts/ | ||
/bin/ | ||
/obj/ | ||
/tmp/ | ||
/desktop.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
Param([parameter(Mandatory=$true,Position=0)][String]$SDL_VERSION) | ||
|
||
# FIXME: Get out the major version so we can do SDL2 and SDL3 | ||
|
||
New-Item -ItemType Directory -Force -Path tmp | ||
|
||
try{ | ||
Invoke-WebRequest -Uri https://opentk.net/assets/opentk.png -OutFile tmp/opentk.png -Resume | ||
} catch [System.NullReferenceException] { | ||
} | ||
|
||
try{ | ||
Invoke-WebRequest -Uri https://github.com/libsdl-org/SDL/releases/download/release-$SDL_VERSION/SDL2-$SDL_VERSION-win32-x86.zip -OutFile tmp/win32-x86.zip -Resume | ||
} catch [System.NullReferenceException] { | ||
} | ||
try{ | ||
Invoke-WebRequest -Uri https://github.com/libsdl-org/SDL/releases/download/release-$SDL_VERSION/SDL2-$SDL_VERSION-win32-x64.zip -OutFile tmp/win32-x64.zip -Resume | ||
} catch [System.NullReferenceException] { | ||
} | ||
|
||
try{ | ||
|
||
Invoke-WebRequest -Uri https://github.com/libsdl-org/SDL/releases/download/release-$SDL_VERSION/SDL2-$SDL_VERSION.dmg -OutFile tmp/macos.dmg -Resume | ||
} catch [System.NullReferenceException] { | ||
} | ||
|
||
try{ | ||
Invoke-WebRequest -Uri https://github.com/libsdl-org/SDL/releases/download/release-$SDL_VERSION/SDL2-$SDL_VERSION.zip -OutFile tmp/source.zip -Resume | ||
} catch [System.NullReferenceException] { | ||
} | ||
|
||
Expand-Archive -Path tmp/win32-x86.zip -DestinationPath tmp/win32-x86/ -Force | ||
Expand-Archive -Path tmp/win32-x64.zip -DestinationPath tmp/win32-x64/ -Force | ||
Expand-Archive -Path tmp/source.zip -DestinationPath tmp/ -Force | ||
if (Test-Path tmp/src) { | ||
Remove-Item -Recurse -Path tmp/src | ||
} | ||
Rename-Item -Path tmp/SDL2-$SDL_VERSION -NewName src | ||
|
||
mkdir tmp/src/build | ||
pushd tmp/src/ | ||
cmake -S . -B build && cmake --build build && cmake --install build | ||
|
||
#cmake -DCMAKE_BUILD_TYPE=Release -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=ON .. | ||
|
||
if ($LastExitCode -ne 0) { | ||
throw 'SDL compilation setup failed' | ||
} | ||
|
||
make -j | ||
|
||
if ($LastExitCode -ne 0) { | ||
throw 'SDL compilation failed' | ||
} | ||
|
||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
param([String]$projectDir, [int]$verBuild) | ||
|
||
$ErrorActionPreference = "Stop" | ||
[String]$SDL_VERSION="2.26.5" | ||
|
||
# The built .so file will end in .so.3.3 for a version like 3.3.7, to get the correct file we need to pass "3.3" to the .csproj | ||
# [String]$GLFW_SHORT_VERSION = $GLFW_VERSION.Substring(0, $GLFW_VERSION.LastIndexOf(".")) | ||
|
||
$buildVersionResult = $verBuild.ToString() | ||
$currentBranch=(git branch --show-current) | ||
Write-Output "Current Branch: $currentBranch" | ||
|
||
if($currentBranch -eq "develop") { | ||
$buildVersionResult = "0-pre" + (Get-Date).ToUniversalTime().ToString("yyyyMMddHHmmss") | ||
} | ||
|
||
|
||
./download_dependencies.ps1 $SDL_VERSION | ||
|
||
return | ||
# FIXME! | ||
$header = Get-Content([System.IO.Path]::Combine($projectDir, ".\tmp\src\include\SDL\sdl.h")) | Out-String | ||
|
||
if ($header -match '(?m)^#define\s+GLFW_VERSION_MAJOR\s+(\d+)\s*$') { $verMajor = $Matches[1] } | ||
else { throw "Failed to parse major version number from header." } | ||
if ($header -match '(?m)^#define\s+GLFW_VERSION_MINOR\s+(\d+)\s*$') { $verMinor = $Matches[1] } | ||
else { throw "Failed to parse minor version number from header." } | ||
if ($header -match '(?m)^#define\s+GLFW_VERSION_REVISION\s+(\d+)\s*$') { $verPatch = $Matches[1] } | ||
else { throw "Failed to parse patch version number from header." } | ||
|
||
$version = "$verMajor.$verMinor.$verPatch.$buildVersionResult" | ||
|
||
$nuspec = [System.IO.Path]::Combine($projectDir, ".\sdl-redist.csproj") | ||
|
||
dotnet pack $nuspec -c Release -p:VERSION="$version" -p:GLFW_VERSION="$GLFW_VERSION" -p:GLFW_SHORT_VERSION="$GLFW_SHORT_VERSION" -o ./artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<Project Sdk="Microsoft.NET.Sdk" DefaultTargets="Pack"> | ||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<NoBuild>true</NoBuild> | ||
<IncludeBuildOutput>false</IncludeBuildOutput> | ||
<IncludeSymbols>false</IncludeSymbols> | ||
<RuntimeIdentifiers>win-x86;win-x64;osx-x64;osx-arm64;linux-x64</RuntimeIdentifiers> | ||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild> | ||
<PackageVersion>$(VERSION)</PackageVersion> | ||
|
||
<PackageProjectUrl>https://www.libsdl.org/</PackageProjectUrl> | ||
<PackageLicenseFile>COPYING.md</PackageLicenseFile> | ||
|
||
<PackageId>OpenTK.redist.sdl</PackageId> | ||
<Authors>Team OpenTK</Authors> | ||
<Owners>Team OpenTK</Owners> | ||
<Description>SDL redistributables for OpenTK.</Description> | ||
<PackageIcon>opentk.png</PackageIcon> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Content Include="tmp/glfw-$(GLFW_VERSION).bin.WIN64/lib-vc2019/*.dll"> | ||
<PackagePath>runtimes/win-x64/native/</PackagePath> | ||
<Pack>true</Pack> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
<Content Include="tmp/glfw-$(GLFW_VERSION).bin.WIN32/lib-vc2019/*.dll"> | ||
<PackagePath>runtimes/win-x86/native/</PackagePath> | ||
<Pack>true</Pack> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
<Content Include="tmp/glfw-$(GLFW_VERSION).bin.MACOS/lib-x86_64/*.dylib"> | ||
<PackagePath>runtimes/osx-x64/native/</PackagePath> | ||
<Pack>true</Pack> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
<Content Include="tmp/glfw-$(GLFW_VERSION).bin.MACOS/lib-arm64/*.dylib"> | ||
<PackagePath>runtimes/osx-arm64/native/</PackagePath> | ||
<Pack>true</Pack> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
<Content Include="tmp/src/build/src/*.so.$(GLFW_SHORT_VERSION)"> | ||
<PackagePath>runtimes/linux-x64/native/</PackagePath> | ||
<Pack>true</Pack> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
|
||
<Content Include="tmp/glfw-$(GLFW_VERSION).bin.WIN32/LICENSE.md"> | ||
<PackagePath>COPYING.md</PackagePath> | ||
<Pack>true</Pack> | ||
</Content> | ||
<None Include="tmp/opentk.png" Pack="true" PackagePath="/"/> | ||
|
||
<!-- We need to add this file to get rid of the NU5128 warning. | ||
We don't have any assemblies in this package so we add an empty _._ file | ||
See "Add an empty _._ file" bullet point here: | ||
https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu5128#solution-1 --> | ||
<Content Include="_._"> | ||
<PackagePath>lib/netstandard2.0/_._</PackagePath> | ||
</Content> | ||
</ItemGroup> | ||
</Project> |