summaryrefslogtreecommitdiff
path: root/xmake/toolchains
diff options
context:
space:
mode:
authorruki <[email protected]>2024-11-25 10:47:28 +0800
committerGitHub <[email protected]>2024-11-25 10:47:28 +0800
commit09920ae45de7e15b46a0677c474cde18016bc9e2 (patch)
treeed2d92d9502eae82f68842d3a94251e8b71c3f7d /xmake/toolchains
parent6227615261ce6c2109c0c8324a83b582b25bd337 (diff)
parentc4bc1b11a6644acda3c49f39aa7146d63695f9be (diff)
Merge pull request #5880 from xmake-io/msvc
Improve msvc toolchain for package
Diffstat (limited to 'xmake/toolchains')
-rw-r--r--xmake/toolchains/clang-cl/check.lua13
-rw-r--r--xmake/toolchains/msvc/check.lua13
2 files changed, 24 insertions, 2 deletions
diff --git a/xmake/toolchains/clang-cl/check.lua b/xmake/toolchains/clang-cl/check.lua
index b416a44ce..9f7022482 100644
--- a/xmake/toolchains/clang-cl/check.lua
+++ b/xmake/toolchains/clang-cl/check.lua
@@ -137,7 +137,6 @@ function _check_vc_build_tools(toolchain, sdkdir)
end
end
--- main entry
function main(toolchain)
-- only for windows or linux (msvc-wine)
@@ -154,6 +153,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
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