From 52da6c0214f829df6119a4d85cfca9f7804072d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 14 Sep 2017 08:52:45 +0300 Subject: [PATCH] MXS-1413: Move cdc_connector into a subdirectory Moved the cdc_connector into a subdirectory to distinct it from the other test sources. --- maxscale-system-test/CMakeLists.txt | 10 +++++++--- .../cdc_connector/CMakeLists.txt | 8 ++++++++ .../{ => cdc_connector}/cdc_connector.cpp | 2 ++ .../{ => cdc_connector}/cdc_connector.h | 0 .../cdc_connector/cmake/BuildJansson.cmake | 20 +++++++++++++++++++ .../cdc_datatypes/cdc_datatypes.cpp | 2 +- 6 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 maxscale-system-test/cdc_connector/CMakeLists.txt rename maxscale-system-test/{ => cdc_connector}/cdc_connector.cpp (99%) rename maxscale-system-test/{ => cdc_connector}/cdc_connector.h (100%) create mode 100644 maxscale-system-test/cdc_connector/cmake/BuildJansson.cmake diff --git a/maxscale-system-test/CMakeLists.txt b/maxscale-system-test/CMakeLists.txt index 04e834d16..0d27b07fb 100644 --- a/maxscale-system-test/CMakeLists.txt +++ b/maxscale-system-test/CMakeLists.txt @@ -45,15 +45,19 @@ else() message(WARNING "Java not found, Java based tests are not run.") endif() +# Build the CDC connector +add_subdirectory(cdc_connector) +include_directories(cdc_connector) + # The core library add_library(testcore SHARED testconnections.cpp mariadb_nodes.cpp mariadb_func.cpp get_com_select_insert.cpp maxadmin_operations.cpp big_transaction.cpp sql_t1.cpp test_binlog_fnc.cpp get_my_ip.cpp big_load.cpp get_com_select_insert.cpp different_size.cpp fw_copy_rules maxinfo_func.cpp config_operations.cpp rds_vpc.cpp execute_cmd.cpp - blob_test.cpp cdc_connector.cpp) -target_link_libraries(testcore ${MYSQL_CLIENT} z crypt nsl m pthread ssl crypto dl rt jansson) + blob_test.cpp) +target_link_libraries(testcore ${MYSQL_CLIENT} z crypt nsl m pthread ssl crypto dl rt cdc_connector) install(TARGETS testcore DESTINATION system-test) -add_dependencies(testcore connector-c) +add_dependencies(testcore connector-c cdc_connector) # Tool used to check backend state add_test_executable_notest(check_backend.cpp check_backend check_backend LABELS CONFIG) diff --git a/maxscale-system-test/cdc_connector/CMakeLists.txt b/maxscale-system-test/cdc_connector/CMakeLists.txt new file mode 100644 index 000000000..6cf309e9e --- /dev/null +++ b/maxscale-system-test/cdc_connector/CMakeLists.txt @@ -0,0 +1,8 @@ +include(cmake/BuildJansson.cmake) + +include_directories(${JANSSON_INCLUDE_DIR}) +add_library(cdc_connector STATIC cdc_connector.cpp) +target_link_libraries(cdc_connector ${JANSSON_LIBRARIES}) +add_dependencies(cdc_connector jansson) +install(TARGETS cdc_connector DESTINATION lib) +install(FILES cdc_connector.h DESTINATION include) diff --git a/maxscale-system-test/cdc_connector.cpp b/maxscale-system-test/cdc_connector/cdc_connector.cpp similarity index 99% rename from maxscale-system-test/cdc_connector.cpp rename to maxscale-system-test/cdc_connector/cdc_connector.cpp index b811c2297..b6eee5d5b 100644 --- a/maxscale-system-test/cdc_connector.cpp +++ b/maxscale-system-test/cdc_connector/cdc_connector.cpp @@ -1,4 +1,5 @@ #include "cdc_connector.h" + #include #include #include @@ -6,6 +7,7 @@ #include #include #include +#include #define CDC_CONNECTOR_VERSION "1.0.0" diff --git a/maxscale-system-test/cdc_connector.h b/maxscale-system-test/cdc_connector/cdc_connector.h similarity index 100% rename from maxscale-system-test/cdc_connector.h rename to maxscale-system-test/cdc_connector/cdc_connector.h diff --git a/maxscale-system-test/cdc_connector/cmake/BuildJansson.cmake b/maxscale-system-test/cdc_connector/cmake/BuildJansson.cmake new file mode 100644 index 000000000..78e038a01 --- /dev/null +++ b/maxscale-system-test/cdc_connector/cmake/BuildJansson.cmake @@ -0,0 +1,20 @@ +# If the Jansson library is not found, download it and build it from source. + +set(JANSSON_REPO "https://github.com/akheron/jansson.git" CACHE STRING "Jansson Git repository") + +# Release 2.9 of Jansson +set(JANSSON_TAG "v2.9" CACHE STRING "Jansson Git tag") + +ExternalProject_Add(jansson + GIT_REPOSITORY ${JANSSON_REPO} + GIT_TAG ${JANSSON_TAG} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/jansson/install -DCMAKE_C_FLAGS=-fPIC -DJANSSON_BUILD_DOCS=OFF + BINARY_DIR ${CMAKE_BINARY_DIR}/jansson + INSTALL_DIR ${CMAKE_BINARY_DIR}/jansson/install + UPDATE_COMMAND "") + +set(JANSSON_FOUND TRUE CACHE INTERNAL "") +set(JANSSON_STATIC_FOUND TRUE CACHE INTERNAL "") +set(JANSSON_INCLUDE_DIR ${CMAKE_BINARY_DIR}/jansson/install/include CACHE INTERNAL "") +set(JANSSON_STATIC_LIBRARIES ${CMAKE_BINARY_DIR}/jansson/install/lib/libjansson.a CACHE INTERNAL "") +set(JANSSON_LIBRARIES ${JANSSON_STATIC_LIBRARIES} CACHE INTERNAL "") diff --git a/maxscale-system-test/cdc_datatypes/cdc_datatypes.cpp b/maxscale-system-test/cdc_datatypes/cdc_datatypes.cpp index f9a29f379..7496c429f 100644 --- a/maxscale-system-test/cdc_datatypes/cdc_datatypes.cpp +++ b/maxscale-system-test/cdc_datatypes/cdc_datatypes.cpp @@ -3,7 +3,7 @@ */ #include "../testconnections.h" -#include "../cdc_connector.h" +#include #include "cdc_result.h" #include #include