From 57557665cfc6e1630f2687324f95126737f9f0c9 Mon Sep 17 00:00:00 2001 From: star9029 Date: Fri, 23 May 2025 21:54:33 +0800 Subject: Improve find_dia_sdk --- xmake/modules/detect/sdks/find_dia_sdk.lua | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/xmake/modules/detect/sdks/find_dia_sdk.lua b/xmake/modules/detect/sdks/find_dia_sdk.lua index 102a66814..1f45587a1 100644 --- a/xmake/modules/detect/sdks/find_dia_sdk.lua +++ b/xmake/modules/detect/sdks/find_dia_sdk.lua @@ -71,7 +71,7 @@ function _find_dia_sdk(sdkdir, opt) end -- get arch - local arch = opt.arch or config.get("arch") + local arch = opt.arch or config.get("arch") or "x64" if arch then local supported_arch = { x64 = "amd64", @@ -122,6 +122,25 @@ function main(sdkdir, opt) -- find dia sdk local dia_sdk = _find_dia_sdk(sdkdir, opt) + if not dia_sdk then + local vstudio = find_vstudio() + if vstudio then + for vsver, value in pairs(vstudio) do + if value.vcvarsall then + for arch, vcvarsall_value in pairs(value.vcvarsall) do + local VSInstallDir = vcvarsall_value.VSInstallDir + if VSInstallDir then + dia_sdk = _find_dia_sdk(VSInstallDir, opt) + if dia_sdk then + break + end + end + end + end + end + end + end + if dia_sdk then if opt.verbose or option.get("verbose") then cprint("checking for DIA SDK directory ... ${color.success}%s", dia_sdk.sdkdir) -- cgit v1.3.1 From e4d52557f6e5c244ace04a8b2c04549d67b22bf5 Mon Sep 17 00:00:00 2001 From: star9029 Date: Fri, 23 May 2025 23:44:52 +0800 Subject: Improve flow control --- xmake/modules/detect/sdks/find_dia_sdk.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xmake/modules/detect/sdks/find_dia_sdk.lua b/xmake/modules/detect/sdks/find_dia_sdk.lua index 1f45587a1..e4796dda6 100644 --- a/xmake/modules/detect/sdks/find_dia_sdk.lua +++ b/xmake/modules/detect/sdks/find_dia_sdk.lua @@ -71,7 +71,7 @@ function _find_dia_sdk(sdkdir, opt) end -- get arch - local arch = opt.arch or config.get("arch") or "x64" + local arch = opt.arch or config.get("arch") or os.arch() if arch then local supported_arch = { x64 = "amd64", @@ -132,7 +132,7 @@ function main(sdkdir, opt) if VSInstallDir then dia_sdk = _find_dia_sdk(VSInstallDir, opt) if dia_sdk then - break + goto find end end end @@ -141,6 +141,8 @@ function main(sdkdir, opt) end end +::find:: + if dia_sdk then if opt.verbose or option.get("verbose") then cprint("checking for DIA SDK directory ... ${color.success}%s", dia_sdk.sdkdir) -- cgit v1.3.1 From 9ea8487862ef561c118411045ded493d658f1cf8 Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 26 May 2025 17:10:40 +0800 Subject: Update find_dia_sdk.lua --- xmake/modules/detect/sdks/find_dia_sdk.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/xmake/modules/detect/sdks/find_dia_sdk.lua b/xmake/modules/detect/sdks/find_dia_sdk.lua index e4796dda6..3e4097410 100644 --- a/xmake/modules/detect/sdks/find_dia_sdk.lua +++ b/xmake/modules/detect/sdks/find_dia_sdk.lua @@ -110,7 +110,6 @@ end -- @endcode -- function main(sdkdir, opt) - -- init options opt = opt or {} -- attempt to load cache first @@ -132,7 +131,7 @@ function main(sdkdir, opt) if VSInstallDir then dia_sdk = _find_dia_sdk(VSInstallDir, opt) if dia_sdk then - goto find + goto found end end end @@ -141,7 +140,7 @@ function main(sdkdir, opt) end end -::find:: +::found:: if dia_sdk then if opt.verbose or option.get("verbose") then @@ -158,4 +157,4 @@ function main(sdkdir, opt) detectcache:set(key, cacheinfo) detectcache:save() return dia_sdk -end \ No newline at end of file +end -- cgit v1.3.1