summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanc999@yahoo.com.tw>2025-11-18 15:14:57 +0800
committerDylan Baker <dylan@pnwbakers.com>2025-12-08 10:50:41 -0800
commit5412f614a5391f146c3fb8fa878b0a3903836ee6 (patch)
treeca66079643fc4827a1bff6f43cd079357d135100
parent67469792363663f90468eb2a07c8d84ae8dc5c04 (diff)
downloadmeson-5412f614a5391f146c3fb8fa878b0a3903836ee6.tar.gz
dependencies/ui.py: Improve Vulkan detection on Windows
There now exists a Windows Vulkan SDK for ARM64, and the latest Vulkan SDKs for x64 Windows also provides ARM64 libraries and binaries for cross-builds (and vice-versa). So, now we have the following in the Vulkan SDKs: * Bin-ARM64 and Lib-ARM64 in x64 Windows SDKs that contains ARM64 Vulkan binaries and libraries. * Bin-X64 and Lib-X64 in ARM64 Windows SDKs that contains x64 Vulkan binaries and libraries * SDKs after 1.4.x (or so) no longer ships 32-bit Windows binaries and libraries. This updates the Vulkan detection logic to account for these differences so that the correct library is picked up upon linking on Windows, especially when cross-compiling ARM64 binaries on x64 Windows, and vice versa, while maintaining compatibility with native and 32-bit builds.
-rw-r--r--mesonbuild/dependencies/ui.py31
1 files changed, 27 insertions, 4 deletions
diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py
index f000b58dd..566ba52dc 100644
--- a/mesonbuild/dependencies/ui.py
+++ b/mesonbuild/dependencies/ui.py
@@ -15,7 +15,6 @@ from .. import mesonlib
from ..mesonlib import (
Popen_safe, version_compare_many
)
-from ..envconfig import detect_cpu_family
from .base import DependencyException, DependencyMethods, DependencyTypeName, SystemDependency
from .configtool import ConfigToolDependency
@@ -190,10 +189,34 @@ class VulkanDependencySystem(SystemDependency):
inc_dir = 'include'
if self.env.machines[self.for_machine].is_windows():
lib_name = 'vulkan-1'
- lib_dir = 'Lib32'
+ lib_dir = ''
inc_dir = 'Include'
- if detect_cpu_family(self.env.coredata.compilers.host) == 'x86_64':
- lib_dir = 'Lib'
+ build_cpu = self.env.machines.build.cpu_family
+ host_cpu = self.env.machines.host.cpu_family
+ if build_cpu == 'x86_64':
+ if host_cpu == build_cpu:
+ lib_dir = 'Lib'
+ elif host_cpu == 'aarch64':
+ lib_dir = 'Lib-ARM64'
+ elif host_cpu == 'x86':
+ lib_dir = 'Lib32'
+ elif build_cpu == 'aarch64':
+ if host_cpu == build_cpu:
+ lib_dir = 'Lib'
+ elif host_cpu == 'x86_64':
+ lib_dir = 'Lib-x64'
+ elif host_cpu == 'x86':
+ lib_dir = 'Lib32'
+ elif build_cpu == 'x86':
+ if host_cpu == build_cpu:
+ lib_dir = 'Lib32'
+ if host_cpu == 'aarch64':
+ lib_dir = 'Lib-ARM64'
+ elif host_cpu == 'x86_64':
+ lib_dir = 'Lib'
+
+ if lib_dir == '':
+ raise DependencyException(f'Target architecture \'{host_cpu}\' is not supported for this Vulkan SDK.')
# make sure header and lib are valid
inc_path = os.path.join(self.vulkan_sdk, inc_dir)