summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-11-16 22:41:30 +0800
committerruki <[email protected]>2018-11-16 10:09:04 +0800
commit3e33ce093e87c1d5b925dc6a099448d5b5e5be6f (patch)
tree1ed65090cde4214aea23012543f023d1e15943b2
parent5c24bd699b284e139c8150bdbb1d08b5f1c7f053 (diff)
add vs_sdkver option
-rw-r--r--xmake/modules/detect/sdks/find_vstudio.lua12
-rw-r--r--xmake/platforms/windows/xmake.lua2
2 files changed, 8 insertions, 6 deletions
diff --git a/xmake/modules/detect/sdks/find_vstudio.lua b/xmake/modules/detect/sdks/find_vstudio.lua
index fadf99345..525eb9aad 100644
--- a/xmake/modules/detect/sdks/find_vstudio.lua
+++ b/xmake/modules/detect/sdks/find_vstudio.lua
@@ -42,7 +42,7 @@ local vcvars = {"path",
"UCRTVersion"}
-- load vcvarsall environment variables
-function _load_vcvarsall(vcvarsall, arch, vcvars_ver)
+function _load_vcvarsall(vcvarsall, arch, vcvars_ver, sdkver)
-- make the genvcvars.bat
local genvcvars_bat = os.tmpfile() .. "_genvcvars.bat"
@@ -50,9 +50,9 @@ function _load_vcvarsall(vcvarsall, arch, vcvars_ver)
local file = io.open(genvcvars_bat, "w")
file:print("@echo off")
if vcvars_ver then
- file:print("call \"%s\" %s -vcvars_ver=%s > nul", vcvarsall, arch, vcvars_ver)
+ file:print("call \"%s\" %s %s -vcvars_ver=%s > nul", vcvarsall, arch, sdkver and sdkver or "", vcvars_ver)
else
- file:print("call \"%s\" %s > nul", vcvarsall, arch)
+ file:print("call \"%s\" %s %s > nul", vcvarsall, arch, sdkver and sdkver or "")
end
for idx, var in ipairs(vcvars) do
file:print("echo " .. var .. " = %%" .. var .. "%% %s %s", idx == 1 and ">" or ">>", genvcvars_dat)
@@ -118,7 +118,7 @@ end
-- find vstudio environment
--
--- @param opt the options, .e.g {vcvars_ver = 14.0}
+-- @param opt the options, .e.g {vcvars_ver = 14.0, sdkver = "10.0.15063.0"}
--
-- @return { 2008 = {version = "9.0", vcvarsall = {x86 = {path = .., lib = .., include = ..}}}
-- , 2017 = {version = "15.0", vcvarsall = {x64 = {path = .., lib = ..}}}}
@@ -203,8 +203,8 @@ function main(opt)
if os.isfile(vcvarsall) then
-- load vcvarsall
- local vcvarsall_x86 = _load_vcvarsall(vcvarsall, "x86", opt.vcvars_ver)
- local vcvarsall_x64 = _load_vcvarsall(vcvarsall, "x64", opt.vcvars_ver)
+ local vcvarsall_x86 = _load_vcvarsall(vcvarsall, "x86", opt.vcvars_ver, opt.sdkver)
+ local vcvarsall_x64 = _load_vcvarsall(vcvarsall, "x64", opt.vcvars_ver, opt.sdkver)
-- save results
local results = {}
diff --git a/xmake/platforms/windows/xmake.lua b/xmake/platforms/windows/xmake.lua
index 29750cd7b..678c625ae 100644
--- a/xmake/platforms/windows/xmake.lua
+++ b/xmake/platforms/windows/xmake.lua
@@ -82,6 +82,8 @@ platform("windows")
, {nil, "vs", "kv", "auto", "The Microsoft Visual Studio" }
, {nil, "vs_toolset", "kv", nil, "The Microsoft Visual Studio Toolset Version"
, " .e.g --vs_toolset=14.0" }
+ , {nil, "vs_sdkver", "kv", nil, "The Windows SDK Version of Visual Studio"
+ , " .e.g --vs_sdkver=10.0.15063.0" }
, {category = "Cuda SDK Configuration" }
, {nil, "cuda", "kv", "auto", "The Cuda SDK Directory" }
, {category = "Qt SDK Configuration" }