diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000000000000000000000000000000000..66ca5e848f237ac315bbc9d9563d2e9975028cf0 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "python-cellframe"] + path = python-cellframe + url = https://gitlab.demlabs.net/cellframe/python-cellframe.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 15472c37baa5b37ccb96802d32cb1c0d610f4dce..719087b19e32d8dd09c44d735ed88650471e7693 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,8 @@ set(CMAKE_COLOR_MAKEFILE ON) set(CMAKE_C_STANDARD 11) add_definitions("-fpic") add_definitions("-DDAP_LOG_MT") +add_subdirectory(python-cellframe) +target_compile_options(API_CellFrame PRIVATE "-fpic") if(UNIX) add_definitions("-DDAP_OS_UNIX") @@ -22,7 +24,7 @@ add_library(${PROJECT_NAME} STATIC ${CHAIN_PLUGINS_PYTHON_SRCS} ${CHAIN_PLUGINS_ target_link_libraries(${PROJECT_NAME}) -target_link_libraries(${PROJECT_NAME} dap_core ) +target_link_libraries(${PROJECT_NAME} dap_core API_CellFrame) target_include_directories(${PROJECT_NAME} PUBLIC include/ ) diff --git a/include/dap_chain_plugins.h b/include/dap_chain_plugins.h index fd98781da6dd4b767061bd004bbe623cea78cba8..54837f3136d38c8e224b8c8a68352b526c65de54 100644 --- a/include/dap_chain_plugins.h +++ b/include/dap_chain_plugins.h @@ -6,6 +6,7 @@ #include "dap_file_utils.h" #include "dap_chain_plugins_manifest.h" #include "dap_chain_plugins_list.h" +#include "python-cellframe.h" #ifdef __cplusplus extern "C"{ diff --git a/python-cellframe b/python-cellframe new file mode 160000 index 0000000000000000000000000000000000000000..72321f7659412b5eab817ac1398c8053510ee981 --- /dev/null +++ b/python-cellframe @@ -0,0 +1 @@ +Subproject commit 72321f7659412b5eab817ac1398c8053510ee981 diff --git a/src/dap_chain_plugins.c b/src/dap_chain_plugins.c index ff3654eb6369a5889c8c438314de67bb5bbe4c24..98a8822e77cd30f2b7e3a213245e8bbaba290f36 100644 --- a/src/dap_chain_plugins.c +++ b/src/dap_chain_plugins.c @@ -9,6 +9,7 @@ int dap_chain_plugins_init(dap_config_t *config){ log_it(L_ERROR, "The directory %s was not found.", plugins_root_path); return -1; } + PyImport_AppendInittab("CellFrame", PyInit_libCellFrame); Py_Initialize(); PyObject *sys_module = PyImport_ImportModule("sys"); sys_path = PyObject_GetAttrString(sys_module, "path"); @@ -107,6 +108,7 @@ void dap_chain_plugins_load_plugin(const char *dir_path, const char *name){ if (_PyLong_AsInt(res_int) == 0){ dap_chain_plugins_list_add(module, name); } else { + PyErr_Print(); log_it(L_ERROR, "Code error %i at initialization %s plugin", _PyLong_AsInt(res_int), name); } } else {