build: make datalayers optional

This commit is contained in:
hxy7yx
2026-08-24 02:09:57 -07:00
parent fe39b9fab2
commit f2c2a51f5c
4 changed files with 38 additions and 6 deletions
+19 -2
View File
@@ -9,6 +9,11 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Datalayers is no longer part of the default NeuronEX package. Keep the
# implementation available for standalone/legacy builds, but avoid pulling in
# Apache Arrow unless it is explicitly requested.
option(ENABLE_DATALAYERS "Build the Datalayers northbound plugin" OFF)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif()
@@ -80,6 +85,9 @@ set(PERSIST_SOURCES
src/persist/json/persist_json_plugin.c)
aux_source_directory(src/parser NEURON_SRC_PARSE)
aux_source_directory(src/otel NEURON_SRC_OTEL)
if(NOT ENABLE_DATALAYERS)
list(FILTER NEURON_SRC_PARSE EXCLUDE REGEX "neu_json_datalayers\\.c$")
endif()
set(NEURON_BASE_SOURCES
src/base/tag.c
src/base/neu_plugin_common.c
@@ -174,12 +182,15 @@ set(NEURON_SOURCES
plugins/restful/cid_handle.c
plugins/restful/ede_handle.c
plugins/restful/tpy_handle.c
plugins/restful/datalayers_handle.c
plugins/restful/rest.c
plugins/restful/user.c
plugins/restful/simulator_handle.c
simulator/modbus_tcp_simulator.c)
if(ENABLE_DATALAYERS)
list(APPEND NEURON_SOURCES plugins/restful/datalayers_handle.c)
endif()
set(CMAKE_BUILD_RPATH ./)
add_executable(neuron)
target_sources(neuron PRIVATE ${NEURON_SOURCES})
@@ -187,6 +198,10 @@ target_include_directories(neuron PRIVATE include/neuron src plugins)
target_link_libraries(neuron dl neuron-base sqlite3 -lm xml2)
target_link_options(neuron PRIVATE "LINKER:--dynamic-list-data")
if(ENABLE_DATALAYERS)
target_compile_definitions(neuron PRIVATE NEU_ENABLE_DATALAYERS)
endif()
#copy file for run
file(COPY ${CMAKE_SOURCE_DIR}/zlog.conf DESTINATION ${CMAKE_BINARY_DIR}/config)
file(COPY ${CMAKE_SOURCE_DIR}/dev.conf DESTINATION ${CMAKE_BINARY_DIR}/config)
@@ -202,7 +217,9 @@ add_subdirectory(plugins/mqtt)
add_subdirectory(plugins/ekuiper)
add_subdirectory(plugins/file)
add_subdirectory(plugins/monitor)
add_subdirectory(plugins/datalayers)
if(ENABLE_DATALAYERS)
add_subdirectory(plugins/datalayers)
endif()
add_subdirectory(plugins/kafka)
add_subdirectory(simulator)
+9 -4
View File
@@ -613,11 +613,16 @@ static int unsub_app(context_t *ctx, neu_resp_subscribe_info_t *info);
static inline bool is_default_app_node(const char *name, const char *plugin)
{
return (0 == strcmp("DataStorage", name) &&
0 == strcmp("Datalayers", plugin)) ||
(0 == strcmp("DataProcessing", name) &&
0 == strcmp("eKuiper", plugin)) ||
bool is_default = (0 == strcmp("DataProcessing", name) &&
0 == strcmp("eKuiper", plugin)) ||
(0 == strcmp("monitor", name) && 0 == strcmp("Monitor", plugin));
#ifdef NEU_ENABLE_DATALAYERS
is_default = is_default ||
(0 == strcmp("DataStorage", name) && 0 == strcmp("Datalayers", plugin));
#endif
return is_default;
}
static void get_apps_context_next(context_t *ctx, neu_reqresp_type_e type,
+6
View File
@@ -27,7 +27,9 @@
#include "adapter_handle.h"
#include "cert_handle.h"
#include "cid_handle.h"
#ifdef NEU_ENABLE_DATALAYERS
#include "datalayers_handle.h"
#endif
#include "datatag_handle.h"
#include "ede_handle.h"
#include "global_config_handle.h"
@@ -152,6 +154,7 @@ static struct neu_http_handler cors_handler[] = {
{
.url = "/api/v2/users",
},
#ifdef NEU_ENABLE_DATALAYERS
{
.url = "/api/v2/datalayers/group",
},
@@ -161,6 +164,7 @@ static struct neu_http_handler cors_handler[] = {
{
.url = "/api/v2/datalayers/tag",
},
#endif
{
.url = "/api/v2/export/db",
},
@@ -591,6 +595,7 @@ static struct neu_http_handler rest_handlers[] = {
.url = "/api/v2/users",
.value.handler = handle_delete_user,
},
#ifdef NEU_ENABLE_DATALAYERS
{
.method = NEU_HTTP_METHOD_GET,
.type = NEU_HTTP_HANDLER_FUNCTION,
@@ -609,6 +614,7 @@ static struct neu_http_handler rest_handlers[] = {
.url = "/api/v2/datalayers/tag",
.value.handler = handle_datalayers_get_tag,
},
#endif
{
.method = NEU_HTTP_METHOD_GET,
.type = NEU_HTTP_HANDLER_FUNCTION,
+4
View File
@@ -27,7 +27,9 @@
#include "adapter_handle.h"
#include "argparse.h"
#include "cert_handle.h"
#ifdef NEU_ENABLE_DATALAYERS
#include "datalayers_handle.h"
#endif
#include "datatag_handle.h"
#include "define.h"
#include "global_config_handle.h"
@@ -300,6 +302,7 @@ static int dashb_plugin_request(neu_plugin_t * plugin,
neu_otel_scope_set_status_code2(scope, NEU_OTEL_STATUS_OK, 0);
}
break;
#ifdef NEU_ENABLE_DATALAYERS
case NEU_RESP_GET_DATALAYERS_GROUPS:
handle_datalayers_get_groups_resp(
header->ctx, (neu_resp_get_subscribe_group_t *) data);
@@ -321,6 +324,7 @@ static int dashb_plugin_request(neu_plugin_t * plugin,
neu_otel_scope_set_status_code2(scope, NEU_OTEL_STATUS_OK, 0);
}
break;
#endif
case NEU_RESP_GET_DRIVER_SUBSCRIBE_GROUP:
handle_grp_get_subscribes_resp(header->ctx,
(neu_resp_get_subscribe_group_t *) data);