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,26 +83,34 @@ default Configuration='${E("Configuration")}'
#native-compile target='compile' if='!IsMono && Directory.Exists(Path.Combine(BASE_DIR, "src"))'
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"))}'
@{
if (nativeProjects.Any())
if (nativeProjects.Any())
{
var msbuildVersions = new[] { "14.0", "12.0"};
for (var i = 0; i < msbuildVersions.Length; i++)
{
if (!File.Exists(msbuild))
var msbuildPath = Path.Combine(programFilesX86, "MSBuild", msbuildVersions[i], "Bin", "MSBuild.exe");
if (File.Exists(msbuildPath))
{
Log.Warn("msbuild version 12 not found. Please ensure you have the VS 2013 C++ SDK installed.");
Environment.Exit(1);
foreach (var project in nativeProjects)
{
Exec(msbuildPath, project + " /p:Configuration=" + Configuration + ";Platform=Win32");
Exec(msbuildPath, project + " /p:Configuration=" + Configuration + ";Platform=x64");
}
break;
}
else
if (i == msbuildVersions.Length - 1)
{
foreach (var project in nativeProjects)
{
Exec(msbuild, project + " /p:Configuration=" + Configuration + ";Platform=Win32");
Exec(msbuild, project + " /p:Configuration=" + Configuration + ";Platform=x64");
}
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);
}
}
}
}
copy sourceDir='${Path.GetDirectoryName(project)}' include='bin/**/' outputDir='${Path.Combine(BUILD_DIR, Path.GetFileNameWithoutExtension(project))}' overwrite='${true}' each='var project in nativeProjects'