Skip to content

Commit 5412f61

Browse files
fanc999-1dcbaker
authored andcommitted
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 6746979 commit 5412f61

File tree

1 file changed

+27
-4
lines changed
  • mesonbuild/dependencies

1 file changed

+27
-4
lines changed

mesonbuild/dependencies/ui.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from ..mesonlib import (
1616
Popen_safe, version_compare_many
1717
)
18-
from ..envconfig import detect_cpu_family
1918

2019
from .base import DependencyException, DependencyMethods, DependencyTypeName, SystemDependency
2120
from .configtool import ConfigToolDependency
@@ -190,10 +189,34 @@ def __init__(self, name: str, environment: 'Environment', kwargs: DependencyObje
190189
inc_dir = 'include'
191190
if self.env.machines[self.for_machine].is_windows():
192191
lib_name = 'vulkan-1'
193-
lib_dir = 'Lib32'
192+
lib_dir = ''
194193
inc_dir = 'Include'
195-
if detect_cpu_family(self.env.coredata.compilers.host) == 'x86_64':
196-
lib_dir = 'Lib'
194+
build_cpu = self.env.machines.build.cpu_family
195+
host_cpu = self.env.machines.host.cpu_family
196+
if build_cpu == 'x86_64':
197+
if host_cpu == build_cpu:
198+
lib_dir = 'Lib'
199+
elif host_cpu == 'aarch64':
200+
lib_dir = 'Lib-ARM64'
201+
elif host_cpu == 'x86':
202+
lib_dir = 'Lib32'
203+
elif build_cpu == 'aarch64':
204+
if host_cpu == build_cpu:
205+
lib_dir = 'Lib'
206+
elif host_cpu == 'x86_64':
207+
lib_dir = 'Lib-x64'
208+
elif host_cpu == 'x86':
209+
lib_dir = 'Lib32'
210+
elif build_cpu == 'x86':
211+
if host_cpu == build_cpu:
212+
lib_dir = 'Lib32'
213+
if host_cpu == 'aarch64':
214+
lib_dir = 'Lib-ARM64'
215+
elif host_cpu == 'x86_64':
216+
lib_dir = 'Lib'
217+
218+
if lib_dir == '':
219+
raise DependencyException(f'Target architecture \'{host_cpu}\' is not supported for this Vulkan SDK.')
197220

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

0 commit comments

Comments
 (0)