diff --git a/pylib/gyp/MSVSVersion.py b/pylib/gyp/MSVSVersion.py index 2d8e4ce..12fa57d 100644 --- a/pylib/gyp/MSVSVersion.py +++ b/pylib/gyp/MSVSVersion.py @@ -87,7 +87,7 @@ def DefaultToolset(self): def _SetupScriptInternal(self, target_arch): """Returns a command (with arguments) to be used to set up the environment.""" - assert target_arch in ("x86", "x64"), "target_arch not supported" + assert target_arch in ("x86", "x64", "arm64"), "target_arch not supported" # If WindowsSDKDir is set and SetEnv.Cmd exists then we are using the # depot_tools build tools and should run SetEnv.Cmd to set up the # environment. The check for WindowsSDKDir alone is not sufficient because @@ -109,8 +109,10 @@ def _SetupScriptInternal(self, target_arch): ) # Always use a native executable, cross-compiling if necessary. - host_arch = "amd64" if is_host_arch_x64 else "x86" - msvc_target_arch = "amd64" if target_arch == "x64" else "x86" + host_arch = "amd64" if is_host_arch_x64 else ( + "arm64" if os.environ.get("PROCESSOR_ARCHITECTURE") == "ARM64" else "x86" + ) + msvc_target_arch = {"x64": "amd64"}.get(target_arch, target_arch) arg = host_arch if host_arch != msvc_target_arch: arg += "_" + msvc_target_arch diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py index 4eac6cd..3ceaf47 100644 --- a/pylib/gyp/generator/ninja.py +++ b/pylib/gyp/generator/ninja.py @@ -246,7 +246,7 @@ def __init__( if flavor == "win": # See docstring of msvs_emulation.GenerateEnvironmentFiles(). self.win_env = {} - for arch in ("x86", "x64"): + for arch in ("x86", "x64", "arm64"): self.win_env[arch] = "environment." + arch # Relative path from build output dir to base dir. @@ -2339,6 +2339,7 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, config_name master_ninja.variable("rc", "rc.exe") master_ninja.variable("ml_x86", "ml.exe") master_ninja.variable("ml_x64", "ml64.exe") + master_ninja.variable("ml_arm64", "armasm64.exe") master_ninja.variable("mt", "mt.exe") else: master_ninja.variable("ld", CommandWithWrapper("LINK", wrappers, ld)) diff --git a/pylib/gyp/msvs_emulation.py b/pylib/gyp/msvs_emulation.py index 7c461a8..f1c1581 100644 --- a/pylib/gyp/msvs_emulation.py +++ b/pylib/gyp/msvs_emulation.py @@ -1174,7 +1174,7 @@ def GenerateEnvironmentFiles( meet your requirement (e.g. for custom toolchains), you can pass "-G ninja_use_custom_environment_files" to the gyp to suppress file generation and use custom environment files prepared by yourself.""" - archs = ("x86", "x64") + archs = ("x86", "x64", "arm64") if generator_flags.get("ninja_use_custom_environment_files", 0): cl_paths = {} for arch in archs: