diff options
Diffstat (limited to 'xmake/modules/detect/sdks/find_wdk.lua')
| -rw-r--r-- | xmake/modules/detect/sdks/find_wdk.lua | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/xmake/modules/detect/sdks/find_wdk.lua b/xmake/modules/detect/sdks/find_wdk.lua index f91e9a1b7..d9844146a 100644 --- a/xmake/modules/detect/sdks/find_wdk.lua +++ b/xmake/modules/detect/sdks/find_wdk.lua @@ -24,6 +24,7 @@ import("lib.detect.find_file") import("core.base.option") import("core.base.global") import("core.project.config") +import("core.tool.toolchain") import("detect.sdks.find_vstudio") -- find WDK directory @@ -34,24 +35,15 @@ function _find_sdkdir(sdkdir) sdkdir = os.getenv("WindowsSdkDir") end - -- get sdk directory from vsvars + -- get sdk directory from vcvars if not sdkdir then - local arch = config.arch() or os.arch() - local vcvarsall = config.get("__vcvarsall") - if not vcvarsall then - local vstudio = find_vstudio() - if vstudio then - for _, vsinfo in pairs(vstudio) do - if vsinfo.vcvarsall then - vcvarsall = vsinfo.vcvarsall - break - end - end + local msvc = toolchain.load("msvc") + if msvc and msvc:check() then + local vcvars = msvc:config("vcvars") + if vcvars then + sdkdir = vcvars.WindowsSdkDir end end - if vcvarsall then - sdkdir = (vcvarsall[arch] or {}).WindowsSdkDir - end end return sdkdir end |
