From 33fca5fd5d67f98a25235bf0aa034a9ebe1d4e69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20D=C3=BCrrenberger?= Date: Sun, 8 Sep 2024 20:04:45 +0200 Subject: [PATCH] Fix NuGet build for master --- .github/workflows/nuget.yml | 2 +- tools/nuget/build.linux.sh | 17 +++++++------- tools/nuget/build.macos.sh | 2 +- tools/nuget/build.win.ps1 | 35 ++++++++++++++-------------- tools/nuget/docker.fedora-x64.sh | 1 + tools/nuget/docker.linux-musl-x64.sh | 2 +- 6 files changed, 30 insertions(+), 29 deletions(-) diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml index eb68c0e5..c09cca9d 100644 --- a/.github/workflows/nuget.yml +++ b/.github/workflows/nuget.yml @@ -136,7 +136,7 @@ jobs: name: Linux MUSL x64 runs-on: ubuntu-22.04 container: - image: alpine:3.15 + image: alpine:3.20.3 steps: - name: Checkout CSFML diff --git a/tools/nuget/build.linux.sh b/tools/nuget/build.linux.sh index b7d70d4e..48a49d60 100755 --- a/tools/nuget/build.linux.sh +++ b/tools/nuget/build.linux.sh @@ -88,15 +88,16 @@ SFMLLibDir="$(realpath lib)" cmake -E env LDFLAGS="-z origin" \ cmake \ - '-DBUILD_SHARED_LIBS=1' \ + '-DBUILD_SHARED_LIBS=ON' \ '-DCMAKE_BUILD_TYPE=Release' \ + "-DCMAKE_INSTALL_PREFIX=$SFMLLibDir" \ "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$SFMLLibDir" \ - '-DCMAKE_BUILD_WITH_INSTALL_RPATH=1' \ + '-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON' \ '-DCMAKE_INSTALL_RPATH=$ORIGIN' \ - '-DSFML_BUILD_NETWORK=0' \ + '-DSFML_BUILD_NETWORK=OFF' \ "$SFMLDir" -cmake --build . --config Release +cmake --build . --config Release --target install popd # Pop SFML @@ -113,13 +114,13 @@ CSFMLLibDir="$(realpath lib)" # The directory that contains the final CSFML libr cmake -E env LDFLAGS="-z origin" \ cmake \ - "-DSFML_ROOT=$SFMLBuiltDir" \ - '-DBUILD_SHARED_LIBS=1' \ + "-DSFML_ROOT=$SFMLLibDir" \ + '-DBUILD_SHARED_LIBS=ON' \ '-DCMAKE_BUILD_TYPE=Release' \ "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$CSFMLLibDir" \ - '-DCMAKE_BUILD_WITH_INSTALL_RPATH=1' \ + '-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON' \ '-DCMAKE_INSTALL_RPATH=$ORIGIN' \ - '-DCSFML_BUILD_NETWORK=0' \ + '-DCSFML_BUILD_NETWORK=OFF' \ "$CSFMLDir" cmake --build . --config Release diff --git a/tools/nuget/build.macos.sh b/tools/nuget/build.macos.sh index 2ecf36e8..d1b946e7 100755 --- a/tools/nuget/build.macos.sh +++ b/tools/nuget/build.macos.sh @@ -133,7 +133,7 @@ CSFMLLibDir="$(realpath lib)" # The directory that contains the final CSFML libr cmake -E env \ cmake -G "Unix Makefiles" \ - -D "SFML_ROOT=$SFMLBuiltDir" \ + -D "SFML_ROOT=$SFMLLibDir" \ -D 'BUILD_SHARED_LIBS=ON' \ -D 'CMAKE_BUILD_TYPE=Release' \ -D "CMAKE_OSX_ARCHITECTURES=$ARCHITECTURE" \ diff --git a/tools/nuget/build.win.ps1 b/tools/nuget/build.win.ps1 index 2e87959f..8f63b1c2 100644 --- a/tools/nuget/build.win.ps1 +++ b/tools/nuget/build.win.ps1 @@ -86,11 +86,9 @@ $SFMLDir = (Get-Item .).FullName switch ($RID) { 'win-x86' { $SFMLExtLibs = (Get-Item ./extlibs/libs-msvc-universal/x86).FullName - $SFMLAudioExtras = (Get-Item ./extlibs/bin/x86).FullName } 'win-x64' { $SFMLExtLibs = (Get-Item ./extlibs/libs-msvc-universal/x64).FullName - $SFMLAudioExtras = (Get-Item ./extlibs/bin/x64).FullName } Default { Write-Error "Unknown RID '$RID'" @@ -108,24 +106,25 @@ Remove-Item -Recurse -Force -ErrorAction Ignore "$RID" New-Push "$RID" - Write-Output "Building SFML" New-Push SFML $SFMLBuiltDir = Get-Location # The directory where SFML was built to. Used later to direct cmake when building CSFML +$SFMLInstallDir = Join-Path -Path $SFMLBuiltDir -ChildPath 'install' cmake ` - '-DBUILD_SHARED_LIBS=0' ` + '-DBUILD_SHARED_LIBS=ON' ` '-DCMAKE_BUILD_TYPE=Release' ` '-DCMAKE_SYSTEM_VERSION=8.1' ` - '-DSFML_USE_STATIC_STD_LIBS=1' ` - '-DSFML_BUILD_NETWORK=0' ` + '-DSFML_USE_STATIC_STD_LIBS=OFF' ` + '-DSFML_BUILD_NETWORK=OFF' ` + "-DCMAKE_INSTALL_PREFIX=$SFMLInstallDir" ` "-G$Generator" ` "-A$Architecture" ` $SFMLDir Ensure-Success -cmake --build . --config Release -- '-verbosity:minimal' +cmake --build . --config Release --target install -- '-verbosity:minimal' Ensure-Success Pop-Location # Pop SFML @@ -134,15 +133,15 @@ Pop-Location # Pop SFML # STEP 4: Build CSFML # # =================== # -Write-Output "Building CSFML using SFML at $SFMLBuiltDir" +Write-Output "Building CSFML using SFML at $SFMLInstallDir" New-Push CSFML New-Item -ItemType Directory lib > $null $CSFMLLibDir = (Get-Item lib).FullName; # The directory where the final CSFML dlls are located cmake ` - "-DSFML_ROOT=$SFMLBuiltDir" ` - '-DCSFML_LINK_SFML_STATICALLY=1' ` + "-DSFML_ROOT=$SFMLInstallDir" ` + '-DCSFML_LINK_SFML_STATICALLY=OFF' ` "-DCMAKE_LIBRARY_PATH=$SFMLExtLibs" ` ` "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$CSFMLLibDir" ` @@ -155,11 +154,11 @@ cmake ` "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=$CSFMLLibDir" ` ` '-DCMAKE_SYSTEM_VERSION=8.1' ` - '-DSTATIC_STD_LIBS=1' ` + '-DSTATIC_STD_LIBS=OFF' ` ` - "-DBUILD_SHARED_LIBS=1" ` + '-DBUILD_SHARED_LIBS=ON' ` '-DCMAKE_BUILD_TYPE=Release' ` - '-DCSFML_BUILD_NETWORK=0' ` + '-DCSFML_BUILD_NETWORK=OFF' ` ` "-G$generator" ` "-A$Architecture" ` @@ -178,7 +177,7 @@ Write-Output "Copying CSFML modules" <# .SYNOPSIS -Copies a specific CSFML module into its proper NuGet project +Copies a specific SFML & CSFML module into its proper NuGet project .DESCRIPTION This function locates a file named csfml-(module)-3.dll inside of the @@ -186,13 +185,16 @@ folder specified by $CSFMLLibDir and copies it to $OutDir/csfml-(module).dll. Notice how it removes the "-3" at the end, to make the name compatible with other platforms. +The "-3" prefix is retained for the SFML libraries. + .PARAMETER module The case-insensitive name of the module to copy. #> function Copy-Module($module) { - Write-Output "Copying CSFML $module" + Write-Output "Copying SFML & CSFML $module" New-Item -ItemType Directory $OutDir -ErrorAction Ignore > $null + Copy-Item "$SFMLInstallDir/bin/sfml-$module-3.dll" "$OutDir" -Force > $null Copy-Item "$CSFMLLibDir/csfml-$module-3.dll" "$OutDir/csfml-$module.dll" -Force > $null } @@ -201,9 +203,6 @@ Copy-Module 'graphics' Copy-Module 'system' Copy-Module 'window' -Write-Output "Copying Audio module extra files" -Copy-Item "$SFMLAudioExtras/*" "$OutDir" - Pop-Location # Pop CSFML Pop-Location # Pop $RID Pop-Location # Pop Build diff --git a/tools/nuget/docker.fedora-x64.sh b/tools/nuget/docker.fedora-x64.sh index 6cb72174..30913a65 100755 --- a/tools/nuget/docker.fedora-x64.sh +++ b/tools/nuget/docker.fedora-x64.sh @@ -9,6 +9,7 @@ dnf install -y \ xorg-x11-server-devel \ libXrandr-devel \ libXcursor-devel \ + libXi-devel \ systemd-devel \ mesa-libEGL-devel \ flac-devel \ diff --git a/tools/nuget/docker.linux-musl-x64.sh b/tools/nuget/docker.linux-musl-x64.sh index a4521d4c..c69f9b63 100644 --- a/tools/nuget/docker.linux-musl-x64.sh +++ b/tools/nuget/docker.linux-musl-x64.sh @@ -11,12 +11,12 @@ apk add \ libx11-dev \ libxrandr-dev \ libxcursor-dev \ + libxi-dev \ eudev-dev \ mesa-dev \ flac-dev \ libogg-dev \ libvorbis-dev \ - libpthread-stubs \ cmake \ make \ g++