diff --git a/distr/flecs.h b/distr/flecs.h index 1e627e286..902555015 100644 --- a/distr/flecs.h +++ b/distr/flecs.h @@ -16553,7 +16553,7 @@ const ecs_member_t* ecs_cpp_last_member( #pragma once // STL includes -#ifndef FLECS_CUSTOM_STD_INCLUDE +#ifndef FLECS_NO_STD_INCLUDE #include #endif @@ -16562,7 +16562,15 @@ const ecs_member_t* ecs_cpp_last_member( #endif #ifndef FLECS_API_GLOBAL -#define FLECS_API_GLOBAL static +#define FLECS_API_GLOBAL +#endif + +#ifndef FLECS_API_DEPENDENCY +#define FLECS_API_DEPENDENCY +#endif + +#ifndef FLECS_STATIC_IN_HEADER +#define FLECS_STATIC_IN_HEADER static #endif /** @@ -16678,96 +16686,96 @@ using Poly = EcsPoly; using DefaultChildComponent = EcsDefaultChildComponent; /* Builtin tags */ -FLECS_API_GLOBAL const flecs::entity_t Query = EcsQuery; -FLECS_API_GLOBAL const flecs::entity_t Observer = EcsObserver; -FLECS_API_GLOBAL const flecs::entity_t Private = EcsPrivate; -FLECS_API_GLOBAL const flecs::entity_t Module = EcsModule; -FLECS_API_GLOBAL const flecs::entity_t Prefab = EcsPrefab; -FLECS_API_GLOBAL const flecs::entity_t Disabled = EcsDisabled; -FLECS_API_GLOBAL const flecs::entity_t Empty = EcsEmpty; -FLECS_API_GLOBAL const flecs::entity_t Monitor = EcsMonitor; -FLECS_API_GLOBAL const flecs::entity_t System = EcsSystem; -FLECS_API_GLOBAL const flecs::entity_t Pipeline = ecs_id(EcsPipeline); -FLECS_API_GLOBAL const flecs::entity_t Phase = EcsPhase; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Query = EcsQuery; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Observer = EcsObserver; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Private = EcsPrivate; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Module = EcsModule; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Prefab = EcsPrefab; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Disabled = EcsDisabled; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Empty = EcsEmpty; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Monitor = EcsMonitor; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t System = EcsSystem; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Pipeline = ecs_id(EcsPipeline); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Phase = EcsPhase; /* Builtin event tags */ -FLECS_API_GLOBAL const flecs::entity_t OnAdd = EcsOnAdd; -FLECS_API_GLOBAL const flecs::entity_t OnRemove = EcsOnRemove; -FLECS_API_GLOBAL const flecs::entity_t OnSet = EcsOnSet; -FLECS_API_GLOBAL const flecs::entity_t OnTableCreate = EcsOnTableCreate; -FLECS_API_GLOBAL const flecs::entity_t OnTableDelete = EcsOnTableDelete; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnAdd = EcsOnAdd; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnRemove = EcsOnRemove; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnSet = EcsOnSet; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnTableCreate = EcsOnTableCreate; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnTableDelete = EcsOnTableDelete; /* Builtin term flags */ -FLECS_API_GLOBAL const uint64_t Self = EcsSelf; -FLECS_API_GLOBAL const uint64_t Up = EcsUp; -FLECS_API_GLOBAL const uint64_t Trav = EcsTrav; -FLECS_API_GLOBAL const uint64_t Cascade = EcsCascade; -FLECS_API_GLOBAL const uint64_t Desc = EcsDesc; -FLECS_API_GLOBAL const uint64_t IsVariable = EcsIsVariable; -FLECS_API_GLOBAL const uint64_t IsEntity = EcsIsEntity; -FLECS_API_GLOBAL const uint64_t IsName = EcsIsName; -FLECS_API_GLOBAL const uint64_t TraverseFlags = EcsTraverseFlags; -FLECS_API_GLOBAL const uint64_t TermRefFlags = EcsTermRefFlags; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t Self = EcsSelf; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t Up = EcsUp; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t Trav = EcsTrav; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t Cascade = EcsCascade; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t Desc = EcsDesc; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t IsVariable = EcsIsVariable; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t IsEntity = EcsIsEntity; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t IsName = EcsIsName; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t TraverseFlags = EcsTraverseFlags; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t TermRefFlags = EcsTermRefFlags; /* Builtin entity ids */ -FLECS_API_GLOBAL const flecs::entity_t Flecs = EcsFlecs; -FLECS_API_GLOBAL const flecs::entity_t FlecsCore = EcsFlecsCore; -FLECS_API_GLOBAL const flecs::entity_t World = EcsWorld; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Flecs = EcsFlecs; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t FlecsCore = EcsFlecsCore; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t World = EcsWorld; /* Component traits */ -FLECS_API_GLOBAL const flecs::entity_t Wildcard = EcsWildcard; -FLECS_API_GLOBAL const flecs::entity_t Any = EcsAny; -FLECS_API_GLOBAL const flecs::entity_t This = EcsThis; -FLECS_API_GLOBAL const flecs::entity_t Transitive = EcsTransitive; -FLECS_API_GLOBAL const flecs::entity_t Reflexive = EcsReflexive; -FLECS_API_GLOBAL const flecs::entity_t Final = EcsFinal; -FLECS_API_GLOBAL const flecs::entity_t PairIsTag = EcsPairIsTag; -FLECS_API_GLOBAL const flecs::entity_t Exclusive = EcsExclusive; -FLECS_API_GLOBAL const flecs::entity_t Acyclic = EcsAcyclic; -FLECS_API_GLOBAL const flecs::entity_t Traversable = EcsTraversable; -FLECS_API_GLOBAL const flecs::entity_t Symmetric = EcsSymmetric; -FLECS_API_GLOBAL const flecs::entity_t With = EcsWith; -FLECS_API_GLOBAL const flecs::entity_t OneOf = EcsOneOf; -FLECS_API_GLOBAL const flecs::entity_t Trait = EcsTrait; -FLECS_API_GLOBAL const flecs::entity_t Relationship = EcsRelationship; -FLECS_API_GLOBAL const flecs::entity_t Target = EcsTarget; -FLECS_API_GLOBAL const flecs::entity_t CanToggle = EcsCanToggle; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Wildcard = EcsWildcard; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Any = EcsAny; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t This = EcsThis; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Transitive = EcsTransitive; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Reflexive = EcsReflexive; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Final = EcsFinal; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PairIsTag = EcsPairIsTag; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Exclusive = EcsExclusive; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Acyclic = EcsAcyclic; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Traversable = EcsTraversable; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Symmetric = EcsSymmetric; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t With = EcsWith; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OneOf = EcsOneOf; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Trait = EcsTrait; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Relationship = EcsRelationship; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Target = EcsTarget; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t CanToggle = EcsCanToggle; /* OnInstantiate trait */ -FLECS_API_GLOBAL const flecs::entity_t OnInstantiate = EcsOnInstantiate; -FLECS_API_GLOBAL const flecs::entity_t Override = EcsOverride; -FLECS_API_GLOBAL const flecs::entity_t Inherit = EcsInherit; -FLECS_API_GLOBAL const flecs::entity_t DontInherit = EcsDontInherit; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnInstantiate = EcsOnInstantiate; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Override = EcsOverride; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Inherit = EcsInherit; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t DontInherit = EcsDontInherit; /* OnDelete/OnDeleteTarget traits */ -FLECS_API_GLOBAL const flecs::entity_t OnDelete = EcsOnDelete; -FLECS_API_GLOBAL const flecs::entity_t OnDeleteTarget = EcsOnDeleteTarget; -FLECS_API_GLOBAL const flecs::entity_t Remove = EcsRemove; -FLECS_API_GLOBAL const flecs::entity_t Delete = EcsDelete; -FLECS_API_GLOBAL const flecs::entity_t Panic = EcsPanic; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnDelete = EcsOnDelete; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnDeleteTarget = EcsOnDeleteTarget; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Remove = EcsRemove; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Delete = EcsDelete; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Panic = EcsPanic; /* Builtin relationships */ -FLECS_API_GLOBAL const flecs::entity_t IsA = EcsIsA; -FLECS_API_GLOBAL const flecs::entity_t ChildOf = EcsChildOf; -FLECS_API_GLOBAL const flecs::entity_t DependsOn = EcsDependsOn; -FLECS_API_GLOBAL const flecs::entity_t SlotOf = EcsSlotOf; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t IsA = EcsIsA; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t ChildOf = EcsChildOf; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t DependsOn = EcsDependsOn; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t SlotOf = EcsSlotOf; /* Builtin identifiers */ -FLECS_API_GLOBAL const flecs::entity_t Name = EcsName; -FLECS_API_GLOBAL const flecs::entity_t Symbol = EcsSymbol; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Name = EcsName; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Symbol = EcsSymbol; /* Storage */ -FLECS_API_GLOBAL const flecs::entity_t Sparse = EcsSparse; -FLECS_API_GLOBAL const flecs::entity_t Union = EcsUnion; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Sparse = EcsSparse; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Union = EcsUnion; /* Builtin predicates for comparing entity ids in queries. */ -FLECS_API_GLOBAL const flecs::entity_t PredEq = EcsPredEq; -FLECS_API_GLOBAL const flecs::entity_t PredMatch = EcsPredMatch; -FLECS_API_GLOBAL const flecs::entity_t PredLookup = EcsPredLookup; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PredEq = EcsPredEq; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PredMatch = EcsPredMatch; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PredLookup = EcsPredLookup; /* Builtin marker entities for query scopes */ -FLECS_API_GLOBAL const flecs::entity_t ScopeOpen = EcsScopeOpen; -FLECS_API_GLOBAL const flecs::entity_t ScopeClose = EcsScopeClose; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t ScopeOpen = EcsScopeOpen; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t ScopeClose = EcsScopeClose; /** @} */ @@ -16839,8 +16847,8 @@ template inline void free_obj(Ty* _ptr) { #define flecs_static_assert(cond, str) static_assert(cond, str) #endif -FLECS_API inline void* operator new(size_t, flecs::_::placement_new_tag_t, void* _ptr) noexcept { return _ptr; } -FLECS_API inline void operator delete(void*, flecs::_::placement_new_tag_t, void*) noexcept { } +FLECS_API_DEPENDENCY inline void* operator new(size_t, flecs::_::placement_new_tag_t, void* _ptr) noexcept { return _ptr; } +FLECS_API_DEPENDENCY inline void operator delete(void*, flecs::_::placement_new_tag_t, void*) noexcept { } namespace flecs { @@ -16923,7 +16931,7 @@ struct always_false { } // namespace flecs -#ifndef FLECS_CUSTOM_STD_INCLUDE +#ifndef FLECS_NO_STD_INCLUDE #include #endif /** @@ -17199,7 +17207,7 @@ struct string_view : string { * and their names. This is used to automatically register enum constants. */ -#ifndef FLECS_CUSTOM_STD_INCLUDE +#ifndef FLECS_NO_STD_INCLUDE #include #include #endif @@ -17579,13 +17587,15 @@ struct enum_type { template enum_data_impl enum_type::data; +FLECS_API_DEPENDENCY template ::value > = 0> -inline static void init_enum(flecs::world_t *world, flecs::entity_t id) { +inline FLECS_STATIC_IN_HEADER void init_enum(flecs::world_t *world, flecs::entity_t id) { _::enum_type::get().init(world, id); } +FLECS_API_DEPENDENCY template ::value > = 0> -inline static void init_enum(flecs::world_t*, flecs::entity_t) { } +inline FLECS_STATIC_IN_HEADER void init_enum(flecs::world_t*, flecs::entity_t) { } } // namespace _ @@ -18374,17 +18384,17 @@ template struct pipeline_builder; /* Builtin pipeline tags */ -FLECS_API_GLOBAL const flecs::entity_t OnStart = EcsOnStart; -FLECS_API_GLOBAL const flecs::entity_t PreFrame = EcsPreFrame; -FLECS_API_GLOBAL const flecs::entity_t OnLoad = EcsOnLoad; -FLECS_API_GLOBAL const flecs::entity_t PostLoad = EcsPostLoad; -FLECS_API_GLOBAL const flecs::entity_t PreUpdate = EcsPreUpdate; -FLECS_API_GLOBAL const flecs::entity_t OnUpdate = EcsOnUpdate; -FLECS_API_GLOBAL const flecs::entity_t OnValidate = EcsOnValidate; -FLECS_API_GLOBAL const flecs::entity_t PostUpdate = EcsPostUpdate; -FLECS_API_GLOBAL const flecs::entity_t PreStore = EcsPreStore; -FLECS_API_GLOBAL const flecs::entity_t OnStore = EcsOnStore; -FLECS_API_GLOBAL const flecs::entity_t PostFrame = EcsPostFrame; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnStart = EcsOnStart; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PreFrame = EcsPreFrame; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnLoad = EcsOnLoad; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PostLoad = EcsPostLoad; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PreUpdate = EcsPreUpdate; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnUpdate = EcsOnUpdate; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnValidate = EcsOnValidate; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PostUpdate = EcsPostUpdate; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PreStore = EcsPreStore; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnStore = EcsOnStore; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PostFrame = EcsPostFrame; /** @} */ @@ -18447,16 +18457,16 @@ namespace doc { FLECS_API_STRUCT using Description = EcsDocDescription; /** flecs.doc.Brief component */ -FLECS_API_GLOBAL const flecs::entity_t Brief = EcsDocBrief; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Brief = EcsDocBrief; /** flecs.doc.Detail component */ -FLECS_API_GLOBAL const flecs::entity_t Detail = EcsDocDetail; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Detail = EcsDocDetail; /** flecs.doc.Link component */ -FLECS_API_GLOBAL const flecs::entity_t Link = EcsDocLink; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Link = EcsDocLink; /** flecs.doc.Color component */ -FLECS_API_GLOBAL const flecs::entity_t Color = EcsDocColor; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Color = EcsDocColor; /** @private */ namespace _ { @@ -18563,59 +18573,59 @@ FLECS_API_STRUCT struct bitmask { }; /* Handles to builtin reflection types */ -FLECS_API_GLOBAL const flecs::entity_t Bool = ecs_id(ecs_bool_t); -FLECS_API_GLOBAL const flecs::entity_t Char = ecs_id(ecs_char_t); -FLECS_API_GLOBAL const flecs::entity_t Byte = ecs_id(ecs_byte_t); -FLECS_API_GLOBAL const flecs::entity_t U8 = ecs_id(ecs_u8_t); -FLECS_API_GLOBAL const flecs::entity_t U16 = ecs_id(ecs_u16_t); -FLECS_API_GLOBAL const flecs::entity_t U32 = ecs_id(ecs_u32_t); -FLECS_API_GLOBAL const flecs::entity_t U64 = ecs_id(ecs_u64_t); -FLECS_API_GLOBAL const flecs::entity_t Uptr = ecs_id(ecs_uptr_t); -FLECS_API_GLOBAL const flecs::entity_t I8 = ecs_id(ecs_i8_t); -FLECS_API_GLOBAL const flecs::entity_t I16 = ecs_id(ecs_i16_t); -FLECS_API_GLOBAL const flecs::entity_t I32 = ecs_id(ecs_i32_t); -FLECS_API_GLOBAL const flecs::entity_t I64 = ecs_id(ecs_i64_t); -FLECS_API_GLOBAL const flecs::entity_t Iptr = ecs_id(ecs_iptr_t); -FLECS_API_GLOBAL const flecs::entity_t F32 = ecs_id(ecs_f32_t); -FLECS_API_GLOBAL const flecs::entity_t F64 = ecs_id(ecs_f64_t); -FLECS_API_GLOBAL const flecs::entity_t String = ecs_id(ecs_string_t); -FLECS_API_GLOBAL const flecs::entity_t Entity = ecs_id(ecs_entity_t); -FLECS_API_GLOBAL const flecs::entity_t Constant = EcsConstant; -FLECS_API_GLOBAL const flecs::entity_t Quantity = EcsQuantity; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Bool = ecs_id(ecs_bool_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Char = ecs_id(ecs_char_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Byte = ecs_id(ecs_byte_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t U8 = ecs_id(ecs_u8_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t U16 = ecs_id(ecs_u16_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t U32 = ecs_id(ecs_u32_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t U64 = ecs_id(ecs_u64_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Uptr = ecs_id(ecs_uptr_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t I8 = ecs_id(ecs_i8_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t I16 = ecs_id(ecs_i16_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t I32 = ecs_id(ecs_i32_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t I64 = ecs_id(ecs_i64_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Iptr = ecs_id(ecs_iptr_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t F32 = ecs_id(ecs_f32_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t F64 = ecs_id(ecs_f64_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t String = ecs_id(ecs_string_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Entity = ecs_id(ecs_entity_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Constant = EcsConstant; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Quantity = EcsQuantity; namespace meta { /* Type kinds supported by reflection system */ FLECS_API_STRUCT using type_kind_t = ecs_type_kind_t; -FLECS_API_GLOBAL const type_kind_t PrimitiveType = EcsPrimitiveType; -FLECS_API_GLOBAL const type_kind_t BitmaskType = EcsBitmaskType; -FLECS_API_GLOBAL const type_kind_t EnumType = EcsEnumType; -FLECS_API_GLOBAL const type_kind_t StructType = EcsStructType; -FLECS_API_GLOBAL const type_kind_t ArrayType = EcsArrayType; -FLECS_API_GLOBAL const type_kind_t VectorType = EcsVectorType; -FLECS_API_GLOBAL const type_kind_t CustomType = EcsOpaqueType; -FLECS_API_GLOBAL const type_kind_t TypeKindLast = EcsTypeKindLast; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const type_kind_t PrimitiveType = EcsPrimitiveType; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const type_kind_t BitmaskType = EcsBitmaskType; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const type_kind_t EnumType = EcsEnumType; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const type_kind_t StructType = EcsStructType; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const type_kind_t ArrayType = EcsArrayType; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const type_kind_t VectorType = EcsVectorType; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const type_kind_t CustomType = EcsOpaqueType; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const type_kind_t TypeKindLast = EcsTypeKindLast; /* Primitive type kinds supported by reflection system */ FLECS_API_STRUCT using primitive_kind_t = ecs_primitive_kind_t; -FLECS_API_GLOBAL const primitive_kind_t Bool = EcsBool; -FLECS_API_GLOBAL const primitive_kind_t Char = EcsChar; -FLECS_API_GLOBAL const primitive_kind_t Byte = EcsByte; -FLECS_API_GLOBAL const primitive_kind_t U8 = EcsU8; -FLECS_API_GLOBAL const primitive_kind_t U16 = EcsU16; -FLECS_API_GLOBAL const primitive_kind_t U32 = EcsU32; -FLECS_API_GLOBAL const primitive_kind_t U64 = EcsU64; -FLECS_API_GLOBAL const primitive_kind_t I8 = EcsI8; -FLECS_API_GLOBAL const primitive_kind_t I16 = EcsI16; -FLECS_API_GLOBAL const primitive_kind_t I32 = EcsI32; -FLECS_API_GLOBAL const primitive_kind_t I64 = EcsI64; -FLECS_API_GLOBAL const primitive_kind_t F32 = EcsF32; -FLECS_API_GLOBAL const primitive_kind_t F64 = EcsF64; -FLECS_API_GLOBAL const primitive_kind_t UPtr = EcsUPtr; -FLECS_API_GLOBAL const primitive_kind_t IPtr = EcsIPtr; -FLECS_API_GLOBAL const primitive_kind_t String = EcsString; -FLECS_API_GLOBAL const primitive_kind_t Entity = EcsEntity; -FLECS_API_GLOBAL const primitive_kind_t PrimitiveKindLast = EcsPrimitiveKindLast; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t Bool = EcsBool; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t Char = EcsChar; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t Byte = EcsByte; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t U8 = EcsU8; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t U16 = EcsU16; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t U32 = EcsU32; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t U64 = EcsU64; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t I8 = EcsI8; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t I16 = EcsI16; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t I32 = EcsI32; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t I64 = EcsI64; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t F32 = EcsF32; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t F64 = EcsF64; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t UPtr = EcsUPtr; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t IPtr = EcsIPtr; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t String = EcsString; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t Entity = EcsEntity; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t PrimitiveKindLast = EcsPrimitiveKindLast; /** @} */ @@ -25667,7 +25677,7 @@ const char* from_json(const char *json) { #pragma once -#ifndef FLECS_CUSTOM_STD_INCLUDE +#ifndef FLECS_NO_STD_INCLUDE #include // std::declval #endif @@ -26571,7 +26581,7 @@ using delegate = _::each_delegate::type, Args...>; #pragma once -#ifndef FLECS_CUSTOM_STD_INCLUDE +#ifndef FLECS_NO_STD_INCLUDE #include #include #endif diff --git a/include/flecs/addons/cpp/c_types.hpp b/include/flecs/addons/cpp/c_types.hpp index abc79d275..6618b93ad 100644 --- a/include/flecs/addons/cpp/c_types.hpp +++ b/include/flecs/addons/cpp/c_types.hpp @@ -73,96 +73,96 @@ using Poly = EcsPoly; using DefaultChildComponent = EcsDefaultChildComponent; /* Builtin tags */ -FLECS_API_GLOBAL const flecs::entity_t Query = EcsQuery; -FLECS_API_GLOBAL const flecs::entity_t Observer = EcsObserver; -FLECS_API_GLOBAL const flecs::entity_t Private = EcsPrivate; -FLECS_API_GLOBAL const flecs::entity_t Module = EcsModule; -FLECS_API_GLOBAL const flecs::entity_t Prefab = EcsPrefab; -FLECS_API_GLOBAL const flecs::entity_t Disabled = EcsDisabled; -FLECS_API_GLOBAL const flecs::entity_t Empty = EcsEmpty; -FLECS_API_GLOBAL const flecs::entity_t Monitor = EcsMonitor; -FLECS_API_GLOBAL const flecs::entity_t System = EcsSystem; -FLECS_API_GLOBAL const flecs::entity_t Pipeline = ecs_id(EcsPipeline); -FLECS_API_GLOBAL const flecs::entity_t Phase = EcsPhase; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Query = EcsQuery; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Observer = EcsObserver; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Private = EcsPrivate; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Module = EcsModule; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Prefab = EcsPrefab; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Disabled = EcsDisabled; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Empty = EcsEmpty; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Monitor = EcsMonitor; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t System = EcsSystem; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Pipeline = ecs_id(EcsPipeline); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Phase = EcsPhase; /* Builtin event tags */ -FLECS_API_GLOBAL const flecs::entity_t OnAdd = EcsOnAdd; -FLECS_API_GLOBAL const flecs::entity_t OnRemove = EcsOnRemove; -FLECS_API_GLOBAL const flecs::entity_t OnSet = EcsOnSet; -FLECS_API_GLOBAL const flecs::entity_t OnTableCreate = EcsOnTableCreate; -FLECS_API_GLOBAL const flecs::entity_t OnTableDelete = EcsOnTableDelete; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnAdd = EcsOnAdd; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnRemove = EcsOnRemove; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnSet = EcsOnSet; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnTableCreate = EcsOnTableCreate; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnTableDelete = EcsOnTableDelete; /* Builtin term flags */ -FLECS_API_GLOBAL const uint64_t Self = EcsSelf; -FLECS_API_GLOBAL const uint64_t Up = EcsUp; -FLECS_API_GLOBAL const uint64_t Trav = EcsTrav; -FLECS_API_GLOBAL const uint64_t Cascade = EcsCascade; -FLECS_API_GLOBAL const uint64_t Desc = EcsDesc; -FLECS_API_GLOBAL const uint64_t IsVariable = EcsIsVariable; -FLECS_API_GLOBAL const uint64_t IsEntity = EcsIsEntity; -FLECS_API_GLOBAL const uint64_t IsName = EcsIsName; -FLECS_API_GLOBAL const uint64_t TraverseFlags = EcsTraverseFlags; -FLECS_API_GLOBAL const uint64_t TermRefFlags = EcsTermRefFlags; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t Self = EcsSelf; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t Up = EcsUp; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t Trav = EcsTrav; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t Cascade = EcsCascade; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t Desc = EcsDesc; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t IsVariable = EcsIsVariable; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t IsEntity = EcsIsEntity; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t IsName = EcsIsName; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t TraverseFlags = EcsTraverseFlags; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const uint64_t TermRefFlags = EcsTermRefFlags; /* Builtin entity ids */ -FLECS_API_GLOBAL const flecs::entity_t Flecs = EcsFlecs; -FLECS_API_GLOBAL const flecs::entity_t FlecsCore = EcsFlecsCore; -FLECS_API_GLOBAL const flecs::entity_t World = EcsWorld; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Flecs = EcsFlecs; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t FlecsCore = EcsFlecsCore; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t World = EcsWorld; /* Component traits */ -FLECS_API_GLOBAL const flecs::entity_t Wildcard = EcsWildcard; -FLECS_API_GLOBAL const flecs::entity_t Any = EcsAny; -FLECS_API_GLOBAL const flecs::entity_t This = EcsThis; -FLECS_API_GLOBAL const flecs::entity_t Transitive = EcsTransitive; -FLECS_API_GLOBAL const flecs::entity_t Reflexive = EcsReflexive; -FLECS_API_GLOBAL const flecs::entity_t Final = EcsFinal; -FLECS_API_GLOBAL const flecs::entity_t PairIsTag = EcsPairIsTag; -FLECS_API_GLOBAL const flecs::entity_t Exclusive = EcsExclusive; -FLECS_API_GLOBAL const flecs::entity_t Acyclic = EcsAcyclic; -FLECS_API_GLOBAL const flecs::entity_t Traversable = EcsTraversable; -FLECS_API_GLOBAL const flecs::entity_t Symmetric = EcsSymmetric; -FLECS_API_GLOBAL const flecs::entity_t With = EcsWith; -FLECS_API_GLOBAL const flecs::entity_t OneOf = EcsOneOf; -FLECS_API_GLOBAL const flecs::entity_t Trait = EcsTrait; -FLECS_API_GLOBAL const flecs::entity_t Relationship = EcsRelationship; -FLECS_API_GLOBAL const flecs::entity_t Target = EcsTarget; -FLECS_API_GLOBAL const flecs::entity_t CanToggle = EcsCanToggle; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Wildcard = EcsWildcard; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Any = EcsAny; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t This = EcsThis; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Transitive = EcsTransitive; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Reflexive = EcsReflexive; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Final = EcsFinal; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PairIsTag = EcsPairIsTag; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Exclusive = EcsExclusive; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Acyclic = EcsAcyclic; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Traversable = EcsTraversable; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Symmetric = EcsSymmetric; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t With = EcsWith; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OneOf = EcsOneOf; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Trait = EcsTrait; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Relationship = EcsRelationship; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Target = EcsTarget; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t CanToggle = EcsCanToggle; /* OnInstantiate trait */ -FLECS_API_GLOBAL const flecs::entity_t OnInstantiate = EcsOnInstantiate; -FLECS_API_GLOBAL const flecs::entity_t Override = EcsOverride; -FLECS_API_GLOBAL const flecs::entity_t Inherit = EcsInherit; -FLECS_API_GLOBAL const flecs::entity_t DontInherit = EcsDontInherit; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnInstantiate = EcsOnInstantiate; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Override = EcsOverride; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Inherit = EcsInherit; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t DontInherit = EcsDontInherit; /* OnDelete/OnDeleteTarget traits */ -FLECS_API_GLOBAL const flecs::entity_t OnDelete = EcsOnDelete; -FLECS_API_GLOBAL const flecs::entity_t OnDeleteTarget = EcsOnDeleteTarget; -FLECS_API_GLOBAL const flecs::entity_t Remove = EcsRemove; -FLECS_API_GLOBAL const flecs::entity_t Delete = EcsDelete; -FLECS_API_GLOBAL const flecs::entity_t Panic = EcsPanic; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnDelete = EcsOnDelete; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnDeleteTarget = EcsOnDeleteTarget; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Remove = EcsRemove; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Delete = EcsDelete; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Panic = EcsPanic; /* Builtin relationships */ -FLECS_API_GLOBAL const flecs::entity_t IsA = EcsIsA; -FLECS_API_GLOBAL const flecs::entity_t ChildOf = EcsChildOf; -FLECS_API_GLOBAL const flecs::entity_t DependsOn = EcsDependsOn; -FLECS_API_GLOBAL const flecs::entity_t SlotOf = EcsSlotOf; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t IsA = EcsIsA; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t ChildOf = EcsChildOf; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t DependsOn = EcsDependsOn; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t SlotOf = EcsSlotOf; /* Builtin identifiers */ -FLECS_API_GLOBAL const flecs::entity_t Name = EcsName; -FLECS_API_GLOBAL const flecs::entity_t Symbol = EcsSymbol; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Name = EcsName; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Symbol = EcsSymbol; /* Storage */ -FLECS_API_GLOBAL const flecs::entity_t Sparse = EcsSparse; -FLECS_API_GLOBAL const flecs::entity_t Union = EcsUnion; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Sparse = EcsSparse; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Union = EcsUnion; /* Builtin predicates for comparing entity ids in queries. */ -FLECS_API_GLOBAL const flecs::entity_t PredEq = EcsPredEq; -FLECS_API_GLOBAL const flecs::entity_t PredMatch = EcsPredMatch; -FLECS_API_GLOBAL const flecs::entity_t PredLookup = EcsPredLookup; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PredEq = EcsPredEq; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PredMatch = EcsPredMatch; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PredLookup = EcsPredLookup; /* Builtin marker entities for query scopes */ -FLECS_API_GLOBAL const flecs::entity_t ScopeOpen = EcsScopeOpen; -FLECS_API_GLOBAL const flecs::entity_t ScopeClose = EcsScopeClose; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t ScopeOpen = EcsScopeOpen; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t ScopeClose = EcsScopeClose; /** @} */ diff --git a/include/flecs/addons/cpp/component.hpp b/include/flecs/addons/cpp/component.hpp index f7cee3a0f..ca9d73fbd 100644 --- a/include/flecs/addons/cpp/component.hpp +++ b/include/flecs/addons/cpp/component.hpp @@ -5,7 +5,7 @@ #pragma once -#ifndef FLECS_CUSTOM_STD_INCLUDE +#ifndef FLECS_NO_STD_INCLUDE #include #include #endif diff --git a/include/flecs/addons/cpp/delegate.hpp b/include/flecs/addons/cpp/delegate.hpp index 59cc8c2f0..ac4b87b90 100644 --- a/include/flecs/addons/cpp/delegate.hpp +++ b/include/flecs/addons/cpp/delegate.hpp @@ -5,7 +5,7 @@ #pragma once -#ifndef FLECS_CUSTOM_STD_INCLUDE +#ifndef FLECS_NO_STD_INCLUDE #include // std::declval #endif diff --git a/include/flecs/addons/cpp/flecs.hpp b/include/flecs/addons/cpp/flecs.hpp index b66ca4c70..998f9a620 100644 --- a/include/flecs/addons/cpp/flecs.hpp +++ b/include/flecs/addons/cpp/flecs.hpp @@ -6,7 +6,7 @@ #pragma once // STL includes -#ifndef FLECS_CUSTOM_STD_INCLUDE +#ifndef FLECS_NO_STD_INCLUDE #include #endif @@ -15,7 +15,15 @@ #endif #ifndef FLECS_API_GLOBAL -#define FLECS_API_GLOBAL static +#define FLECS_API_GLOBAL +#endif + +#ifndef FLECS_API_DEPENDENCY +#define FLECS_API_DEPENDENCY +#endif + +#ifndef FLECS_STATIC_IN_HEADER +#define FLECS_STATIC_IN_HEADER static #endif /** diff --git a/include/flecs/addons/cpp/mixins/doc/decl.hpp b/include/flecs/addons/cpp/mixins/doc/decl.hpp index 131c78ef2..381c5c464 100644 --- a/include/flecs/addons/cpp/mixins/doc/decl.hpp +++ b/include/flecs/addons/cpp/mixins/doc/decl.hpp @@ -20,16 +20,16 @@ namespace doc { FLECS_API_STRUCT using Description = EcsDocDescription; /** flecs.doc.Brief component */ -FLECS_API_GLOBAL const flecs::entity_t Brief = EcsDocBrief; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Brief = EcsDocBrief; /** flecs.doc.Detail component */ -FLECS_API_GLOBAL const flecs::entity_t Detail = EcsDocDetail; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Detail = EcsDocDetail; /** flecs.doc.Link component */ -FLECS_API_GLOBAL const flecs::entity_t Link = EcsDocLink; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Link = EcsDocLink; /** flecs.doc.Color component */ -FLECS_API_GLOBAL const flecs::entity_t Color = EcsDocColor; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Color = EcsDocColor; /** @private */ namespace _ { diff --git a/include/flecs/addons/cpp/mixins/meta/decl.hpp b/include/flecs/addons/cpp/mixins/meta/decl.hpp index 2c3c97449..6a8428f58 100644 --- a/include/flecs/addons/cpp/mixins/meta/decl.hpp +++ b/include/flecs/addons/cpp/mixins/meta/decl.hpp @@ -55,59 +55,59 @@ FLECS_API_STRUCT struct bitmask { }; /* Handles to builtin reflection types */ -FLECS_API_GLOBAL const flecs::entity_t Bool = ecs_id(ecs_bool_t); -FLECS_API_GLOBAL const flecs::entity_t Char = ecs_id(ecs_char_t); -FLECS_API_GLOBAL const flecs::entity_t Byte = ecs_id(ecs_byte_t); -FLECS_API_GLOBAL const flecs::entity_t U8 = ecs_id(ecs_u8_t); -FLECS_API_GLOBAL const flecs::entity_t U16 = ecs_id(ecs_u16_t); -FLECS_API_GLOBAL const flecs::entity_t U32 = ecs_id(ecs_u32_t); -FLECS_API_GLOBAL const flecs::entity_t U64 = ecs_id(ecs_u64_t); -FLECS_API_GLOBAL const flecs::entity_t Uptr = ecs_id(ecs_uptr_t); -FLECS_API_GLOBAL const flecs::entity_t I8 = ecs_id(ecs_i8_t); -FLECS_API_GLOBAL const flecs::entity_t I16 = ecs_id(ecs_i16_t); -FLECS_API_GLOBAL const flecs::entity_t I32 = ecs_id(ecs_i32_t); -FLECS_API_GLOBAL const flecs::entity_t I64 = ecs_id(ecs_i64_t); -FLECS_API_GLOBAL const flecs::entity_t Iptr = ecs_id(ecs_iptr_t); -FLECS_API_GLOBAL const flecs::entity_t F32 = ecs_id(ecs_f32_t); -FLECS_API_GLOBAL const flecs::entity_t F64 = ecs_id(ecs_f64_t); -FLECS_API_GLOBAL const flecs::entity_t String = ecs_id(ecs_string_t); -FLECS_API_GLOBAL const flecs::entity_t Entity = ecs_id(ecs_entity_t); -FLECS_API_GLOBAL const flecs::entity_t Constant = EcsConstant; -FLECS_API_GLOBAL const flecs::entity_t Quantity = EcsQuantity; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Bool = ecs_id(ecs_bool_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Char = ecs_id(ecs_char_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Byte = ecs_id(ecs_byte_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t U8 = ecs_id(ecs_u8_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t U16 = ecs_id(ecs_u16_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t U32 = ecs_id(ecs_u32_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t U64 = ecs_id(ecs_u64_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Uptr = ecs_id(ecs_uptr_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t I8 = ecs_id(ecs_i8_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t I16 = ecs_id(ecs_i16_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t I32 = ecs_id(ecs_i32_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t I64 = ecs_id(ecs_i64_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Iptr = ecs_id(ecs_iptr_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t F32 = ecs_id(ecs_f32_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t F64 = ecs_id(ecs_f64_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t String = ecs_id(ecs_string_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Entity = ecs_id(ecs_entity_t); +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Constant = EcsConstant; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t Quantity = EcsQuantity; namespace meta { /* Type kinds supported by reflection system */ FLECS_API_STRUCT using type_kind_t = ecs_type_kind_t; -FLECS_API_GLOBAL const type_kind_t PrimitiveType = EcsPrimitiveType; -FLECS_API_GLOBAL const type_kind_t BitmaskType = EcsBitmaskType; -FLECS_API_GLOBAL const type_kind_t EnumType = EcsEnumType; -FLECS_API_GLOBAL const type_kind_t StructType = EcsStructType; -FLECS_API_GLOBAL const type_kind_t ArrayType = EcsArrayType; -FLECS_API_GLOBAL const type_kind_t VectorType = EcsVectorType; -FLECS_API_GLOBAL const type_kind_t CustomType = EcsOpaqueType; -FLECS_API_GLOBAL const type_kind_t TypeKindLast = EcsTypeKindLast; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const type_kind_t PrimitiveType = EcsPrimitiveType; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const type_kind_t BitmaskType = EcsBitmaskType; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const type_kind_t EnumType = EcsEnumType; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const type_kind_t StructType = EcsStructType; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const type_kind_t ArrayType = EcsArrayType; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const type_kind_t VectorType = EcsVectorType; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const type_kind_t CustomType = EcsOpaqueType; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const type_kind_t TypeKindLast = EcsTypeKindLast; /* Primitive type kinds supported by reflection system */ FLECS_API_STRUCT using primitive_kind_t = ecs_primitive_kind_t; -FLECS_API_GLOBAL const primitive_kind_t Bool = EcsBool; -FLECS_API_GLOBAL const primitive_kind_t Char = EcsChar; -FLECS_API_GLOBAL const primitive_kind_t Byte = EcsByte; -FLECS_API_GLOBAL const primitive_kind_t U8 = EcsU8; -FLECS_API_GLOBAL const primitive_kind_t U16 = EcsU16; -FLECS_API_GLOBAL const primitive_kind_t U32 = EcsU32; -FLECS_API_GLOBAL const primitive_kind_t U64 = EcsU64; -FLECS_API_GLOBAL const primitive_kind_t I8 = EcsI8; -FLECS_API_GLOBAL const primitive_kind_t I16 = EcsI16; -FLECS_API_GLOBAL const primitive_kind_t I32 = EcsI32; -FLECS_API_GLOBAL const primitive_kind_t I64 = EcsI64; -FLECS_API_GLOBAL const primitive_kind_t F32 = EcsF32; -FLECS_API_GLOBAL const primitive_kind_t F64 = EcsF64; -FLECS_API_GLOBAL const primitive_kind_t UPtr = EcsUPtr; -FLECS_API_GLOBAL const primitive_kind_t IPtr = EcsIPtr; -FLECS_API_GLOBAL const primitive_kind_t String = EcsString; -FLECS_API_GLOBAL const primitive_kind_t Entity = EcsEntity; -FLECS_API_GLOBAL const primitive_kind_t PrimitiveKindLast = EcsPrimitiveKindLast; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t Bool = EcsBool; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t Char = EcsChar; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t Byte = EcsByte; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t U8 = EcsU8; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t U16 = EcsU16; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t U32 = EcsU32; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t U64 = EcsU64; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t I8 = EcsI8; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t I16 = EcsI16; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t I32 = EcsI32; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t I64 = EcsI64; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t F32 = EcsF32; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t F64 = EcsF64; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t UPtr = EcsUPtr; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t IPtr = EcsIPtr; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t String = EcsString; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t Entity = EcsEntity; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const primitive_kind_t PrimitiveKindLast = EcsPrimitiveKindLast; /** @} */ diff --git a/include/flecs/addons/cpp/mixins/pipeline/decl.hpp b/include/flecs/addons/cpp/mixins/pipeline/decl.hpp index d94320bb1..06f50f93b 100644 --- a/include/flecs/addons/cpp/mixins/pipeline/decl.hpp +++ b/include/flecs/addons/cpp/mixins/pipeline/decl.hpp @@ -22,17 +22,17 @@ template struct pipeline_builder; /* Builtin pipeline tags */ -FLECS_API_GLOBAL const flecs::entity_t OnStart = EcsOnStart; -FLECS_API_GLOBAL const flecs::entity_t PreFrame = EcsPreFrame; -FLECS_API_GLOBAL const flecs::entity_t OnLoad = EcsOnLoad; -FLECS_API_GLOBAL const flecs::entity_t PostLoad = EcsPostLoad; -FLECS_API_GLOBAL const flecs::entity_t PreUpdate = EcsPreUpdate; -FLECS_API_GLOBAL const flecs::entity_t OnUpdate = EcsOnUpdate; -FLECS_API_GLOBAL const flecs::entity_t OnValidate = EcsOnValidate; -FLECS_API_GLOBAL const flecs::entity_t PostUpdate = EcsPostUpdate; -FLECS_API_GLOBAL const flecs::entity_t PreStore = EcsPreStore; -FLECS_API_GLOBAL const flecs::entity_t OnStore = EcsOnStore; -FLECS_API_GLOBAL const flecs::entity_t PostFrame = EcsPostFrame; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnStart = EcsOnStart; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PreFrame = EcsPreFrame; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnLoad = EcsOnLoad; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PostLoad = EcsPostLoad; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PreUpdate = EcsPreUpdate; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnUpdate = EcsOnUpdate; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnValidate = EcsOnValidate; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PostUpdate = EcsPostUpdate; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PreStore = EcsPreStore; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t OnStore = EcsOnStore; +FLECS_API_GLOBAL FLECS_STATIC_IN_HEADER const flecs::entity_t PostFrame = EcsPostFrame; /** @} */ diff --git a/include/flecs/addons/cpp/utils/enum.hpp b/include/flecs/addons/cpp/utils/enum.hpp index 9520690c3..af419eec5 100644 --- a/include/flecs/addons/cpp/utils/enum.hpp +++ b/include/flecs/addons/cpp/utils/enum.hpp @@ -6,7 +6,7 @@ * and their names. This is used to automatically register enum constants. */ -#ifndef FLECS_CUSTOM_STD_INCLUDE +#ifndef FLECS_NO_STD_INCLUDE #include #include #endif @@ -386,13 +386,15 @@ struct enum_type { template enum_data_impl enum_type::data; +FLECS_API_DEPENDENCY template ::value > = 0> -inline static void init_enum(flecs::world_t *world, flecs::entity_t id) { +inline FLECS_STATIC_IN_HEADER void init_enum(flecs::world_t *world, flecs::entity_t id) { _::enum_type::get().init(world, id); } +FLECS_API_DEPENDENCY template ::value > = 0> -inline static void init_enum(flecs::world_t*, flecs::entity_t) { } +inline FLECS_STATIC_IN_HEADER void init_enum(flecs::world_t*, flecs::entity_t) { } } // namespace _ diff --git a/include/flecs/addons/cpp/utils/utils.hpp b/include/flecs/addons/cpp/utils/utils.hpp index 3a1b188d1..a2399b32e 100644 --- a/include/flecs/addons/cpp/utils/utils.hpp +++ b/include/flecs/addons/cpp/utils/utils.hpp @@ -62,8 +62,8 @@ template inline void free_obj(Ty* _ptr) { #define flecs_static_assert(cond, str) static_assert(cond, str) #endif -FLECS_API inline void* operator new(size_t, flecs::_::placement_new_tag_t, void* _ptr) noexcept { return _ptr; } -FLECS_API inline void operator delete(void*, flecs::_::placement_new_tag_t, void*) noexcept { } +FLECS_API_DEPENDENCY inline void* operator new(size_t, flecs::_::placement_new_tag_t, void* _ptr) noexcept { return _ptr; } +FLECS_API_DEPENDENCY inline void operator delete(void*, flecs::_::placement_new_tag_t, void*) noexcept { } namespace flecs { @@ -146,7 +146,7 @@ struct always_false { } // namespace flecs -#ifndef FLECS_CUSTOM_STD_INCLUDE +#ifndef FLECS_NO_STD_INCLUDE #include #endif #include "array.hpp" diff --git a/module/flecs-module.cpp b/module/flecs-module.cpp index 8fbcf00d9..af9791d5e 100644 --- a/module/flecs-module.cpp +++ b/module/flecs-module.cpp @@ -1,12 +1,11 @@ module; -// TODO: find out why -#define FLECS_CPP_ENUM_REFLECTION_SUPPORT 0 - +// Include flecs, but do not include c++ api, while still including things which need to be available for the c++ api to compile #define FLECS_CPP20_MODULE_HEADER #include "flecs.h" #undef FLECS_CPP20_MODULE_HEADER +// Manually include needed std headers #include #include #include @@ -17,11 +16,20 @@ module; export module flecs; -#define FLECS_CUSTOM_STD_INCLUDE -#define FLECS_CPP20_MODULE_BODY +// Disable std includes +#define FLECS_NO_STD_INCLUDE + +// Include all symbols tagged with FLECS_API #undef FLECS_API #define FLECS_API export + +// Structs must be marked with export to be included in the module #define FLECS_API_STRUCT export +// Definitions that need to be visible, but aren't actually part of the API +#define FLECS_API_DEPENDENCY export +// Disable static declarations in some places +#define FLECS_STATIC_IN_HEADER +// Globals are usually marked static to work in header-only, but in this case we want to include them in the module #define FLECS_API_GLOBAL export #include "flecs/addons/cpp/flecs.hpp"