diff options
| author | ruki <[email protected]> | 2017-06-30 00:04:43 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-06-30 00:04:43 +0800 |
| commit | 106ee49f7882c87c6b959fa8afccd09e29e7e99b (patch) | |
| tree | 4123741bf287e9075e7cc42ed70558004488d2ff | |
| parent | 13c3dfc2bff9ddadcddfadf64ce793b30dce8c9a (diff) | |
get vstudio sdk version
| -rw-r--r-- | xmake/modules/detect/sdks/find_vstudio.lua | 6 | ||||
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vs201x.lua | 6 | ||||
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua | 13 |
3 files changed, 23 insertions, 2 deletions
diff --git a/xmake/modules/detect/sdks/find_vstudio.lua b/xmake/modules/detect/sdks/find_vstudio.lua index 1a06d1e90..fb09d915d 100644 --- a/xmake/modules/detect/sdks/find_vstudio.lua +++ b/xmake/modules/detect/sdks/find_vstudio.lua @@ -64,6 +64,12 @@ function _load_vcvarsall(vcvarsall, arch) end end + -- get sdk version + local include = variables["include"] + if include then + variables["sdkver"] = include:match("Windows Kits\\%d+\\include\\(%d+%.%d+%.%d+%.%d+)\\") + end + -- ok return variables end diff --git a/xmake/plugins/project/vstudio/impl/vs201x.lua b/xmake/plugins/project/vstudio/impl/vs201x.lua index e3aed1b88..917f82aca 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x.lua @@ -39,6 +39,12 @@ function _make_targetinfo(mode, arch, target) -- init target info local targetinfo = { mode = mode, arch = ifelse(arch == "x86", "Win32", "x64") } + -- get sdk version + local vcvarsall = config.get("__vcvarsall") + if vcvarsall then + targetinfo.sdkver = (vcvarsall[arch] or {}).sdkver + end + -- save symbols targetinfo.symbols = target:get("symbols") diff --git a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua index 31b53fd7d..d46732115 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua @@ -142,13 +142,22 @@ function _make_configurations(vcxprojfile, vsinfo, target, vcxprojdir) , vs2017 = "141" } - -- the sdk version + -- the default sdk version local sdk_versions = { vs2015 = "10.0.10240.0" , vs2017 = "10.0.14393.0" } + -- get sdk version + local sdkver = nil + for _, targetinfo in ipairs(target.info) do + sdkver = targetinfo.sdkver + if sdkver then + break + end + end + -- make ProjectConfigurations vcxprojfile:enter("<ItemGroup Label=\"ProjectConfigurations\">") for _, targetinfo in ipairs(target.info) do @@ -164,7 +173,7 @@ function _make_configurations(vcxprojfile, vsinfo, target, vcxprojdir) vcxprojfile:print("<ProjectGuid>{%s}</ProjectGuid>", os.uuid(targetname)) vcxprojfile:print("<RootNamespace>%s</RootNamespace>", targetname) if vsinfo.vstudio_version >= "2015" then - vcxprojfile:print("<WindowsTargetPlatformVersion>%s</WindowsTargetPlatformVersion>", sdk_versions["vs" .. vsinfo.vstudio_version]) + vcxprojfile:print("<WindowsTargetPlatformVersion>%s</WindowsTargetPlatformVersion>", sdkver or sdk_versions["vs" .. vsinfo.vstudio_version]) end vcxprojfile:leave("</PropertyGroup>") |
