From 90ed92a753d3a3920570529acf2921e9d0c8ea48 Mon Sep 17 00:00:00 2001 From: "alexey.stratulat" <alexey.stratulat@demlabs.net> Date: Tue, 3 Mar 2020 23:17:09 +0700 Subject: [PATCH] [+] Added link to submodule libdap-chain-plugins-python. And calling the init / deinit function of this submodule. Added support key -DSUPPORT_PYTHON_PLUGINS in the Cmake file for build with support for Python plugins. --- CMakeLists.txt | 9 +++++++++ sources/main.c | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1693f1bfb..4a8bad2f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -360,6 +360,15 @@ if(UNIX) dap_core ) + if (SUPPORT_PYTHON_PLUGINS) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDAP_SUPPORT_PYTHON_PLUGINS") + message("Build with support python plugins") + set(Python_ADDITIONAL_VERSION 3.7 3.6 3.5 3.4) + find_package(PythonLibs REQUIRED) + set(NODE_LIBRARIES ${NODE_LIBRARIES} ${PYTHON_LIBRARIES} dap_chain_plugins_python) + include_directories(${PYTHON_INCLUDE_DIR} include/) + endif() + if(ANDROID ) set(ALL_LIBRARIES ${NODE_LIBRARIES} ${NODE_CLI_LIBRARIES} ${NODE_TOOL_LIBRARIES} log) diff --git a/sources/main.c b/sources/main.c index a0ffa02c9..952fca30d 100755 --- a/sources/main.c +++ b/sources/main.c @@ -110,6 +110,10 @@ #include "dap_defines.h" #include "dap_file_utils.h" +#ifdef DAP_SUPPORT_PYTHON_PLUGINSv + #include "dap_chain_plugins.h" +#endif + #define ENC_HTTP_URL "/enc_init" #define STREAM_CTL_URL "/stream_ctl" @@ -439,6 +443,12 @@ int main( int argc, const char **argv ) #endif #endif + //Init python plugins + #ifdef DAP_SUPPORT_PYTHON_PLUGINS + log_it(L_NOTICE, "Loading python plugins"); + dap_chain_plugins_init(g_config); + #endif + // Endless loop for server's requests processing rc = dap_server_loop(l_server); // After loop exit actions @@ -448,6 +458,9 @@ int main( int argc, const char **argv ) failure: + #ifdef DAP_SUPPORT_PYTHON_PLUGINS + dap_chain_plugins_deinit(); + #endif dap_stream_deinit(); dap_stream_ctl_deinit(); dap_http_folder_deinit(); -- GitLab