mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-18 21:21:17 +00:00
Add support for building the code on Windows ARM64 natively (#15371)
### Description Recently Visual Studio and python started to provide native Windows ARM64 packages. This PR is to provide better support for building on Windows ARM64. You can do it as what you did for x64. Like: ``` python tools\ci_build\build.py --config Debug --update --skip_submodule_sync --build_dir b --cmake_generator "Visual Studio 17 2022" ``` You do not need to append the "--arm64" build arg, and do not need to cross-compile protoc for a different arch as you are not cross-compiling. **caveat:** it does not work with the latest cmake release(3.26.x). It only works fine with cmake 3.25.x and below. Filed a bug to them: https://gitlab.kitware.com/cmake/cmake/-/issues/24797 ### Motivation and Context Provide better support for building on Windows ARM64.
This commit is contained in:
parent
9c42d5e31f
commit
db4fc12318
1 changed files with 15 additions and 6 deletions
|
|
@ -2462,16 +2462,25 @@ def main():
|
|||
"ARM(64) builds. Will skip test running after build."
|
||||
)
|
||||
args.test = False
|
||||
elif cpu_arch == "32bit" or args.x86:
|
||||
cmake_extra_args = ["-A", "Win32", "-T", "host=x64", "-G", args.cmake_generator]
|
||||
else:
|
||||
if args.msvc_toolset:
|
||||
toolset = "host=x64,version=" + args.msvc_toolset
|
||||
target_arch = platform.machine()
|
||||
if target_arch == "AMD64":
|
||||
if cpu_arch == "32bit" or args.x86:
|
||||
target_arch = "Win32"
|
||||
else:
|
||||
target_arch = "x64"
|
||||
host_arch = "x64"
|
||||
elif target_arch == "ARM64":
|
||||
host_arch = "ARM64"
|
||||
else:
|
||||
toolset = "host=x64"
|
||||
raise BuildError("unknown python arch")
|
||||
if args.msvc_toolset:
|
||||
toolset = "host=" + host_arch + ",version=" + args.msvc_toolset
|
||||
else:
|
||||
toolset = "host=" + host_arch
|
||||
if args.cuda_version:
|
||||
toolset += ",cuda=" + args.cuda_version
|
||||
cmake_extra_args = ["-A", "x64", "-T", toolset, "-G", args.cmake_generator]
|
||||
cmake_extra_args = ["-A", target_arch, "-T", toolset, "-G", args.cmake_generator]
|
||||
if args.enable_wcos:
|
||||
cmake_extra_defines.append("CMAKE_USER_MAKE_RULES_OVERRIDE=wcos_rules_override.cmake")
|
||||
elif args.cmake_generator is not None and not (is_macOS() and args.use_xcode):
|
||||
|
|
|
|||
Loading…
Reference in a new issue