Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add targets win-arm64, linux-x86, linux-arm64, linux-arm #7

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 53 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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
Expand Down
58 changes: 55 additions & 3 deletions build-full-package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions build-local-package.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 9 additions & 0 deletions build-local-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions build-native.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions build-native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;
Comment on lines +34 to +42
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that it? Just set _OSDir and it will build with the correct architecture? I'm not sure that's the case?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I forgot to add the build steps for cross compiling with Ubuntu Arm images on Docker. Thanks for the heads up.

ios)
_CMakeEnableBitcode=-DENABLE_BITCODE=0
_CMakeBuildTarget=veldrid-spirv
Expand Down
7 changes: 3 additions & 4 deletions ext/update_shaderc_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/Veldrid.SPIRV/Veldrid.SPIRV.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@
<ItemGroup>
<_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" />
Expand Down