diff --git a/xmake/modules/detect/sdks/find_dia_sdk.lua b/xmake/modules/detect/sdks/find_dia_sdk.lua index 102a668143e..3e40974108e 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 os.arch() if arch then local supported_arch = { x64 = "amd64", @@ -110,7 +110,6 @@ end -- @endcode -- function main(sdkdir, opt) - -- init options opt = opt or {} -- attempt to load cache first @@ -122,6 +121,27 @@ 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 + goto found + end + end + end + end + end + end + end + +::found:: + if dia_sdk then if opt.verbose or option.get("verbose") then cprint("checking for DIA SDK directory ... ${color.success}%s", dia_sdk.sdkdir) @@ -137,4 +157,4 @@ function main(sdkdir, opt) detectcache:set(key, cacheinfo) detectcache:save() return dia_sdk -end \ No newline at end of file +end