Fix build issues
This commit is contained in:
@@ -22,6 +22,7 @@ namespace Flax.Build.Bindings
|
||||
public bool IsInBuild;
|
||||
public bool IsDeprecated;
|
||||
internal bool IsInited;
|
||||
internal TypedefInfo Instigator;
|
||||
|
||||
public virtual bool IsClass => false;
|
||||
public virtual bool IsStruct => false;
|
||||
|
||||
@@ -75,6 +75,11 @@ namespace Flax.Build.Bindings
|
||||
"Rectangle",
|
||||
};
|
||||
|
||||
private static bool GenerateCppIsTemplateInstantiationType(ApiTypeInfo typeInfo)
|
||||
{
|
||||
return typeInfo.Instigator != null && typeInfo.Instigator.TypeInfo is ClassStructInfo classStructInfo && classStructInfo.IsTemplate;
|
||||
}
|
||||
|
||||
private static string GenerateCppWrapperNativeToVariantMethodName(TypeInfo typeInfo)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
@@ -1786,6 +1791,8 @@ namespace Flax.Build.Bindings
|
||||
var interfacesTable = GenerateCppInterfaceInheritanceTable(buildData, contents, moduleInfo, classInfo, classTypeNameNative);
|
||||
|
||||
// Type initializer
|
||||
if (GenerateCppIsTemplateInstantiationType(classInfo))
|
||||
contents.Append("template<> ");
|
||||
contents.Append($"ScriptingTypeInitializer {classTypeNameNative}::TypeInitializer((BinaryModule*)GetBinaryModule{moduleInfo.Name}(), ");
|
||||
contents.Append($"StringAnsiView(\"{classTypeNameManaged}\", {classTypeNameManaged.Length}), ");
|
||||
contents.Append($"sizeof({classTypeNameNative}), ");
|
||||
@@ -2010,6 +2017,8 @@ namespace Flax.Build.Bindings
|
||||
contents.Append('}').Append(';').AppendLine();
|
||||
contents.AppendLine();
|
||||
|
||||
if (GenerateCppIsTemplateInstantiationType(structureInfo))
|
||||
contents.Append("template<> ");
|
||||
contents.Append($"ScriptingTypeInitializer {structureTypeNameNative}::TypeInitializer((BinaryModule*)GetBinaryModule{moduleInfo.Name}(), ");
|
||||
contents.Append($"StringAnsiView(\"{structureTypeNameManaged}\", {structureTypeNameManaged.Length}), ");
|
||||
contents.Append($"sizeof({structureTypeNameNative}), ");
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Flax.Build.Bindings
|
||||
{
|
||||
public bool IsAlias;
|
||||
public TypeInfo Type;
|
||||
public ApiTypeInfo TypeInfo; // Cached info of Type
|
||||
public ApiTypeInfo Typedef;
|
||||
|
||||
// Guards to prevent looped initialization for typedefs that are recursive
|
||||
@@ -48,6 +49,7 @@ namespace Flax.Build.Bindings
|
||||
if (apiTypeInfo == null)
|
||||
throw new Exception(string.Format("Unknown type '{0}' for typedef '{1}'.", Type, Name));
|
||||
apiTypeInfo.EnsureInited(buildData);
|
||||
TypeInfo = apiTypeInfo;
|
||||
|
||||
// Alias type without introducing any new type
|
||||
if (IsAlias || apiTypeInfo is LangType)
|
||||
@@ -60,6 +62,7 @@ namespace Flax.Build.Bindings
|
||||
{
|
||||
// Duplicate type
|
||||
var typedef = (ApiTypeInfo)apiTypeInfo.Clone();
|
||||
typedef.Instigator = this;
|
||||
typedef.NativeName = NativeName ?? Name;
|
||||
typedef.Name = Name;
|
||||
typedef.Namespace = Namespace;
|
||||
|
||||
Reference in New Issue
Block a user