Skip to content

Commit 4bac250

Browse files
committed
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.
1 parent 498e5a6 commit 4bac250

File tree

1 file changed

+23
-2
lines changed
  • mesonbuild/dependencies

1 file changed

+23
-2
lines changed

mesonbuild/dependencies/ui.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,29 @@ def __init__(self, name: str, environment: 'Environment', kwargs: DependencyObje
192192
lib_name = 'vulkan-1'
193193
lib_dir = 'Lib32'
194194
inc_dir = 'Include'
195-
if detect_cpu_family(self.env.coredata.compilers.host) == 'x86_64':
196-
lib_dir = 'Lib'
195+
build_cpu = detect_cpu_family(self.env.coredata.compilers.host)
196+
host_cpu = self.env.machines.host.cpu_family
197+
if build_cpu == 'x86_64':
198+
if host_cpu == 'aarch64':
199+
lib_dir = 'Lib-ARM64'
200+
elif host_cpu == 'x86':
201+
lib_dir = 'Lib32'
202+
else:
203+
lib_dir = 'Lib'
204+
elif build_cpu == 'aarch64':
205+
if host_cpu == 'x86_64':
206+
lib_dir = 'Lib-X64'
207+
elif host_cpu == 'x86':
208+
lib_dir = 'Lib32'
209+
else:
210+
lib_dir = 'Lib'
211+
elif build_cpu == 'x86':
212+
if host_cpu == 'aarch64':
213+
lib_dir = 'Lib-ARM64'
214+
elif host_cpu == 'x86_64':
215+
lib_dir = 'Lib'
216+
else:
217+
lib_dir = 'Lib32'
197218

198219
# make sure header and lib are valid
199220
inc_path = os.path.join(self.vulkan_sdk, inc_dir)

0 commit comments

Comments
 (0)