Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions src/build_tools/build_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def make_configure_options(args: argparse.Namespace) -> list[str]:
'-platform',
'win32-msvc',
]
if args.target_arch in ['x64', 'amd64']:
if args.target_arch == 'x64':
qt_configure_options += ['-intelcet']

if args.confirm_license:
Expand Down Expand Up @@ -490,7 +490,10 @@ def parse_args() -> argparse.Namespace:
)
if is_windows():
parser.add_argument(
'--target_arch', help='"x64" or "arm64"', type=str, default='x64'
'--target_arch',
help='target architecture',
choices=['x64', 'arm64'],
default=normalize_win_arch(platform.uname().machine),
)
parser.add_argument(
'--vcvarsall_path', help='Path of vcvarsall.bat', type=str, default=None
Expand Down Expand Up @@ -729,14 +732,21 @@ def normalize_win_arch(arch: str) -> str:
"""Normalize the architecture name for Windows build environment.

Args:
arch: a string representation of a CPU architecture to be normalized.
arch: 'amd64', 'x64', 'arm64', or its capitalization variants.

Returns:
String representation of a CPU architecture (e.g. 'x64' and 'arm64')
Either 'x64' or 'arm64'.

Raises:
ValueError: When the given architecture does not match any of them.
"""
normalized = arch.lower()
if normalized == 'amd64':
return 'x64'
normalized = {
'amd64': 'x64',
'x64': 'x64',
'arm64': 'arm64',
}.get(arch.lower())
if not normalized:
raise ValueError(f'Unsupported architecture: {arch}')
return normalized


Expand Down