diff --git a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.cs b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.cs index ca683066a..0bff58946 100644 --- a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.cs +++ b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.cs @@ -378,7 +378,7 @@ namespace Flax.Build.Bindings var negate = tokenValue[0] == '!'; if (negate) tokenValue = tokenValue.Substring(1); - tokenValue = ReplacePreProcessorDefines(tokenValue, context.PreprocessorDefines.Keys); + tokenValue = ReplacePreProcessorDefines(tokenValue, context.PreprocessorDefines); tokenValue = ReplacePreProcessorDefines(tokenValue, moduleOptions.PublicDefinitions); tokenValue = ReplacePreProcessorDefines(tokenValue, moduleOptions.PrivateDefinitions); tokenValue = ReplacePreProcessorDefines(tokenValue, moduleOptions.CompileEnv.PreprocessorDefinitions); @@ -485,6 +485,16 @@ namespace Flax.Build.Bindings return text; } + private static string ReplacePreProcessorDefines(string text, IDictionary defines) + { + foreach (var e in defines) + { + if (string.Equals(text, e.Key, StringComparison.Ordinal)) + text = text.Replace(e.Key, string.IsNullOrEmpty(e.Value) ? "1" : e.Value); + } + return text; + } + private static void ParsePreprocessorIf(FileInfo fileInfo, Tokenizer tokenizer, ref Token token) { int ifsCount = 1;