Skip to content

Commit

Permalink
Native/Vulkan Loader: Build for win-arm64.
Browse files Browse the repository at this point in the history
Vulkan Loader has GAS-style assembly that is essential to it functioning
correctly, so to make things simple, we build on Linux using llvm-mingw.
  • Loading branch information
alexrp committed Apr 18, 2024
1 parent af4eab3 commit 74ec596
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/vulkan-loader.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ jobs:
for arch in amd64 arm64 armhf; do
sudo apt install -y libx11-xcb-dev:$arch libxkbcommon-dev:$arch libwayland-dev:$arch libxrandr-dev:$arch
done
wget https://github.com/mstorsjo/llvm-mingw/releases/download/20240417/llvm-mingw-20240417-msvcrt-ubuntu-20.04-x86_64.tar.xz
sudo mkdir /opt/llvm-mingw-msvcrt
sudo tar xf llvm-mingw-20240417-msvcrt-ubuntu-20.04-x86_64.tar.xz --strip-components 1 -C /opt/llvm-mingw-msvcrt
- os: windows-2022
name: Windows
nuke_invoke: ./build.cmd
Expand Down
12 changes: 12 additions & 0 deletions build/cmake/aarch64-w64-mingw32.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_ASM_COMPILER "aarch64-w64-mingw32-as")
set(CMAKE_C_COMPILER "aarch64-w64-mingw32-gcc")
set(CMAKE_CXX_COMPILER "aarch64-w64-mingw32-g++")
set(CMAKE_RC_COMPILER "aarch64-w64-mingw32-windres")
set(CMAKE_LINKER "aarch64-w64-mingw32-ld")
set(CMAKE_FIND_ROOT_PATH "/opt/llvm-mingw-msvcrt/aarch64-w64-mingw32")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
11 changes: 10 additions & 1 deletion build/nuke/Native/VulkanLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ partial class Build {
}
else if (OperatingSystem.IsLinux())
{
foreach (var (triple, rid) in new[]
{
("x86_64-linux-gnu", "linux-x64"),
Expand All @@ -76,6 +75,16 @@ partial class Build {
CopyAll((buildDir / "loader").GlobFiles("libvulkan.so"), runtimes / rid / "native");
}
// Build for win-arm64 with llvm-mingw.
{
EnsureCleanDirectory(buildDir);
InheritedShell($"{prepare} -DUSE_GAS=ON {GetCMakeToolchainFlag("aarch64-w64-mingw32")}", buildDir).AssertZeroExitCode();
InheritedShell(build, buildDir).AssertZeroExitCode();
CopyAll((buildDir / "loader").GlobFiles("libvulkan-1.dll"), runtimes / "win-arm64" / "native");
}
}
else if (OperatingSystem.IsMacOS())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<Content Include="runtimes\linux-x64\native\libvulkan.so" PackagePath="runtimes\linux-x64\native\libvulkan.so" />
<Content Include="runtimes\osx-arm64\native\libvulkan.dylib" PackagePath="runtimes\osx-arm64\native\libvulkan.dylib" />
<Content Include="runtimes\osx-x64\native\libvulkan.dylib" PackagePath="runtimes\osx-x64\native\libvulkan.dylib" />
<Content Include="runtimes\win-arm64\native\vulkan-1.dll" PackagePath="runtimes\win-arm64\native\vulkan-1.dll" />
<Content Include="runtimes\win-x64\native\vulkan-1.dll" PackagePath="runtimes\win-x64\native\vulkan-1.dll" />
<Content Include="runtimes\win-x86\native\vulkan-1.dll" PackagePath="runtimes\win-x86\native\vulkan-1.dll" />
</ItemGroup>
Expand Down

0 comments on commit 74ec596

Please sign in to comment.