diff options
| author | ruki <[email protected]> | 2024-01-19 23:43:12 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-01-19 23:43:12 +0800 |
| commit | b9b4a6e84f1cdd56bcc32c8eed900982fd9bc3b9 (patch) | |
| tree | 8f1f897d3663fe6bc672b5038c7000923835bfe6 | |
| parent | 2d4bbc3ae4171a4853f534a9a9d299a1fd05fcf1 (diff) | |
improve vs cache key
| -rw-r--r-- | xmake/modules/detect/sdks/find_vstudio.lua | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/xmake/modules/detect/sdks/find_vstudio.lua b/xmake/modules/detect/sdks/find_vstudio.lua index 104a2ca79..d928fafe7 100644 --- a/xmake/modules/detect/sdks/find_vstudio.lua +++ b/xmake/modules/detect/sdks/find_vstudio.lua @@ -435,17 +435,23 @@ end -- , 2017 = {version = "15.0", vcvarsall = {x64 = {path = .., lib = ..}}}} -- function main(opt) + opt = opt or {} -- only for windows if not is_host("windows") then return end + local key = "vstudio" + if opt.vcvars_ver then + key = key .. opt.vcvars_ver + end + -- attempt to get it from the global cache first - local vstudio = global_detectcache:get2("vstudio", "msvc") + local vstudio = global_detectcache:get2(key, "msvc") if vstudio then local mtime = _get_last_mtime(vstudio) - local mtimeprev = global_detectcache:get2("vstudio", "mtime") + local mtimeprev = global_detectcache:get2(key, "mtime") if mtime and mtimeprev and mtime > 0 and mtimeprev > 0 and mtime == mtimeprev then return vstudio end @@ -455,8 +461,8 @@ function main(opt) vstudio = _find_vstudio(opt) if vstudio then local mtime = _get_last_mtime(vstudio) - global_detectcache:set2("vstudio", "msvc", vstudio) - global_detectcache:set2("vstudio", "mtime", mtime) + global_detectcache:set2(key, "msvc", vstudio) + global_detectcache:set2(key, "mtime", mtime) global_detectcache:save() end return vstudio |
