96 lines
4.1 KiB
C#
96 lines
4.1 KiB
C#
using System.IO;
|
|
using System.Runtime.CompilerServices;
|
|
using Sharpmake;
|
|
|
|
namespace TeaBox.Sharpmake
|
|
{
|
|
public static class Utilities
|
|
{
|
|
public const string RootPath = @"[project.SharpmakeCsProjectPath]\..\";
|
|
|
|
public const string OutputPath = RootPath + @"Binaries\";
|
|
public const string ExternPath = RootPath + @"Extern\";
|
|
|
|
public const string P4api = ExternPath + @"P4.Net\bin\Release\Ubisoft.P4API.dll";
|
|
|
|
public const string SandGrid = RootPath + @"Extern\SandGrid\Divelements.SandGrid.dll";
|
|
public const string SandBar = RootPath + @"Extern\SandBar\SandBar.dll";
|
|
|
|
/// <summary>
|
|
/// We need those DLL in the code since we want TeaBox to work without an install of VisualStudio.
|
|
/// </summary>
|
|
public const string EnvDTE = RootPath + @"Extern\VisualStudio\EnvDTE.dll";
|
|
public const string EnvDTE80 = RootPath + @"Extern\VisualStudio\EnvDTE80.dll";
|
|
|
|
public const string AvalonRoot = RootPath + @"Extern\Avalon\";
|
|
public const string AvalonBase = AvalonRoot + @"Xceed.Wpf.AvalonDock.dll";
|
|
public const string AvalonThemeVS2013 = AvalonRoot + @"Xceed.Wpf.AvalonDock.Themes.VS2013.dll";
|
|
|
|
public const string DotNetCompilerPlatformPath = RootPath + @"Extern\DotNetCompilerPlatform\";
|
|
public const string DotNetCompilerPlatformLib = DotNetCompilerPlatformPath + "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll";
|
|
|
|
public static void RegisterWindowsFormsIntegration(this Project.Configuration configuration)
|
|
{
|
|
configuration.ReferencesByName.Add("WindowsFormsIntegration");
|
|
}
|
|
|
|
public static void RegisterWpf(this Project.Configuration configuration)
|
|
{
|
|
configuration.ReferencesByName.Add("System.Xaml");
|
|
configuration.ReferencesByName.Add("WindowsBase");
|
|
configuration.ReferencesByName.Add("PresentationCore");
|
|
configuration.ReferencesByName.Add("PresentationFramework");
|
|
}
|
|
|
|
public static void RegisterPerforce(this Project.Configuration configuration)
|
|
{
|
|
configuration.ReferencesByPath.Add(P4api);
|
|
}
|
|
|
|
public static void RegisterRoslynCompiler(this Project.Configuration configuration)
|
|
{
|
|
configuration.ReferencesByPath.Add(DotNetCompilerPlatformPath + "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll");
|
|
|
|
const string roslynFolder = DotNetCompilerPlatformPath + "roslyn/";
|
|
configuration.ReferencesByPath.Add(roslynFolder + "csc.exe");
|
|
configuration.ReferencesByPath.Add(roslynFolder + "VBCSCompiler.exe");
|
|
configuration.ReferencesByPath.Add(roslynFolder + "Microsoft.CodeAnalysis.dll");
|
|
configuration.ReferencesByPath.Add(roslynFolder + "Microsoft.CodeAnalysis.CSharp.dll");
|
|
configuration.ReferencesByPath.Add(roslynFolder + "System.Collections.Immutable.dll");
|
|
configuration.ReferencesByPath.Add(roslynFolder + "System.Reflection.Metadata.dll");
|
|
}
|
|
|
|
public static ITarget[] GetDefaultTargets()
|
|
{
|
|
return new ITarget[] { new Target(
|
|
Platform.anycpu | Platform.win32,
|
|
DevEnv.vs2012 | DevEnv.vs2015 | DevEnv.vs2017,
|
|
Optimization.Debug | Optimization.Release,
|
|
OutputType.Dll,
|
|
framework: DotNetFramework.v4_5)
|
|
};
|
|
}
|
|
|
|
public static string GetDevEnvString(this DevEnv env)
|
|
{
|
|
switch (env)
|
|
{
|
|
case DevEnv.vs2010:
|
|
return "2010";
|
|
case DevEnv.vs2012:
|
|
return "2012";
|
|
case DevEnv.vs2015:
|
|
return "2015";
|
|
case DevEnv.vs2017:
|
|
return "2017";
|
|
default: return "";
|
|
}
|
|
}
|
|
|
|
public static void AddCopyFolderPostBuildStep(Project.Configuration conf, string sourcePath, string targetPath)
|
|
{
|
|
string copyCommand = string.Format(@"xcopy /f /Y /C /S /I ""{0}"" ""{1}"" >nul 2>nul", sourcePath, targetPath);
|
|
conf.EventPostBuild.Add(copyCommand);
|
|
}
|
|
}
|
|
}
|