diff options
| author | ruki <[email protected]> | 2022-01-02 22:19:48 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-01-02 22:19:48 +0800 |
| commit | 833a6f50a0ce17cc88049c81691eb9e32483fe6b (patch) | |
| tree | 8a201f311fe7e9ce16676e32abd3136d5d68eb8c | |
| parent | 2027d01c63ca2c341847664c8abf3ff2cb74085e (diff) | |
improve to find vs from wdk directory
| -rw-r--r-- | xmake/modules/detect/sdks/find_vstudio.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/xmake/modules/detect/sdks/find_vstudio.lua b/xmake/modules/detect/sdks/find_vstudio.lua index 0d3d98f2c..12feceaad 100644 --- a/xmake/modules/detect/sdks/find_vstudio.lua +++ b/xmake/modules/detect/sdks/find_vstudio.lua @@ -19,6 +19,7 @@ -- -- imports +import("core.project.config") import("lib.detect.find_file") import("lib.detect.find_tool") @@ -304,7 +305,18 @@ function main(opt) if not vcvarsall then -- find vs from some logical drives paths paths = {} - for _, logical_drive in ipairs(winos.logical_drives()) do + local logical_drives = winos.logical_drives() + -- we attempt to find vs from wdk directory + -- wdk: E:\Program Files\Windows Kits\10 + -- vcvarsall: E:\Program Files\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build + local wdk = config.get("wdk") + if wdk and os.isdir(wdk) then + local p = wdk:find("Program Files") + if p then + table.insert(logical_drives, wdk:sub(1, p - 1)) + end + end + for _, logical_drive in ipairs(logical_drives) do if os.isdir(path.join(logical_drive, "Program Files (x86)")) then table.insert(paths, path.join(logical_drive, "Program Files (x86)", "Microsoft Visual Studio", vsvers[version], "*", "VC", "Auxiliary", "Build")) table.insert(paths, path.join(logical_drive, "Program Files (x86)", "Microsoft Visual Studio " .. version, "VC")) |
