Enabling MSBuild 14 in the default native-compile target

Currently Helios won't build on machines that don't have VS2013 installed (only VS2015)
This commit is contained in:
moozzyk 2015-04-27 17:26:24 -07:00
parent 8d506097a0
commit e54a3b61c0
1 changed files with 19 additions and 11 deletions

View File

@ -83,23 +83,31 @@ default Configuration='${E("Configuration")}'
#native-compile target='compile' if='!IsMono && Directory.Exists(Path.Combine(BASE_DIR, "src"))' #native-compile target='compile' if='!IsMono && Directory.Exists(Path.Combine(BASE_DIR, "src"))'
var programFilesX86 = '${Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)}' var programFilesX86 = '${Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)}'
var msbuild = '${Path.Combine(programFilesX86, "MSBuild", "12.0", "Bin", "MSBuild.exe")}'
var nativeProjects ='${Files.Include(Path.Combine(BASE_DIR, "src", "**", "*.vcxproj"))}' var nativeProjects ='${Files.Include(Path.Combine(BASE_DIR, "src", "**", "*.vcxproj"))}'
@{ @{
if (nativeProjects.Any()) if (nativeProjects.Any())
{ {
if (!File.Exists(msbuild)) var msbuildVersions = new[] { "14.0", "12.0"};
for (var i = 0; i < msbuildVersions.Length; i++)
{ {
Log.Warn("msbuild version 12 not found. Please ensure you have the VS 2013 C++ SDK installed."); var msbuildPath = Path.Combine(programFilesX86, "MSBuild", msbuildVersions[i], "Bin", "MSBuild.exe");
Environment.Exit(1); if (File.Exists(msbuildPath))
}
else
{ {
foreach (var project in nativeProjects) foreach (var project in nativeProjects)
{ {
Exec(msbuild, project + " /p:Configuration=" + Configuration + ";Platform=Win32"); Exec(msbuildPath, project + " /p:Configuration=" + Configuration + ";Platform=Win32");
Exec(msbuild, project + " /p:Configuration=" + Configuration + ";Platform=x64"); Exec(msbuildPath, project + " /p:Configuration=" + Configuration + ";Platform=x64");
}
break;
}
if (i == msbuildVersions.Length - 1)
{
Log.Warn("msbuild version 14 or 12 not found. Please ensure you have the VS 2015 or VS 2013 C++ SDK installed.");
Environment.Exit(1);
} }
} }
} }