diff options
| author | ruki <[email protected]> | 2025-05-26 17:11:04 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-26 17:11:04 +0800 |
| commit | 3a4130a3f5a4294471f8cefceaa9c07124a3b99c (patch) | |
| tree | 7929852fd9332b9b6e0271da03c3fd9235ca4b73 | |
| parent | 946df8f32d7e6efa663d439e4ad2c550eb79b7a5 (diff) | |
| parent | 9ea8487862ef561c118411045ded493d658f1cf8 (diff) | |
Merge pull request #6496 from star-hengxing/find_dia_sdk
Improve find_dia_sdk
| -rw-r--r-- | xmake/modules/detect/sdks/find_dia_sdk.lua | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/xmake/modules/detect/sdks/find_dia_sdk.lua b/xmake/modules/detect/sdks/find_dia_sdk.lua index 102a66814..3e4097410 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 |
