diff --git a/CMakeLists.txt b/CMakeLists.txt index 13324c4e316d1601b13574e8c793328254de1b08..1d1256cdaf9a6de74f2720bd75e1629bb660bbaf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ project(cellframe-sdk C) cmake_minimum_required(VERSION 2.8) set(CMAKE_C_STANDARD 11) -set(CELLFRAME_SDK_NATIVE_VERSION "2.8-13") +set(CELLFRAME_SDK_NATIVE_VERSION "2.8-14") add_definitions ("-DCELLFRAME_SDK_VERSION=\"${CELLFRAME_SDK_NATIVE_VERSION}\"") set(DAPSDK_MODULES "") diff --git a/modules/global-db/CMakeLists.txt b/modules/global-db/CMakeLists.txt index 4fc6a463cba31e59b88ebbc50bdeaebc04591671..7ab3deeefb59041b1fb1f1e4a8232c2fa8096f99 100644 --- a/modules/global-db/CMakeLists.txt +++ b/modules/global-db/CMakeLists.txt @@ -1,14 +1,34 @@ cmake_minimum_required(VERSION 3.1) project (dap_chain_global_db C) -file(GLOB DAP_CHAIN_GLOBAL_DB_SRC *.c) -file(GLOB DAP_CHAIN_GLOBAL_DB_HDR include/*.h) +set(DAP_CHAIN_GLOBAL_DB_SRC + dap_chain_global_db.c + dap_chain_global_db_driver.c + dap_chain_global_db_driver_cdb.c + dap_chain_global_db_driver_sqlite.c + dap_chain_global_db_hist.c + dap_chain_global_db_remote.c + ) +set(DAP_CHAIN_GLOBAL_DB_HDR + include/dap_chain_global_db.h + include/dap_chain_global_db_driver.h + include/dap_chain_global_db_driver_cdb.h + include/dap_chain_global_db_driver_sqlite.h + include/dap_chain_global_db_hist.h + include/dap_chain_global_db_remote.h + ) +set(DAP_CHAIN_GLOBAL_DB_LIBS dap_core dap_crypto dap_chain sqlite3 dap_cuttdb json-c) +if(BUILD_WITH_GDB_DRIVER_MDBX) + set(DAP_CHAIN_GLOBAL_DB_SRC ${DAP_CHAIN_GLOBAL_DB_SRC} dap_chain_global_db_driver_mdbx.c) + set(DAP_CHAIN_GLOBAL_DB_HDR ${DAP_CHAIN_GLOBAL_DB_HDR} include/dap_chain_global_db_driver_mdbx.h) + set(DAP_CHAIN_GLOBAL_DB_LIBS ${DAP_CHAIN_GLOBAL_DB_LIBS} mdbx-static) + add_definitions ("-DDAP_CHAIN_GDB_ENGINE_MDBX") +endif() add_library(${PROJECT_NAME} STATIC ${DAP_CHAIN_GLOBAL_DB_SRC} ${DAP_CHAIN_GLOBAL_DB_HDR}) -target_link_libraries(${PROJECT_NAME} dap_core dap_crypto dap_chain sqlite3 dap_cuttdb json-c mdbx-static) -add_definitions ("-DDAP_CHAIN_GDB_ENGINE_MDBX") +target_link_libraries(${PROJECT_NAME} ${DAP_CHAIN_GLOBAL_DB_LIBS}) target_include_directories(dap_chain_global_db INTERFACE .) target_include_directories(${PROJECT_NAME} PUBLIC include) diff --git a/modules/global-db/dap_chain_global_db_driver.c b/modules/global-db/dap_chain_global_db_driver.c index 03562894c74f2a7e5e752e7f731b0b3c06379bcd..0c9309cee710529fc12cfe96d4f0aa10654c5e93 100644 --- a/modules/global-db/dap_chain_global_db_driver.c +++ b/modules/global-db/dap_chain_global_db_driver.c @@ -88,8 +88,10 @@ int dap_db_driver_init(const char *a_driver_name, const char *a_filename_db) l_ret = dap_db_driver_sqlite_init(a_filename_db, &s_drv_callback); else if(!dap_strcmp(s_used_driver, "cdb")) l_ret = dap_db_driver_cdb_init(a_filename_db, &s_drv_callback); +#ifdef DAP_CHAIN_GDB_ENGINE_MDBX else if(!dap_strcmp(s_used_driver, "mdbx")) l_ret = dap_db_driver_mdbx_init(a_filename_db, &s_drv_callback); +#endif else log_it(L_ERROR, "Unknown global_db driver \"%s\"", a_driver_name); #ifdef USE_WRITE_BUFFER