aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/utils/vsenv.py
diff options
context:
space:
mode:
authorGustavoLCR <gugulcr@gmail.com>2022-09-14 01:34:46 -0300
committerJussi Pakkanen <jpakkane@gmail.com>2022-10-25 14:59:06 +0300
commit32bc64e63210cee6df7364a39005d89cdfdc6b71 (patch)
tree281c411c322547f9ca45fe14a62795e03eef3da1 /mesonbuild/utils/vsenv.py
parent3c0ac626d7bbf667762b72a8b075617763e17795 (diff)
downloadmeson-32bc64e63210cee6df7364a39005d89cdfdc6b71.zip
meson-32bc64e63210cee6df7364a39005d89cdfdc6b71.tar.gz
meson-32bc64e63210cee6df7364a39005d89cdfdc6b71.tar.bz2
Fix native compilation on ARM64 Windows
Move `detect_native_windows_arch()` to `mesonlib/universal.py` and rename it to `windows_detect_native_arch()` Use `IsWow64Process2()` to detect native architecture if available Use native `vcvarsarm64.bat` to initialize vsenv if available
Diffstat (limited to 'mesonbuild/utils/vsenv.py')
-rw-r--r--mesonbuild/utils/vsenv.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/mesonbuild/utils/vsenv.py b/mesonbuild/utils/vsenv.py
index 5f32990..47055a0 100644
--- a/mesonbuild/utils/vsenv.py
+++ b/mesonbuild/utils/vsenv.py
@@ -2,12 +2,11 @@ import os
import subprocess
import json
import pathlib
-import platform
import shutil
import tempfile
from .. import mlog
-from .universal import MesonException, is_windows
+from .universal import MesonException, is_windows, windows_detect_native_arch
__all__ = [
@@ -72,8 +71,10 @@ def _setup_vsenv(force: bool) -> bool:
# VS installer instelled but not VS itself maybe?
raise MesonException('Could not parse vswhere.exe output')
bat_root = pathlib.Path(bat_info[0]['installationPath'])
- if platform.machine() == 'ARM64':
- bat_path = bat_root / 'VC/Auxiliary/Build/vcvarsx86_arm64.bat'
+ if windows_detect_native_arch() == 'arm64':
+ bat_path = bat_root / 'VC/Auxiliary/Build/vcvarsarm64.bat'
+ if not bat_path.exists():
+ bat_path = bat_root / 'VC/Auxiliary/Build/vcvarsx86_arm64.bat'
else:
bat_path = bat_root / 'VC/Auxiliary/Build/vcvars64.bat'
# if VS is not found try VS Express