Fix using preprocessor define values in Flax.Build bindings parsing
This commit is contained in:
@@ -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<string, string> 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;
|
||||
|
||||
Reference in New Issue
Block a user