summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-08-28 23:13:50 +0800
committerGitHub <[email protected]>2022-08-28 23:13:50 +0800
commit3489f5967b7253c9efa1b367b3bc216599362c45 (patch)
tree569a3c362172df15a0ad49be28e1dd171fbe963e
parent6ad772f4c13cffbfa615d6d6f0e8a8d88ac7f91c (diff)
parentd08a04653479ef0f4f503412552aabe4b50c7b09 (diff)
Merge pull request #2728 from xmake-io/msvc
Support arm64 for msvc
-rw-r--r--xmake/modules/detect/sdks/find_vstudio.lua16
-rw-r--r--xmake/platforms/windows/xmake.lua2
2 files changed, 15 insertions, 3 deletions
diff --git a/xmake/modules/detect/sdks/find_vstudio.lua b/xmake/modules/detect/sdks/find_vstudio.lua
index f871c2262..37568a24d 100644
--- a/xmake/modules/detect/sdks/find_vstudio.lua
+++ b/xmake/modules/detect/sdks/find_vstudio.lua
@@ -116,7 +116,7 @@ function _load_vcvarsall(vcvarsall, vsver, arch, opt)
file:print("set VSCMD_SKIP_SENDTELEMETRY=yes")
end
if opt.vcvars_ver then
- file:print("call \"%s\" %s %s -vcvars_ver=%s > nul", vcvarsall, arch, opt.sdkver and opt.sdkver or "", opt.vcvars_ver)
+ file:print("call \"%s\" %s %s -vcvars_ver=%s > nul", vcvarsall, arch, opt.sdkver and opt.sdkver or "", opt.vcvars_ver)
else
file:print("call \"%s\" %s %s > nul", vcvarsall, arch, opt.sdkver and opt.sdkver or "")
end
@@ -321,8 +321,20 @@ function _find_vstudio(opt)
local vcvarsall_x86 = _load_vcvarsall(vcvarsall, version, "x86", opt)
local vcvarsall_x64 = _load_vcvarsall(vcvarsall, version, "x64", opt)
+ -- load vcvarsall for arm64
+ local arch
+ local arch_os = os.arch()
+ if arch_os == "x64" then
+ arch = "x64_arm64"
+ elseif arch_os == "x86" then
+ arch = "x86_arm64"
+ elseif arch_os == "arm64" then
+ arch = "arm64"
+ end
+ local vcvarsall_arm64 = arch and _load_vcvarsall(vcvarsall, version, arch, opt) or nil
+
-- save results
- results[vsvers[version]] = {version = version, vcvarsall_bat = vcvarsall, vcvarsall = {x86 = vcvarsall_x86, x64 = vcvarsall_x64}}
+ results[vsvers[version]] = {version = version, vcvarsall_bat = vcvarsall, vcvarsall = {x86 = vcvarsall_x86, x64 = vcvarsall_x64, arm64 = vcvarsall_arm64}}
end
end
return results
diff --git a/xmake/platforms/windows/xmake.lua b/xmake/platforms/windows/xmake.lua
index 6f25ef914..6dc3d7682 100644
--- a/xmake/platforms/windows/xmake.lua
+++ b/xmake/platforms/windows/xmake.lua
@@ -28,7 +28,7 @@ platform("windows")
set_hosts("windows")
-- set archs
- set_archs("x86", "x64")
+ set_archs("x86", "x64", "arm64")
-- set formats
set_formats("static", "$(name).lib")