Add UseLargeWorlds to engine configuration

This commit is contained in:
Wojtek Figat
2022-06-13 18:54:15 +02:00
parent 1fc26a63a7
commit ffce2005da
5 changed files with 76 additions and 5 deletions

View File

@@ -8,5 +8,8 @@
"Company": "Flax",
"Copyright": "Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.",
"GameTarget": "FlaxGame",
"EditorTarget": "FlaxEditor"
"EditorTarget": "FlaxEditor",
"Configuration": {
"UseLargeWorlds": false
}
}

View File

@@ -15,6 +15,11 @@ namespace Flax.Build
{
private static Version _engineVersion;
/// <summary>
/// Gets the engine project.
/// </summary>
public static ProjectInfo EngineProject => ProjectInfo.Load(Path.Combine(Globals.EngineRoot, "Flax.flaxproj"));
/// <summary>
/// Gets the engine version.
/// </summary>
@@ -24,7 +29,7 @@ namespace Flax.Build
{
if (_engineVersion == null)
{
_engineVersion = ProjectInfo.Load(Path.Combine(Globals.EngineRoot, "Flax.flaxproj")).Version;
_engineVersion = EngineProject.Version;
Log.Verbose(string.Format("Engine build version: {0}", _engineVersion));
}
return _engineVersion;

View File

@@ -205,6 +205,26 @@ namespace Flax.Build
return options;
}
/// <summary>
/// Gets the options for the given configuration (key=value pairs).
/// </summary>
/// <param name="configuration">The configuration (key=value pairs).</param>
/// <returns>The options.</returns>
public static Option[] GetOptions(Dictionary<string, string> configuration)
{
var options = new Option[configuration.Count];
int i = 0;
foreach (var e in configuration)
{
options[i] = new Option
{
Name = e.Key,
Value = e.Value,
};
}
return options;
}
/// <summary>
/// Parses the specified command line.
/// </summary>
@@ -347,14 +367,45 @@ namespace Flax.Build
Configure(GetMembers(obj), obj, commandLine);
}
/// <summary>
/// Configures the members of the specified object using the command line options.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="configuration">The configuration (key=value pairs).</param>
public static void Configure(Type type, Dictionary<string, string> configuration)
{
Configure(GetMembers(type), null, configuration);
}
/// <summary>
/// Configures the members of the specified object using the command line options.
/// </summary>
/// <param name="obj">The object.</param>
/// <param name="configuration">The configuration (key=value pairs).</param>
public static void Configure(object obj, Dictionary<string, string> configuration)
{
Configure(GetMembers(obj), obj, configuration);
}
private static void Configure(Dictionary<CommandLineAttribute, MemberInfo> members, object instance, string commandLine)
{
if (commandLine == null)
throw new ArgumentNullException();
// Process command line
var options = GetOptions(commandLine);
Configure(members, instance, options);
}
private static void Configure(Dictionary<CommandLineAttribute, MemberInfo> members, object instance, Dictionary<string, string> configuration)
{
if (configuration == null)
throw new ArgumentNullException();
var options = GetOptions(configuration);
Configure(members, instance, options);
}
private static void Configure(Dictionary<CommandLineAttribute, MemberInfo> members, object instance, Option[] options)
{
foreach (var e in members)
{
// Get option from command line

View File

@@ -38,7 +38,6 @@ namespace Flax.Build
{
// Setup
CommandLine.Configure(typeof(Configuration));
CommandLine.Configure(typeof(EngineConfiguration));
foreach (var option in CommandLine.GetOptions())
{
if (option.Name.Length > 1 && option.Name[0] == 'D')
@@ -78,6 +77,14 @@ namespace Flax.Build
Log.Warning("Missing project file.");
}
// Configure engine
{
var engineProject = EngineTarget.EngineProject;
if (engineProject != null && engineProject.Configuration != null && engineProject.Configuration.Count != 0)
CommandLine.Configure(typeof(EngineConfiguration), engineProject.Configuration);
CommandLine.Configure(typeof(EngineConfiguration));
}
// Use mutex if required
if (Configuration.Mutex)
{

View File

@@ -95,6 +95,11 @@ namespace Flax.Build
/// </summary>
public string EngineNickname;
/// <summary>
/// The custom build configuration entries loaded from project file.
/// </summary>
public Dictionary<string, string> Configuration;
/// <summary>
/// True if project is using C#-only and no native toolsets is required to build and use scripts.
/// </summary>