Add support for custom defines for build system via Flax.Build command line
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Flax.Build
|
||||
{
|
||||
/// <summary>
|
||||
@@ -198,5 +200,10 @@ namespace Flax.Build
|
||||
/// </summary>
|
||||
[CommandLine("customProjectFormat", "<type>", "Generates code project files for a custom project format type. Valid only with -genproject option.")]
|
||||
public static string ProjectFormatCustom = null;
|
||||
|
||||
/// <summary>
|
||||
/// Custom configuration defines provided via command line for the build tool.
|
||||
/// </summary>
|
||||
public static List<string> CustomDefines = new List<string>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,16 @@ namespace Flax.Build
|
||||
{
|
||||
// Setup
|
||||
CommandLine.Configure(typeof(Configuration));
|
||||
foreach (var option in CommandLine.GetOptions())
|
||||
{
|
||||
if (option.Name.Length > 1 && option.Name[0] == 'D')
|
||||
{
|
||||
var define = option.Name.Substring(1);
|
||||
if (!string.IsNullOrEmpty(option.Value))
|
||||
define += "=" + option.Value;
|
||||
Configuration.CustomDefines.Add(define);
|
||||
}
|
||||
}
|
||||
if (Configuration.CurrentDirectory != null)
|
||||
Environment.CurrentDirectory = Configuration.CurrentDirectory;
|
||||
Globals.Root = Directory.GetCurrentDirectory();
|
||||
|
||||
Reference in New Issue
Block a user