diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 71a5d85..11477d9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,10 @@ jobs: build_args: Release win-x86 build_target: win-x86 artifact_name: build\Release\win-x86\libveldrid-spirv.dll + - os: windows-latest + build_args: Release win-arm64 + build_target: win-arm64 + artifact_name: build\Release\win-arm64\libveldrid-spirv.dll - os: windows-latest build_args: release android arm64-v8a --android-ndk '%ANDROID_NDK_HOME%' build_target: android-arm64-v8a @@ -35,18 +39,30 @@ jobs: build_args: release linux-x64 build_target: linux-x64 artifact_name: build/Release/linux-x64/libveldrid-spirv.so + - os: ubuntu-20.04 + build_args: release linux-x86 + build_target: linux-x86 + artifact_name: build/Release/linux-x86/libveldrid-spirv.so + - os: ubuntu-20.04 + build_args: release linux-arm64 + build_target: linux-arm64 + artifact_name: build/Release/linux-arm64/libveldrid-spirv.so + - os: ubuntu-20.04 + build_args: release linux-arm + build_target: linux-arm + artifact_name: build/Release/linux-arm/libveldrid-spirv.so - os: macos-11 build_args: release osx 'arm64;x86_64' build_target: osx artifact_name: build/Release/osx/libveldrid-spirv.dylib - - os: macos-latest + - os: macos-11 build_args: release ios build_target: ios artifact_name: build/Release/ios/veldrid-spirv.xcframework.zip name: ${{ matrix.build_target }} Native Build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -94,7 +110,7 @@ jobs: run: dotnet run -p src/Veldrid.SPIRV.Tests/Veldrid.SPIRV.Tests.csproj -c Release --no-restore - name: Upload ${{ matrix.build_target }} Native Library - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.build_target }} path: ${{ matrix.artifact_name }} @@ -105,54 +121,78 @@ jobs: needs: native_builds steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Download win-x64 - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: win-x64 path: build/Release/win-x64 - name: Download win-x86 - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: win-x86 path: build/Release/win-x86 + - name: Download win-arm64 + uses: actions/download-artifact@v4 + with: + name: win-arm64 + path: build/Release/win-arm64 + - name: Download android-arm64-v8a - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: android-arm64-v8a path: build/Release/android-arm64-v8a - name: Download android-x86_64 - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: android-x86_64 path: build/Release/android-x86_64 - name: Download android-armeabi-v7a - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: android-armeabi-v7a path: build/Release/android-armeabi-v7a - name: Download linux-x64 - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: linux-x64 path: build/Release/linux-x64 + - name: Download linux-x86 + uses: actions/download-artifact@v4 + with: + name: linux-x86 + path: build/Release/linux-x86 + + - name: Download linux-arm64 + uses: actions/download-artifact@v4 + with: + name: linux-arm64 + path: build/Release/linux-arm64 + + - name: Download linux-arm + uses: actions/download-artifact@v4 + with: + name: linux-arm + path: build/Release/linux-arm + - name: Download osx - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: osx path: build/Release/osx - name: Download ios - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: ios path: build/Release/ios @@ -174,7 +214,7 @@ jobs: run: dotnet pack src/Veldrid.SPIRV -c Release --no-restore - name: Upload NuGet Package - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: nuget_package path: bin\Packages\Release\*.nupkg diff --git a/build-full-package.ps1 b/build-full-package.ps1 index 16b1f81..2d0db46 100644 --- a/build-full-package.ps1 +++ b/build-full-package.ps1 @@ -20,7 +20,11 @@ if (Test-Path $PSScriptRoot\download\) New-Item -ItemType Directory -Force -Path $PSScriptRoot\download\$configuration | Out-Null New-Item -ItemType Directory -Force -Path $PSScriptRoot\download\$configuration\win-x86 | Out-Null New-Item -ItemType Directory -Force -Path $PSScriptRoot\download\$configuration\win-x64 | Out-Null +New-Item -ItemType Directory -Force -Path $PSScriptRoot\download\$configuration\win-arm64 | Out-Null New-Item -ItemType Directory -Force -Path $PSScriptRoot\download\$configuration\linux-x64 | Out-Null +New-Item -ItemType Directory -Force -Path $PSScriptRoot\download\$configuration\linux-x86 | Out-Null +New-Item -ItemType Directory -Force -Path $PSScriptRoot\download\$configuration\linux-arm64 | Out-Null +New-Item -ItemType Directory -Force -Path $PSScriptRoot\download\$configuration\linux-arm | Out-Null New-Item -ItemType Directory -Force -Path $PSScriptRoot\download\$configuration\osx | Out-Null New-Item -ItemType Directory -Force -Path $PSScriptRoot\download\$configuration\ios | Out-Null New-Item -ItemType Directory -Force -Path $PSScriptRoot\download\$configuration\android-arm64-v8a | Out-Null @@ -55,16 +59,64 @@ if( -not $? ) Write-Host "- libveldrid-spirv.dll (x64)" $client.DownloadFile( - "https://github.com/mellinoe/veldrid-spirv/releases/download/$tag/libveldrid-spirv.so", + "https://github.com/mellinoe/veldrid-spirv/releases/download/$tag/libveldrid-spirv.win-arm64.dll", + "$PSScriptRoot/download/$configuration/win-arm64/libveldrid-spirv.dll") +if( -not $? ) +{ + $msg = $Error[0].Exception.Message + Write-Error "Couldn't download arm64 libveldrid-spirv.dll. This most likely indicates the Windows native build failed." + exit +} + +Write-Host "- libveldrid-spirv.dll (arm64)" + +$client.DownloadFile( + "https://github.com/mellinoe/veldrid-spirv/releases/download/$tag/libveldrid-spirv-x86-64.so", "$PSScriptRoot/download/$configuration/linux-x64/libveldrid-spirv.so") if( -not $? ) { $msg = $Error[0].Exception.Message - Write-Error "Couldn't download libveldrid-spirv.so (64-bit Linux). This most likely indicates the Linux native build failed." + Write-Error "Couldn't download libveldrid-spirv.so (x64 Linux). This most likely indicates the Linux native build failed." + exit +} + +Write-Host "- libveldrid-spirv.so (x64 Linux)" + +$client.DownloadFile( + "https://github.com/mellinoe/veldrid-spirv/releases/download/$tag/libveldrid-spirv-x86.so", + "$PSScriptRoot/download/$configuration/linux-x86/libveldrid-spirv.so") +if( -not $? ) +{ + $msg = $Error[0].Exception.Message + Write-Error "Couldn't download libveldrid-spirv.so (x86 Linux). This most likely indicates the Linux native build failed." + exit +} + +Write-Host "- libveldrid-spirv.so (x86 Linux)" + +$client.DownloadFile( + "https://github.com/mellinoe/veldrid-spirv/releases/download/$tag/libveldrid-spirv-arm64.so", + "$PSScriptRoot/download/$configuration/linux-arm64/libveldrid-spirv.so") +if( -not $? ) +{ + $msg = $Error[0].Exception.Message + Write-Error "Couldn't download libveldrid-spirv.so (arm64 Linux). This most likely indicates the Linux native build failed." + exit +} + +Write-Host "- libveldrid-spirv.so (arm64 Linux)" + +$client.DownloadFile( + "https://github.com/mellinoe/veldrid-spirv/releases/download/$tag/libveldrid-spirv-arm.so", + "$PSScriptRoot/download/$configuration/linux-arm/libveldrid-spirv.so") +if( -not $? ) +{ + $msg = $Error[0].Exception.Message + Write-Error "Couldn't download libveldrid-spirv.so (arm Linux). This most likely indicates the Linux native build failed." exit } -Write-Host "- libveldrid-spirv.so (64-bit Linux)" +Write-Host "- libveldrid-spirv.so (arm Linux)" $client.DownloadFile( "https://github.com/mellinoe/veldrid-spirv/releases/download/$tag/libveldrid-spirv.dylib", diff --git a/build-local-package.cmd b/build-local-package.cmd index 809488c..a259501 100644 --- a/build-local-package.cmd +++ b/build-local-package.cmd @@ -3,4 +3,5 @@ call .\build-native.cmd release win-x86 call .\build-native.cmd release win-x64 +call .\build-native.cmd release win-arm64 call dotnet pack -c Release src\Veldrid.SPIRV\Veldrid.SPIRV.csproj diff --git a/build-local-package.sh b/build-local-package.sh index 3075e1a..24cfbb8 100755 --- a/build-local-package.sh +++ b/build-local-package.sh @@ -27,6 +27,15 @@ while :; do linux-x64) _Platform=linux-x64 ;; + linux-x86) + _Platform=linux-x86 + ;; + linux-arm64) + _Platform=linux-arm64 + ;; + linux-arm) + _Platform=linux-arm + ;; *) __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1" esac diff --git a/build-native.cmd b/build-native.cmd index 3028145..1fff58b 100644 --- a/build-native.cmd +++ b/build-native.cmd @@ -15,6 +15,7 @@ if /i [%1] == [release] (set _CMAKE_BUILD_TYPE=Release&& shift & goto ArgLoop) if /i [%1] == [debug] (set _CMAKE_BUILD_TYPE=Debug&& shift & goto ArgLoop) if /i [%1] == [win-x64] (set _BUILD_ARCH=x64&& set _CMAKE_GENERATOR_PLATFORM=x64&& shift & goto ArgLoop) if /i [%1] == [win-x86] (set _BUILD_ARCH=x86&& set _CMAKE_GENERATOR_PLATFORM=Win32&& shift & goto ArgLoop) +if /i [%1] == [win-arm64] (set _BUILD_ARCH=arm64&& set _CMAKE_GENERATOR_PLATFORM=ARM64&& shift & goto ArgLoop) if /i [%1] == [android] (set _ANDROID_ABI=%2&& set _BUILD_ARCH=%2&& shift && shift & goto ArgLoop) if /i [%1] == [--android-ndk] (set _NDK_DIR=%2&& shift && shift & goto ArgLoop) if /i [%1] == [--android-platform] (set _ANDROID_PLATFORM=%2&& shift && shift & goto ArgLoop) diff --git a/build-native.sh b/build-native.sh index 1e90ad1..daf0335 100755 --- a/build-native.sh +++ b/build-native.sh @@ -31,6 +31,15 @@ while :; do linux-x64) _OSDir=linux-x64 ;; + linux-x86) + _OSDir=linux-x86 + ;; + linux-arm64) + _OSDir=linux-arm64 + ;; + linux-arm) + _OSDir=linux-arm + ;; ios) _CMakeEnableBitcode=-DENABLE_BITCODE=0 _CMakeBuildTarget=veldrid-spirv diff --git a/ext/update_shaderc_sources.py b/ext/update_shaderc_sources.py index cfe8adf..90a3009 100644 --- a/ext/update_shaderc_sources.py +++ b/ext/update_shaderc_sources.py @@ -17,8 +17,7 @@ from operator import attrgetter import argparse import json -import distutils.dir_util -import os.path +import os import subprocess import sys KNOWN_GOOD_FILE = 'known_good.json' @@ -75,7 +74,7 @@ def HasCommit(self): self.commit + '^{commit}'], cwd=self.subdir) def Clone(self): - distutils.dir_util.mkpath(self.subdir) + os.makedirs(self.subdir, exist_ok=True) command_output(['git', 'clone', self.GetUrl(), '.'], self.subdir) def Fetch(self): command_output(['git', 'fetch', 'known-good'], self.subdir) @@ -99,7 +98,7 @@ def main(): help="The file containing known-good commits. Default is \'' + KNOWN_GOOD_FILE + '\'.") args = parser.parse_args() commits = GetGoodCommits(args.known_good_file) - distutils.dir_util.mkpath(args.dir) + os.makedirs(args.dir, exist_ok=True) print('Change directory to {d}'.format(d=args.dir)) os.chdir(args.dir) # Create the subdirectories in sorted order so that parent git repositories diff --git a/src/Veldrid.SPIRV/Veldrid.SPIRV.csproj b/src/Veldrid.SPIRV/Veldrid.SPIRV.csproj index 98b019a..c8fe760 100644 --- a/src/Veldrid.SPIRV/Veldrid.SPIRV.csproj +++ b/src/Veldrid.SPIRV/Veldrid.SPIRV.csproj @@ -46,7 +46,11 @@ <_NativeAssetName Include="$(Configuration)/win-x86/libveldrid-spirv.dll" PackagePath="runtimes/win-x86/native" /> <_NativeAssetName Include="$(Configuration)/win-x64/libveldrid-spirv.dll" PackagePath="runtimes/win-x64/native" /> + <_NativeAssetName Include="$(Configuration)/win-arm64/libveldrid-spirv.dll" PackagePath="runtimes/win-arm64/native" /> <_NativeAssetName Include="$(Configuration)/linux-x64/libveldrid-spirv.so" PackagePath="runtimes/linux-x64/native" /> + <_NativeAssetName Include="$(Configuration)/linux-x86/libveldrid-spirv.so" PackagePath="runtimes/linux-x86/native" /> + <_NativeAssetName Include="$(Configuration)/linux-arm64/libveldrid-spirv.so" PackagePath="runtimes/linux-arm64/native" /> + <_NativeAssetName Include="$(Configuration)/linux-arm/libveldrid-spirv.so" PackagePath="runtimes/linux-arm/native" /> <_NativeAssetName Include="$(Configuration)/osx/libveldrid-spirv.dylib" PackagePath="runtimes/osx/native" /> <_NativeAssetName Include="$(Configuration)/ios/**/*" PackagePath="runtimes/ios/native" /> <_NativeAssetName Include="$(Configuration)/android-arm64-v8a/libveldrid-spirv.so" PackagePath="build/MonoAndroid10/native/arm64-v8a" />