2012-08-09 09:45:04 +00:00
|
|
|
#region Private Members
|
2011-11-15 06:46:22 +00:00
|
|
|
using System;
|
2011-11-15 12:11:24 +00:00
|
|
|
using System.Reflection;
|
2012-08-22 21:04:13 +00:00
|
|
|
using System.Diagnostics;
|
2011-11-15 06:46:22 +00:00
|
|
|
|
|
|
|
#endregion // Private Members
|
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
// This file is part of the ANX.Framework created by the
|
|
|
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
|
|
|
// For details see: http://anxframework.codeplex.com/license
|
2011-11-15 06:46:22 +00:00
|
|
|
|
|
|
|
namespace StockShaderCodeGenerator
|
|
|
|
{
|
|
|
|
class Program
|
|
|
|
{
|
2012-08-22 21:04:13 +00:00
|
|
|
internal static ConsoleTraceListener TraceListener = new ConsoleTraceListener();
|
|
|
|
|
2011-11-15 06:46:22 +00:00
|
|
|
static void Main(string[] args)
|
|
|
|
{
|
2012-08-22 21:04:13 +00:00
|
|
|
foreach (string arg in args)
|
|
|
|
{
|
|
|
|
if (String.Equals(arg, "/silent", StringComparison.InvariantCultureIgnoreCase))
|
|
|
|
{
|
|
|
|
ConsoleTraceListener.Silence = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Program.TraceListener.WriteLine("ANX.Framework StockShaderCodeGenerator (sscg) Version " + Assembly.GetExecutingAssembly().GetName().Version);
|
2011-11-15 12:11:24 +00:00
|
|
|
|
|
|
|
string buildFile;
|
|
|
|
|
|
|
|
if (args.Length < 1)
|
|
|
|
{
|
2012-08-22 21:04:13 +00:00
|
|
|
Program.TraceListener.WriteLine("No command line arguments provided. Trying to load build.xml from current directory.");
|
|
|
|
buildFile = "build.xml";
|
2011-11-15 12:11:24 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
buildFile = args[0];
|
|
|
|
}
|
|
|
|
|
2012-08-22 21:04:13 +00:00
|
|
|
Program.TraceListener.WriteLine("Creating configuration using '{0}' configuration file.", buildFile);
|
2011-11-15 12:11:24 +00:00
|
|
|
|
|
|
|
Configuration.LoadConfiguration(buildFile);
|
|
|
|
|
|
|
|
if (Configuration.ConfigurationValid)
|
|
|
|
{
|
2012-02-20 08:59:13 +00:00
|
|
|
if (Compiler.GenerateShaders())
|
|
|
|
{
|
|
|
|
CodeGenerator.Generate();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-22 21:04:13 +00:00
|
|
|
Program.TraceListener.WriteLine("error while compiling shaders. Code generation skipped...");
|
2012-02-20 08:59:13 +00:00
|
|
|
}
|
2011-11-16 14:53:42 +00:00
|
|
|
}
|
2011-11-15 06:46:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|