Fix generating includes list in c++ glue code for script (non-pod and variant wrappers can produce additional includes)

This commit is contained in:
Wojtek Figat
2021-06-16 17:40:00 +02:00
parent e8348f2c7a
commit 4de3d134c9

View File

@@ -1925,16 +1925,6 @@ namespace Flax.Build.Bindings
{
var header = new StringBuilder();
// Includes
CppReferencesFiles.Remove(null);
CppIncludeFilesList.Clear();
foreach (var fileInfo in CppReferencesFiles)
CppIncludeFilesList.Add(fileInfo.Name);
CppIncludeFilesList.AddRange(CppIncludeFiles);
CppIncludeFilesList.Sort();
foreach (var path in CppIncludeFilesList)
header.AppendFormat("#include \"{0}\"", path).AppendLine();
// Variant converting helper methods
foreach (var typeInfo in CppVariantToTypes)
{
@@ -2284,6 +2274,18 @@ namespace Flax.Build.Bindings
}
contents.Insert(headerPos, header.ToString());
// Includes
header.Clear();
CppReferencesFiles.Remove(null);
CppIncludeFilesList.Clear();
foreach (var fileInfo in CppReferencesFiles)
CppIncludeFilesList.Add(fileInfo.Name);
CppIncludeFilesList.AddRange(CppIncludeFiles);
CppIncludeFilesList.Sort();
foreach (var path in CppIncludeFilesList)
header.AppendFormat("#include \"{0}\"", path).AppendLine();
contents.Insert(headerPos, header.ToString());
}
Utilities.WriteFileIfChanged(bindings.GeneratedCppFilePath, contents.ToString());