From 4de3d134c95d4fdad29f681a3bbcb9b7bf9b4b23 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 16 Jun 2021 17:40:00 +0200 Subject: [PATCH] Fix generating includes list in c++ glue code for script (non-pod and variant wrappers can produce additional includes) --- .../Bindings/BindingsGenerator.Cpp.cs | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs index 722dc7158..d0b615f66 100644 --- a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs +++ b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs @@ -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());