Browse Source

Fixed the addition of Windows SDK include dirs when using VS 2017.

Fixes https://github.com/mono/CppSharp/issues/865.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/838/merge
Dimitar Dobrev 8 years ago
parent
commit
b4bedeb448
  1. 16
      src/Core/Toolchains/MSVCToolchain.cs

16
src/Core/Toolchains/MSVCToolchain.cs

@ -621,6 +621,7 @@ namespace CppSharp @@ -621,6 +621,7 @@ namespace CppSharp
int fetched;
var instances = new ISetupInstance[1];
var regexWinSDK10Version = new Regex(@"Windows10SDK\.(\d+)\.");
do
{
e.Next(1, instances, out fetched);
@ -653,7 +654,20 @@ namespace CppSharp @@ -653,7 +654,20 @@ namespace CppSharp
if (win10sdks.Count() > 0)
{
var sdk = win10sdks.Last();
var path = @"C:\Program Files (x86)\Windows Kits\10\include\" + "10.0." + sdk.GetId().Substring(46) + ".0"; //Microsoft.VisualStudio.Component.Windows10SDK. = 46 chars
var matchVersion = regexWinSDK10Version.Match(sdk.GetId());
string path;
if (matchVersion.Success)
{
Environment.SpecialFolder specialFolder = Environment.Is64BitOperatingSystem ?
Environment.SpecialFolder.ProgramFilesX86 : Environment.SpecialFolder.ProgramFiles;
var programFiles = Environment.GetFolderPath(specialFolder);
path = Path.Combine(programFiles, "Windows Kits", "10", "include",
$"10.0.{matchVersion.Groups[1].Value}.0");
}
else
{
path = "<invalid>";
}
var shared = Path.Combine(path, "shared");
var um = Path.Combine(path, "um");
var winrt = Path.Combine(path, "winrt");

Loading…
Cancel
Save