mirror of https://github.com/xmake-io/xmake.git
Merge 7d4139194a
into 796a3b9d50
This commit is contained in:
commit
0cff8d097f
|
@ -179,24 +179,6 @@ function _load_vcvarsall(vcvarsall, vsver, arch, opt)
|
|||
end
|
||||
end
|
||||
|
||||
-- fix WindowsSDKVersion
|
||||
local WindowsSDKVersion = variables["WindowsSDKVersion"]
|
||||
if WindowsSDKVersion then
|
||||
WindowsSDKVersion = WindowsSDKVersion:gsub("\\", ""):trim()
|
||||
if WindowsSDKVersion ~= "" then
|
||||
variables["WindowsSDKVersion"] = WindowsSDKVersion
|
||||
end
|
||||
else
|
||||
-- sometimes the variable `WindowsSDKVersion` is not available
|
||||
-- then parse it from `WindowsSdkBinPath`, such as: `C:\\Program Files (x86)\\Windows Kits\\8.1\\bin`
|
||||
local WindowsSdkBinPath = variables["WindowsSdkBinPath"]
|
||||
if WindowsSdkBinPath then
|
||||
WindowsSDKVersion = string.match(WindowsSdkBinPath, "\\(%d+%.%d+)\\bin$")
|
||||
if WindowsSDKVersion then
|
||||
variables["WindowsSDKVersion"] = WindowsSDKVersion
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- fix UCRTVersion
|
||||
--
|
||||
|
@ -218,6 +200,28 @@ function _load_vcvarsall(vcvarsall, vsver, arch, opt)
|
|||
variables["UCRTVersion"] = UCRTVersion
|
||||
end
|
||||
|
||||
-- fix WindowsSDKVersion
|
||||
local WindowsSDKVersion = variables["WindowsSDKVersion"]
|
||||
if WindowsSDKVersion then
|
||||
WindowsSDKVersion = WindowsSDKVersion:gsub("\\", ""):trim()
|
||||
if WindowsSDKVersion ~= "" then
|
||||
variables["WindowsSDKVersion"] = WindowsSDKVersion
|
||||
end
|
||||
end
|
||||
|
||||
WindowsSDKVersion = variables["WindowsSDKVersion"]
|
||||
if not WindowsSDKVersion or WindowsSDKVersion == "" then
|
||||
-- sometimes the variable `WindowsSDKVersion` is not available
|
||||
-- then parse it from `WindowsSdkDir`, such as: `C:\\Program Files (x86)\\Windows Kits\\8.1\\`
|
||||
local WindowsSdkDir = variables["WindowsSdkDir"]
|
||||
if WindowsSdkDir then
|
||||
WindowsSDKVersion = string.match(WindowsSdkDir, "\\(%d+%.%d+)\\$")
|
||||
if WindowsSDKVersion then
|
||||
variables["WindowsSDKVersion"] = WindowsSDKVersion
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- convert path/lib/include to PATH/LIB/INCLUDE
|
||||
variables.PATH = variables.path
|
||||
variables.LIB = variables.lib
|
||||
|
|
|
@ -58,7 +58,7 @@ function main(opt)
|
|||
-- e.g. C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64
|
||||
--
|
||||
local envs = opt.envs
|
||||
if envs and envs.WindowsSdkDir and envs.WindowsSDKVersion then
|
||||
if envs and envs.WindowsSdkDir and envs.WindowsSDKVersion and type(envs.WindowsSDKVersion) == "string" then
|
||||
local toolchain = opt.toolchain
|
||||
local arch = toolchain and toolchain:arch() or config.arch()
|
||||
local bindir = path.join(envs.WindowsSdkDir, "bin", envs.WindowsSDKVersion, arch)
|
||||
|
|
Loading…
Reference in New Issue