diff --git a/Source/Tools/Flax.Build/Configuration.cs b/Source/Tools/Flax.Build/Configuration.cs
index baa4e30b1..28970f289 100644
--- a/Source/Tools/Flax.Build/Configuration.cs
+++ b/Source/Tools/Flax.Build/Configuration.cs
@@ -1,5 +1,7 @@
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
+using System.Collections.Generic;
+
namespace Flax.Build
{
///
@@ -198,5 +200,10 @@ namespace Flax.Build
///
[CommandLine("customProjectFormat", "", "Generates code project files for a custom project format type. Valid only with -genproject option.")]
public static string ProjectFormatCustom = null;
+
+ ///
+ /// Custom configuration defines provided via command line for the build tool.
+ ///
+ public static List CustomDefines = new List();
}
}
diff --git a/Source/Tools/Flax.Build/Program.cs b/Source/Tools/Flax.Build/Program.cs
index fc6d86b3b..89e71ace0 100644
--- a/Source/Tools/Flax.Build/Program.cs
+++ b/Source/Tools/Flax.Build/Program.cs
@@ -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();