|
|
|
@ -132,8 +132,8 @@ namespace CppSharp
@@ -132,8 +132,8 @@ namespace CppSharp
|
|
|
|
|
return vsSdk; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Gets the system include folders for the given Visual Studio version.
|
|
|
|
|
public static List<string> GetSystemIncludes(VisualStudioVersion vsVersion) |
|
|
|
|
public static ToolchainVersion GetWindowsKitsToolchain(VisualStudioVersion vsVersion, |
|
|
|
|
out int windowsSdkMajorVer) |
|
|
|
|
{ |
|
|
|
|
var vsSdk = GetVSToolchain(vsVersion); |
|
|
|
|
|
|
|
|
@ -141,39 +141,21 @@ namespace CppSharp
@@ -141,39 +141,21 @@ namespace CppSharp
|
|
|
|
|
vsDir = vsDir.Substring(0, vsDir.LastIndexOf(@"\Common7\IDE", |
|
|
|
|
StringComparison.Ordinal)); |
|
|
|
|
|
|
|
|
|
var includes = new List<string>(); |
|
|
|
|
includes.Add(Path.Combine(vsDir, @"VC\include")); |
|
|
|
|
|
|
|
|
|
// Check VCVarsQueryRegistry.bat to see which Windows SDK version
|
|
|
|
|
// is supposed to be used with this VS version.
|
|
|
|
|
var vcVarsPath = Path.Combine(vsDir, @"Common7\Tools\VCVarsQueryRegistry.bat"); |
|
|
|
|
|
|
|
|
|
int windowsSdkMajorVer = 0; |
|
|
|
|
windowsSdkMajorVer = 0; |
|
|
|
|
string kitsRootKey = string.Empty; |
|
|
|
|
if (File.Exists(vcVarsPath)) |
|
|
|
|
{ |
|
|
|
|
var vcVarsFile = File.ReadAllText(vcVarsPath); |
|
|
|
|
var match = Regex.Match(vcVarsFile, @"Windows\\v([1-9][0-9]*)\.?([0-9]*)"); |
|
|
|
|
if (match.Success) |
|
|
|
|
windowsSdkMajorVer = int.Parse(match.Groups[1].Value); |
|
|
|
|
|
|
|
|
|
match = Regex.Match(vcVarsFile, @"KitsRoot([1-9][0-9]*)"); |
|
|
|
|
if (match.Success) |
|
|
|
|
kitsRootKey = match.Groups[0].Value; |
|
|
|
|
} |
|
|
|
|
var vcVarsFile = File.ReadAllText(vcVarsPath); |
|
|
|
|
var match = Regex.Match(vcVarsFile, @"Windows\\v([1-9][0-9]*)\.?([0-9]*)"); |
|
|
|
|
if (match.Success) |
|
|
|
|
windowsSdkMajorVer = int.Parse(match.Groups[1].Value); |
|
|
|
|
|
|
|
|
|
List<ToolchainVersion> windowsSdks; |
|
|
|
|
GetWindowsSdks(out windowsSdks); |
|
|
|
|
|
|
|
|
|
// Older Visual Studio versions provide their own Windows SDK.
|
|
|
|
|
if (windowsSdks.Count == 0) |
|
|
|
|
{ |
|
|
|
|
includes.Add(Path.Combine(vsDir, @"\VC\PlatformSDK\Include")); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
includes.AddRange(GetIncludeDirsFromWindowsSdks(windowsSdkMajorVer, windowsSdks)); |
|
|
|
|
} |
|
|
|
|
match = Regex.Match(vcVarsFile, @"KitsRoot([1-9][0-9]*)"); |
|
|
|
|
if (match.Success) |
|
|
|
|
kitsRootKey = match.Groups[0].Value; |
|
|
|
|
|
|
|
|
|
List<ToolchainVersion> windowsKitsSdks; |
|
|
|
|
GetWindowsKitsSdks(out windowsKitsSdks); |
|
|
|
@ -187,6 +169,37 @@ namespace CppSharp
@@ -187,6 +169,37 @@ namespace CppSharp
|
|
|
|
|
if (windowsKitSdk.Value == null) |
|
|
|
|
windowsKitSdk = windowsKitsSdks.Last(); |
|
|
|
|
|
|
|
|
|
return windowsKitSdk; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Gets the system include folders for the given Visual Studio version.
|
|
|
|
|
public static List<string> GetSystemIncludes(VisualStudioVersion vsVersion) |
|
|
|
|
{ |
|
|
|
|
var vsSdk = GetVSToolchain(vsVersion); |
|
|
|
|
|
|
|
|
|
int windowsSdkMajorVer; |
|
|
|
|
var windowsKitSdk = GetWindowsKitsToolchain(vsVersion, out windowsSdkMajorVer); |
|
|
|
|
|
|
|
|
|
var vsDir = vsSdk.Directory; |
|
|
|
|
vsDir = vsDir.Substring(0, vsDir.LastIndexOf(@"\Common7\IDE", |
|
|
|
|
StringComparison.Ordinal)); |
|
|
|
|
|
|
|
|
|
var includes = new List<string>(); |
|
|
|
|
includes.Add(Path.Combine(vsDir, @"VC\include")); |
|
|
|
|
|
|
|
|
|
List<ToolchainVersion> windowsSdks; |
|
|
|
|
GetWindowsSdks(out windowsSdks); |
|
|
|
|
|
|
|
|
|
// Older Visual Studio versions provide their own Windows SDK.
|
|
|
|
|
if (windowsSdks.Count == 0) |
|
|
|
|
{ |
|
|
|
|
includes.Add(Path.Combine(vsDir, @"\VC\PlatformSDK\Include")); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
includes.AddRange(GetIncludeDirsFromWindowsSdks(windowsSdkMajorVer, windowsSdks)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
includes.AddRange( |
|
|
|
|
CollectUniversalCRuntimeIncludeDirs(vsDir, windowsKitSdk, windowsSdkMajorVer)); |
|
|
|
|
|
|
|
|
|