From 34c5a0daad5606ba2949a7ad7b2f41dd868338bf Mon Sep 17 00:00:00 2001 From: Sander Mertens Date: Thu, 28 Sep 2023 20:21:26 -0700 Subject: [PATCH] Fix build issue with custom build specifying FLECS_MONITOR and FLECS_REST --- flecs.c | 6 ++--- src/addons/monitor.c | 2 +- src/storage/table.c | 4 +--- .../c/monitor_rest/include/monitor_rest.h | 16 +++++++++++++ .../include/monitor_rest/bake_config.h | 24 +++++++++++++++++++ .../custom_builds/c/monitor_rest/project.json | 14 +++++++++++ test/custom_builds/c/monitor_rest/src/main.c | 10 ++++++++ 7 files changed, 68 insertions(+), 8 deletions(-) create mode 100644 test/custom_builds/c/monitor_rest/include/monitor_rest.h create mode 100644 test/custom_builds/c/monitor_rest/include/monitor_rest/bake_config.h create mode 100644 test/custom_builds/c/monitor_rest/project.json create mode 100644 test/custom_builds/c/monitor_rest/src/main.c diff --git a/flecs.c b/flecs.c index c67a11b2eb..15044a87b2 100644 --- a/flecs.c +++ b/flecs.c @@ -29937,7 +29937,7 @@ void FlecsMonitorImport( ECS_COMPONENT_DEFINE(world, EcsWorldSummary); -#ifdef FLECS_META +#if defined(FLECS_META) && defined(FLECS_UNITS) ecs_struct(world, { .entity = ecs_id(EcsWorldSummary), .members = { @@ -43585,7 +43585,7 @@ void flecs_table_move_bitset_columns( /* Grow table column. When a column needs to be reallocated this function takes * care of correctly invoking ctor/move/dtor hooks. */ static -void* flecs_table_grow_column( +void flecs_table_grow_column( ecs_world_t *world, ecs_column_t *column, int32_t to_add, @@ -43650,8 +43650,6 @@ void* flecs_table_grow_column( } ecs_assert(column->data.size == dst_size, ECS_INTERNAL_ERROR, NULL); - - return result; } /* Grow all data structures in a table */ diff --git a/src/addons/monitor.c b/src/addons/monitor.c index 44f28e6590..08058589e1 100644 --- a/src/addons/monitor.c +++ b/src/addons/monitor.c @@ -328,7 +328,7 @@ void FlecsMonitorImport( ECS_COMPONENT_DEFINE(world, EcsWorldSummary); -#ifdef FLECS_META +#if defined(FLECS_META) && defined(FLECS_UNITS) ecs_struct(world, { .entity = ecs_id(EcsWorldSummary), .members = { diff --git a/src/storage/table.c b/src/storage/table.c index bc31881ff6..cce13549f1 100644 --- a/src/storage/table.c +++ b/src/storage/table.c @@ -1317,7 +1317,7 @@ void flecs_table_move_bitset_columns( /* Grow table column. When a column needs to be reallocated this function takes * care of correctly invoking ctor/move/dtor hooks. */ static -void* flecs_table_grow_column( +void flecs_table_grow_column( ecs_world_t *world, ecs_column_t *column, int32_t to_add, @@ -1382,8 +1382,6 @@ void* flecs_table_grow_column( } ecs_assert(column->data.size == dst_size, ECS_INTERNAL_ERROR, NULL); - - return result; } /* Grow all data structures in a table */ diff --git a/test/custom_builds/c/monitor_rest/include/monitor_rest.h b/test/custom_builds/c/monitor_rest/include/monitor_rest.h new file mode 100644 index 0000000000..a1f1958e75 --- /dev/null +++ b/test/custom_builds/c/monitor_rest/include/monitor_rest.h @@ -0,0 +1,16 @@ +#ifndef MONITOR_REST_H +#define MONITOR_REST_H + +/* This generated file contains includes for project dependencies */ +#include "monitor_rest/bake_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/test/custom_builds/c/monitor_rest/include/monitor_rest/bake_config.h b/test/custom_builds/c/monitor_rest/include/monitor_rest/bake_config.h new file mode 100644 index 0000000000..ee04f216ad --- /dev/null +++ b/test/custom_builds/c/monitor_rest/include/monitor_rest/bake_config.h @@ -0,0 +1,24 @@ +/* + ) + (.) + .|. + | | + _.--| |--._ + .-'; ;`-'& ; `&. + \ & ; & &_/ + |"""---...---"""| + \ | | | | | | | / + `---.|.|.|.---' + + * This file is generated by bake.lang.c for your convenience. Headers of + * dependencies will automatically show up in this file. Include bake_config.h + * in your main project file. Do not edit! */ + +#ifndef MONITOR_REST_BAKE_CONFIG_H +#define MONITOR_REST_BAKE_CONFIG_H + +/* Headers of public dependencies */ +#include "../../deps/flecs.h" + +#endif + diff --git a/test/custom_builds/c/monitor_rest/project.json b/test/custom_builds/c/monitor_rest/project.json new file mode 100644 index 0000000000..e4e3b08b3c --- /dev/null +++ b/test/custom_builds/c/monitor_rest/project.json @@ -0,0 +1,14 @@ +{ + "id": "monitor_rest", + "type": "application", + "value": { + "public": false, + "use": [ + "flecs" + ], + "standalone": true + }, + "lang.c": { + "defines": ["FLECS_CUSTOM_BUILD", "FLECS_MONITOR", "FLECS_REST", "FLECS_LOG"] + } +} \ No newline at end of file diff --git a/test/custom_builds/c/monitor_rest/src/main.c b/test/custom_builds/c/monitor_rest/src/main.c new file mode 100644 index 0000000000..2e0381e45e --- /dev/null +++ b/test/custom_builds/c/monitor_rest/src/main.c @@ -0,0 +1,10 @@ +#include + +int main(int argc, char *argv[]) { + ecs_world_t *world = ecs_init_w_args(argc, argv); + + ECS_IMPORT(world, FlecsMonitor); + ECS_IMPORT(world, FlecsRest); + + return ecs_fini(world); +}