summaryrefslogtreecommitdiff
path: root/xmake/toolchains/msvc/check.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-11-25 22:40:55 +0800
committerruki <[email protected]>2024-11-25 22:40:55 +0800
commita650e13a84797e6cba52052981691a6fde1cf980 (patch)
tree1617871b1d664aefa79f945510229bd0d8f3bc30 /xmake/toolchains/msvc/check.lua
parent8b3be6b7ffb9c006e013a121de3aaa9e5faa9986 (diff)
improve msvc toolchain for packages
Diffstat (limited to 'xmake/toolchains/msvc/check.lua')
-rw-r--r--xmake/toolchains/msvc/check.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/xmake/toolchains/msvc/check.lua b/xmake/toolchains/msvc/check.lua
index 3c70d43c0..c40d4a202 100644
--- a/xmake/toolchains/msvc/check.lua
+++ b/xmake/toolchains/msvc/check.lua
@@ -128,7 +128,6 @@ function _check_vc_build_tools(toolchain, sdkdir)
end
end
--- main entry
function main(toolchain)
-- only for windows or linux (msvc-wine)
@@ -145,6 +144,18 @@ function main(toolchain)
if sdkdir then
return _check_vc_build_tools(toolchain, sdkdir)
else
+ -- find it from packages
+ for _, package in ipairs(toolchain:packages()) do
+ local installdir = package:installdir()
+ if installdir and os.isdir(installdir) then
+ local result = _check_vc_build_tools(toolchain, installdir)
+ if result then
+ return result
+ end
+ end
+ end
+
+ -- find it from system
return _check_vstudio(toolchain)
end
end