From 1f241a5ed1ab939b15c84acbbf1665635bd75a8f Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Fri, 22 Jan 2016 13:24:49 +0200 Subject: [PATCH] Rearrange libraries and build files. This is the first change in an attempt to arrange the linking so that more errors are detected at link-time. - All files in server/core but for gateway.c are linked to one shared library called maxscale-common. - The files log_manager/log_manager.cc and utils/skygw_utils.cc are built into maxscale-common as well. - MaxScale itself consists now only of gateway.c and is linked with maxscale-common. - All plugins link with maxscale-common. - All executables link in addition with {EMBEDDED_LIB}. After this change, the change (MXS-517) where query_classifier is the only component that uses ${EMBEDDED_LIB} and the rest mysqlclient can be made much cleaner. After a few additional steps, all shared libraries can be linked with the linker flags "-Wl,-z,defs", which directs the linker to resolve all symbols. That will require that all shared libraries list all the libraries they need, but will at the same time ensure that any missing symbols are detected at link-time and not at run-time. --- CMakeLists.txt | 2 - log_manager/CMakeLists.txt | 2 + query_classifier/CMakeLists.txt | 1 + query_classifier/test/CMakeLists.txt | 2 +- .../test/canonical_tests/CMakeLists.txt | 4 +- server/core/CMakeLists.txt | 36 ++++---- server/core/test/CMakeLists.txt | 84 +++++++++---------- server/modules/filter/CMakeLists.txt | 20 ++--- server/modules/filter/hint/CMakeLists.txt | 2 +- server/modules/filter/test/CMakeLists.txt | 4 +- server/modules/monitor/CMakeLists.txt | 8 +- server/modules/protocol/CMakeLists.txt | 14 ++-- server/modules/routing/CMakeLists.txt | 8 +- server/modules/routing/binlog/CMakeLists.txt | 22 +---- .../routing/binlog/test/CMakeLists.txt | 2 +- server/modules/routing/maxinfo/CMakeLists.txt | 2 +- .../routing/readwritesplit/CMakeLists.txt | 2 +- .../routing/schemarouter/CMakeLists.txt | 4 +- utils/CMakeLists.txt | 2 + 19 files changed, 101 insertions(+), 120 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f0fd0c65f..b975c62db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,8 +174,6 @@ include_directories(${CMAKE_BINARY_DIR}/server/include) include_directories(${CURL_INCLUDE_DIRS}) add_subdirectory(plugins) -add_subdirectory(utils) -add_subdirectory(log_manager) add_subdirectory(query_classifier) add_subdirectory(server) if(NOT WITHOUT_MAXADMIN) diff --git a/log_manager/CMakeLists.txt b/log_manager/CMakeLists.txt index 6448e2b66..4a5e53970 100644 --- a/log_manager/CMakeLists.txt +++ b/log_manager/CMakeLists.txt @@ -1,3 +1,5 @@ +# NOTE: This is currently not used. log_manager.cc is built directly into maxscale-common. +# To be removed completely. if(LOG_DEBUG) add_definitions(-DSS_LOG_DEBUG) endif() diff --git a/query_classifier/CMakeLists.txt b/query_classifier/CMakeLists.txt index bcd3293f0..e934a3b69 100644 --- a/query_classifier/CMakeLists.txt +++ b/query_classifier/CMakeLists.txt @@ -1,4 +1,5 @@ add_library(query_classifier SHARED query_classifier.cc) +target_link_libraries(query_classifier maxscale-common) set_target_properties(query_classifier PROPERTIES VERSION "1.0.0") install(TARGETS query_classifier COMPONENT lib DESTINATION ${MAXSCALE_LIBDIR}) if(BUILD_TESTS) diff --git a/query_classifier/test/CMakeLists.txt b/query_classifier/test/CMakeLists.txt index 66c56eca7..61b5702f1 100644 --- a/query_classifier/test/CMakeLists.txt +++ b/query_classifier/test/CMakeLists.txt @@ -10,5 +10,5 @@ endif() add_subdirectory(canonical_tests) add_executable(classify classify.c) -target_link_libraries(classify query_classifier ${CURL_LIBRARIES} utils log_manager pthread ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} ssl aio rt crypt dl crypto inih z m stdc++ fullcore) +target_link_libraries(classify query_classifier maxscale-common) add_test(Internal-TestQueryClassifier classify ${CMAKE_CURRENT_SOURCE_DIR}/input.sql ${CMAKE_CURRENT_SOURCE_DIR}/expected.sql) diff --git a/query_classifier/test/canonical_tests/CMakeLists.txt b/query_classifier/test/canonical_tests/CMakeLists.txt index 8295893ef..dc6ed111d 100644 --- a/query_classifier/test/canonical_tests/CMakeLists.txt +++ b/query_classifier/test/canonical_tests/CMakeLists.txt @@ -7,8 +7,8 @@ else() file(COPY ${ERRMSG} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) endif() endif() -add_executable(canonizer canonizer.c ${CMAKE_SOURCE_DIR}/server/core/random_jkiss.c) -target_link_libraries(canonizer ${PCRE2_LIBRARIES} utils pthread query_classifier z dl ssl aio crypt crypto rt m ${EMBEDDED_LIB} fullcore stdc++) +add_executable(canonizer canonizer.c) +target_link_libraries(canonizer query_classifier maxscale-common) add_test(NAME Internal-CanonicalQuery COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/canontest.sh ${CMAKE_CURRENT_BINARY_DIR}/test.log ${CMAKE_CURRENT_SOURCE_DIR}/input.sql diff --git a/server/core/CMakeLists.txt b/server/core/CMakeLists.txt index 9f29ba741..7d7a03630 100644 --- a/server/core/CMakeLists.txt +++ b/server/core/CMakeLists.txt @@ -1,19 +1,17 @@ -if(BUILD_TESTS OR BUILD_TOOLS) - add_library(fullcore STATIC random_jkiss.c adminusers.c atomic.c config.c buffer.c dbusers.c dcb.c filter.c gwbitmask.c gw_utils.c hashtable.c hint.c housekeeper.c load_utils.c memlog.c modutil.c monitor.c poll.c resultset.c secrets.c server.c service.c session.c spinlock.c thread.c users.c utils.c gwdirs.c externcmd.c maxscale_pcre2.c) - if(WITH_JEMALLOC) - target_link_libraries(fullcore ${JEMALLOC_LIBRARIES}) - elseif(WITH_TCMALLOC) - target_link_libraries(fullcore ${TCMALLOC_LIBRARIES}) - endif() - target_link_libraries(fullcore ${CURL_LIBRARIES} utils ${PCRE2_LIBRARIES} log_manager pthread ${LZMA_LINK_FLAGS} ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} ssl aio rt crypt dl crypto inih z m stdc++) - add_dependencies(fullcore pcre2) +add_library(maxscale-common SHARED adminusers.c atomic.c buffer.c config.c dbusers.c dcb.c filter.c externcmd.c gwbitmask.c gwdirs.c gw_utils.c hashtable.c hint.c housekeeper.c load_utils.c maxscale_pcre2.c memlog.c modutil.c monitor.c poll.c random_jkiss.c resultset.c secrets.c server.c service.c session.c spinlock.c thread.c users.c utils.c ${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc ${CMAKE_SOURCE_DIR}/utils/skygw_utils.cc) + +target_link_libraries(maxscale-common ${EMBEDDED_LIB} ${LZMA_LINK_FLAGS} ${PCRE2_LIBRARIES} ${PCRE_LINK_FLAGS} ${CURL_LIBRARIES} ssl aio pthread crypt dl crypto inih z rt m stdc++) + +if(WITH_JEMALLOC) + target_link_libraries(maxscale-common ${JEMALLOC_LIBRARIES}) +elseif(WITH_TCMALLOC) + target_link_libraries(maxscale-common ${TCMALLOC_LIBRARIES}) endif() -add_executable(maxscale atomic.c buffer.c spinlock.c gateway.c - gw_utils.c utils.c dcb.c load_utils.c session.c service.c server.c - poll.c config.c users.c hashtable.c dbusers.c thread.c gwbitmask.c - monitor.c adminusers.c secrets.c filter.c modutil.c hint.c - housekeeper.c memlog.c resultset.c gwdirs.c externcmd.c random_jkiss.c maxscale_pcre2.c) +add_dependencies(maxscale-common pcre2) +install(TARGETS maxscale-common DESTINATION ${MAXSCALE_LIBDIR}) + +add_executable(maxscale gateway.c) add_dependencies(maxscale pcre2) if(WITH_JEMALLOC) @@ -22,15 +20,15 @@ elseif(WITH_TCMALLOC) target_link_libraries(maxscale ${TCMALLOC_LIBRARIES}) endif() -target_link_libraries(maxscale ${LZMA_LINK_FLAGS} ${PCRE2_LIBRARIES} ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} ${CURL_LIBRARIES} log_manager utils ssl aio pthread crypt dl crypto inih z rt m stdc++) +target_link_libraries(maxscale maxscale-common) install(TARGETS maxscale DESTINATION ${MAXSCALE_BINDIR}) -add_executable(maxkeys maxkeys.c spinlock.c secrets.c utils.c gwdirs.c random_jkiss.c ${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc) -target_link_libraries(maxkeys utils pthread crypt crypto ${PCRE2_LIBRARIES}) +add_executable(maxkeys maxkeys.c) +target_link_libraries(maxkeys maxscale-common) install(TARGETS maxkeys DESTINATION ${MAXSCALE_BINDIR}) -add_executable(maxpasswd maxpasswd.c spinlock.c secrets.c utils.c gwdirs.c random_jkiss.c ${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc) -target_link_libraries(maxpasswd utils pthread crypt crypto ${PCRE2_LIBRARIES}) +add_executable(maxpasswd maxpasswd.c) +target_link_libraries(maxpasswd maxscale-common) install(TARGETS maxpasswd DESTINATION ${MAXSCALE_BINDIR}) if(BUILD_TESTS) diff --git a/server/core/test/CMakeLists.txt b/server/core/test/CMakeLists.txt index 149a38f09..02c48dd76 100644 --- a/server/core/test/CMakeLists.txt +++ b/server/core/test/CMakeLists.txt @@ -1,50 +1,50 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${ERRMSG} ${CMAKE_CURRENT_BINARY_DIR}) -add_executable(test_mysql_users test_mysql_users.c) -add_executable(test_hash testhash.c ../random_jkiss.c) -add_executable(test_hint testhint.c ../random_jkiss.c) -add_executable(test_spinlock testspinlock.c ../random_jkiss.c) -add_executable(test_filter testfilter.c) -add_executable(test_buffer testbuffer.c ../random_jkiss.c) -add_executable(test_dcb testdcb.c) -add_executable(test_modutil testmodutil.c) -add_executable(test_poll testpoll.c) -add_executable(test_service testservice.c) -add_executable(test_server testserver.c) -add_executable(test_users testusers.c) add_executable(test_adminusers testadminusers.c) -add_executable(testmemlog testmemlog.c ../random_jkiss.c) +add_executable(test_buffer testbuffer.c) +add_executable(test_dcb testdcb.c) +add_executable(test_filter testfilter.c) +add_executable(test_hash testhash.c) +add_executable(test_hint testhint.c) +add_executable(test_modutil testmodutil.c) +add_executable(test_mysql_users test_mysql_users.c) +add_executable(test_poll testpoll.c) +add_executable(test_server testserver.c) +add_executable(test_service testservice.c) +add_executable(test_spinlock testspinlock.c) +add_executable(test_users testusers.c) add_executable(testfeedback testfeedback.c) -add_executable(testmaxscalepcre2 testmaxscalepcre2.c ../random_jkiss.c) -target_link_libraries(test_mysql_users MySQLClient fullcore) -target_link_libraries(test_hash fullcore log_manager) -target_link_libraries(test_hint fullcore log_manager) -target_link_libraries(test_spinlock fullcore log_manager) -target_link_libraries(test_filter fullcore) -target_link_libraries(test_buffer fullcore log_manager) -target_link_libraries(test_dcb fullcore) -target_link_libraries(test_modutil fullcore utils log_manager) -target_link_libraries(test_poll fullcore) -target_link_libraries(test_service fullcore) -target_link_libraries(test_server fullcore) -target_link_libraries(test_users fullcore) -target_link_libraries(test_adminusers fullcore) -target_link_libraries(testmemlog fullcore log_manager) -target_link_libraries(testfeedback fullcore) -target_link_libraries(testmaxscalepcre2 fullcore log_manager) -add_test(Internal-TestMySQLUsers test_mysql_users) -add_test(Internal-TestHash test_hash) -add_test(Internal-TestHint test_hint) -add_test(Internal-TestSpinlock test_spinlock) -add_test(Internal-TestFilter test_filter) +add_executable(testmaxscalepcre2 testmaxscalepcre2.c) +add_executable(testmemlog testmemlog.c) +target_link_libraries(test_adminusers maxscale-common) +target_link_libraries(test_buffer maxscale-common) +target_link_libraries(test_dcb maxscale-common) +target_link_libraries(test_filter maxscale-common) +target_link_libraries(test_hash maxscale-common ) +target_link_libraries(test_hint maxscale-common ) +target_link_libraries(test_modutil maxscale-common) +target_link_libraries(test_mysql_users MySQLClient maxscale-common) +target_link_libraries(test_poll maxscale-common) +target_link_libraries(test_server maxscale-common) +target_link_libraries(test_service maxscale-common) +target_link_libraries(test_spinlock maxscale-common ) +target_link_libraries(test_users maxscale-common) +target_link_libraries(testfeedback maxscale-common) +target_link_libraries(testmaxscalepcre2 maxscale-common ) +target_link_libraries(testmemlog maxscale-common ) +add_test(Internal-TestAdminUsers test_adminusers) add_test(Internal-TestBuffer test_buffer) add_test(Internal-TestDCB test_dcb) -add_test(Internal-TestModutil test_modutil) -add_test(Internal-TestPoll test_poll) -add_test(Internal-TestService test_service) -add_test(Internal-TestServer test_server) -add_test(Internal-TestUsers test_users) -add_test(Internal-TestAdminUsers test_adminusers) -add_test(Internal-TestMemlog testmemlog) +add_test(Internal-TestFilter test_filter) +add_test(Internal-TestHash test_hash) +add_test(Internal-TestHint test_hint) add_test(Internal-TestMaxScalePCRE2 testmaxscalepcre2) +add_test(Internal-TestMemlog testmemlog) +add_test(Internal-TestModutil test_modutil) +add_test(Internal-TestMySQLUsers test_mysql_users) +add_test(Internal-TestPoll test_poll) +add_test(Internal-TestServer test_server) +add_test(Internal-TestService test_service) +add_test(Internal-TestSpinlock test_spinlock) +add_test(Internal-TestUsers test_users) add_test(TestFeedback testfeedback) set_tests_properties(TestFeedback PROPERTIES TIMEOUT 30) diff --git a/server/modules/filter/CMakeLists.txt b/server/modules/filter/CMakeLists.txt index a30aecbff..9a7d15260 100644 --- a/server/modules/filter/CMakeLists.txt +++ b/server/modules/filter/CMakeLists.txt @@ -2,7 +2,7 @@ if(BUILD_RABBITMQ) if(RABBITMQ_FOUND) include_directories(${RABBITMQ_HEADERS}) add_library(mqfilter SHARED mqfilter.c) - target_link_libraries(mqfilter query_classifier log_manager ${RABBITMQ_LIBRARIES}) + target_link_libraries(mqfilter query_classifier maxscale-common ${RABBITMQ_LIBRARIES}) add_dependencies(mqfilter pcre2) install(TARGETS mqfilter DESTINATION ${MAXSCALE_LIBDIR}) else() @@ -11,45 +11,45 @@ if(BUILD_RABBITMQ) endif() add_library(regexfilter SHARED regexfilter.c) -target_link_libraries(regexfilter log_manager) +target_link_libraries(regexfilter maxscale-common) add_dependencies(regexfilter pcre2) set_target_properties(regexfilter PROPERTIES VERSION "1.1.0") install(TARGETS regexfilter DESTINATION ${MAXSCALE_LIBDIR}) add_library(testfilter SHARED testfilter.c) -target_link_libraries(testfilter log_manager) +target_link_libraries(testfilter maxscale-common) set_target_properties(testfilter PROPERTIES VERSION "1.0.0") install(TARGETS testfilter DESTINATION ${MAXSCALE_LIBDIR}) add_library(qlafilter SHARED qlafilter.c) -target_link_libraries(qlafilter log_manager) +target_link_libraries(qlafilter maxscale-common) set_target_properties(qlafilter PROPERTIES VERSION "1.1.1") install(TARGETS qlafilter DESTINATION ${MAXSCALE_LIBDIR}) add_library(tee SHARED tee.c) -target_link_libraries(tee log_manager) +target_link_libraries(tee maxscale-common) set_target_properties(tee PROPERTIES VERSION "1.0.0") install(TARGETS tee DESTINATION ${MAXSCALE_LIBDIR}) add_library(topfilter SHARED topfilter.c) -target_link_libraries(topfilter log_manager) +target_link_libraries(topfilter maxscale-common) set_target_properties(topfilter PROPERTIES VERSION "1.0.1") install(TARGETS topfilter DESTINATION ${MAXSCALE_LIBDIR}) add_library(dbfwfilter SHARED dbfwfilter.c) -target_link_libraries(dbfwfilter log_manager query_classifier) +target_link_libraries(dbfwfilter maxscale-common query_classifier) set_target_properties(dbfwfilter PROPERTIES VERSION "1.0.0") install(TARGETS dbfwfilter DESTINATION ${MAXSCALE_LIBDIR}) add_library(namedserverfilter SHARED namedserverfilter.c) -target_link_libraries(namedserverfilter log_manager) +target_link_libraries(namedserverfilter maxscale-common) set_target_properties(namedserverfilter PROPERTIES VERSION "1.1.0") install(TARGETS namedserverfilter DESTINATION ${MAXSCALE_LIBDIR}) if(BUILD_SLAVELAG) add_library(slavelag SHARED slavelag.c) - target_link_libraries(slavelag log_manager query_classifier) + target_link_libraries(slavelag maxscale-common query_classifier) set_target_properties(slavelag PROPERTIES VERSION "1.1.0") install(TARGETS slavelag DESTINATION ${MAXSCALE_LIBDIR}) endif() @@ -57,7 +57,7 @@ endif() if(BUILD_TOOLS) add_executable(ruleparser dbfwfilter.c) target_compile_definitions(ruleparser PUBLIC "BUILD_RULE_PARSER") - target_link_libraries(ruleparser ${EMBEDDED_LIB} log_manager query_classifier fullcore) + target_link_libraries(ruleparser maxscale-common query_classifier) install(TARGETS ruleparser DESTINATION ${MAXSCALE_BINDIR}) endif() diff --git a/server/modules/filter/hint/CMakeLists.txt b/server/modules/filter/hint/CMakeLists.txt index 94c5bf5c7..7efa8492d 100644 --- a/server/modules/filter/hint/CMakeLists.txt +++ b/server/modules/filter/hint/CMakeLists.txt @@ -1,4 +1,4 @@ add_library(hintfilter SHARED hintfilter.c hintparser.c) set_target_properties(hintfilter PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${MAXSCALE_LIBDIR} VERSION "1.0.0") -target_link_libraries(hintfilter ssl log_manager utils) +target_link_libraries(hintfilter maxscale-common) install(TARGETS hintfilter DESTINATION ${MAXSCALE_LIBDIR}) diff --git a/server/modules/filter/test/CMakeLists.txt b/server/modules/filter/test/CMakeLists.txt index cd4f31b92..efccd4ec4 100644 --- a/server/modules/filter/test/CMakeLists.txt +++ b/server/modules/filter/test/CMakeLists.txt @@ -1,8 +1,8 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) add_executable(harness_ui harness_ui.c harness_common.c) add_executable(harness harness_util.c harness_common.c) -target_link_libraries(harness_ui fullcore log_manager utils) -target_link_libraries(harness fullcore) +target_link_libraries(harness_ui maxscale-common) +target_link_libraries(harness maxscale-common) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${ERRMSG} ${CMAKE_CURRENT_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/harness.cnf ${CMAKE_CURRENT_BINARY_DIR}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testdriver.sh ${CMAKE_CURRENT_BINARY_DIR}/testdriver.sh @ONLY) diff --git a/server/modules/monitor/CMakeLists.txt b/server/modules/monitor/CMakeLists.txt index 604d9441b..bcbfcbdfa 100644 --- a/server/modules/monitor/CMakeLists.txt +++ b/server/modules/monitor/CMakeLists.txt @@ -1,24 +1,24 @@ add_library(mysqlmon SHARED mysql_mon.c) -target_link_libraries(mysqlmon log_manager) +target_link_libraries(mysqlmon maxscale-common) add_dependencies(mysqlmon pcre2) set_target_properties(mysqlmon PROPERTIES VERSION "1.4.0") install(TARGETS mysqlmon DESTINATION ${MAXSCALE_LIBDIR}) add_library(galeramon SHARED galeramon.c) -target_link_libraries(galeramon log_manager) +target_link_libraries(galeramon maxscale-common) add_dependencies(galeramon pcre2) set_target_properties(galeramon PROPERTIES VERSION "2.0.0") install(TARGETS galeramon DESTINATION ${MAXSCALE_LIBDIR}) add_library(ndbclustermon SHARED ndbclustermon.c) -target_link_libraries(ndbclustermon log_manager) +target_link_libraries(ndbclustermon maxscale-common) add_dependencies(ndbclustermon pcre2) set_target_properties(ndbclustermon PROPERTIES VERSION "2.1.0") install(TARGETS ndbclustermon DESTINATION ${MAXSCALE_LIBDIR}) if(BUILD_MMMON) add_library(mmmon SHARED mmmon.c) - target_link_libraries(mmmon log_manager) + target_link_libraries(mmmon maxscale-common) add_dependencies(mmmon pcre2) set_target_properties(mmmon PROPERTIES VERSION "1.1.1") install(TARGETS mmmon DESTINATION ${MAXSCALE_LIBDIR}) diff --git a/server/modules/protocol/CMakeLists.txt b/server/modules/protocol/CMakeLists.txt index 2a14b32b1..582779027 100644 --- a/server/modules/protocol/CMakeLists.txt +++ b/server/modules/protocol/CMakeLists.txt @@ -1,20 +1,20 @@ add_library(MySQLClient SHARED mysql_client.c mysql_common.c) -target_link_libraries(MySQLClient log_manager) +target_link_libraries(MySQLClient maxscale-common) set_target_properties(MySQLClient PROPERTIES VERSION "1.0.0") install(TARGETS MySQLClient DESTINATION ${MAXSCALE_LIBDIR}) add_library(MySQLBackend SHARED mysql_backend.c mysql_common.c) -target_link_libraries(MySQLBackend log_manager) +target_link_libraries(MySQLBackend maxscale-common) set_target_properties(MySQLBackend PROPERTIES VERSION "2.0.0") install(TARGETS MySQLBackend DESTINATION ${MAXSCALE_LIBDIR}) add_library(telnetd SHARED telnetd.c) -target_link_libraries(telnetd log_manager) +target_link_libraries(telnetd maxscale-common) set_target_properties(telnetd PROPERTIES VERSION "1.0.1") install(TARGETS telnetd DESTINATION ${MAXSCALE_LIBDIR}) add_library(HTTPD SHARED httpd.c) -target_link_libraries(HTTPD log_manager) +target_link_libraries(HTTPD maxscale-common) set_target_properties(HTTPD PROPERTIES VERSION "1.0.1") install(TARGETS HTTPD DESTINATION ${MAXSCALE_LIBDIR}) @@ -26,11 +26,7 @@ if(BUILD_TESTS) endif() add_library(maxscaled SHARED maxscaled.c) -target_link_libraries(maxscaled log_manager) +target_link_libraries(maxscaled maxscale-common) set_target_properties(maxscaled PROPERTIES VERSION "1.0.0") install(TARGETS maxscaled DESTINATION ${MAXSCALE_LIBDIR}) - - - - diff --git a/server/modules/routing/CMakeLists.txt b/server/modules/routing/CMakeLists.txt index 9bee524df..29a84409f 100644 --- a/server/modules/routing/CMakeLists.txt +++ b/server/modules/routing/CMakeLists.txt @@ -1,23 +1,23 @@ if(BUILD_TESTS) add_subdirectory(test) add_library(testroute SHARED testroute.c) - target_link_libraries(testroute log_manager) + target_link_libraries(testroute maxscale-common) set_target_properties(testroute PROPERTIES VERSION "1.0.0") install(TARGETS testroute DESTINATION ${MAXSCALE_LIBDIR}) endif() add_library(readconnroute SHARED readconnroute.c) -target_link_libraries(readconnroute log_manager) +target_link_libraries(readconnroute maxscale-common) set_target_properties(readconnroute PROPERTIES VERSION "1.1.0") install(TARGETS readconnroute DESTINATION ${MAXSCALE_LIBDIR}) add_library(debugcli SHARED debugcli.c debugcmd.c) -target_link_libraries(debugcli log_manager) +target_link_libraries(debugcli maxscale-common) set_target_properties(debugcli PROPERTIES VERSION "1.1.1") install(TARGETS debugcli DESTINATION ${MAXSCALE_LIBDIR}) add_library(cli SHARED cli.c debugcmd.c) -target_link_libraries(cli log_manager) +target_link_libraries(cli maxscale-common) set_target_properties(cli PROPERTIES VERSION "1.0.0") install(TARGETS cli DESTINATION ${MAXSCALE_LIBDIR}) diff --git a/server/modules/routing/binlog/CMakeLists.txt b/server/modules/routing/binlog/CMakeLists.txt index 2b282eadb..2cc50c0a4 100644 --- a/server/modules/routing/binlog/CMakeLists.txt +++ b/server/modules/routing/binlog/CMakeLists.txt @@ -1,26 +1,10 @@ add_library(binlogrouter SHARED blr.c blr_master.c blr_cache.c blr_slave.c blr_file.c) set_target_properties(binlogrouter PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${MAXSCALE_LIBDIR} VERSION "2.0.0") -target_link_libraries(binlogrouter ssl pthread log_manager) +target_link_libraries(binlogrouter maxscale-common) install(TARGETS binlogrouter DESTINATION ${MAXSCALE_LIBDIR}) -add_executable(maxbinlogcheck maxbinlogcheck.c blr_file.c blr_cache.c blr_master.c blr_slave.c blr.c - ${CMAKE_SOURCE_DIR}/server/core/service.c ${CMAKE_SOURCE_DIR}/server/core/spinlock.c - ${CMAKE_SOURCE_DIR}/server/core/buffer.c ${CMAKE_SOURCE_DIR}/server/core/atomic.c - ${CMAKE_SOURCE_DIR}/server/core/hint.c ${CMAKE_SOURCE_DIR}/server/core/gwdirs.c - ${CMAKE_SOURCE_DIR}/server/core/server.c ${CMAKE_SOURCE_DIR}/server/core/dcb.c - ${CMAKE_SOURCE_DIR}/server/core/users.c ${CMAKE_SOURCE_DIR}/server/core/dbusers.c - ${CMAKE_SOURCE_DIR}/server/core/utils.c ${CMAKE_SOURCE_DIR}/server/core/hashtable.c - ${CMAKE_SOURCE_DIR}/server/core/poll.c ${CMAKE_SOURCE_DIR}/server/core/gwbitmask.c - ${CMAKE_SOURCE_DIR}/server/core/config.c ${CMAKE_SOURCE_DIR}/server/core/session.c - ${CMAKE_SOURCE_DIR}/server/core/housekeeper.c ${CMAKE_SOURCE_DIR}/server/core/filter.c - ${CMAKE_SOURCE_DIR}/server/core/resultset.c ${CMAKE_SOURCE_DIR}/server/core/load_utils.c - ${CMAKE_SOURCE_DIR}/server/core/monitor.c ${CMAKE_SOURCE_DIR}/server/core/gw_utils.c - ${CMAKE_SOURCE_DIR}/server/core/thread.c ${CMAKE_SOURCE_DIR}/server/core/secrets.c - ${CMAKE_SOURCE_DIR}/server/core/random_jkiss.c ${CMAKE_SOURCE_DIR}/server/core/maxscale_pcre2.c - ${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc ${CMAKE_SOURCE_DIR}/server/core/externcmd.c) - - -target_link_libraries(maxbinlogcheck utils ssl pthread ${LZMA_LINK_FLAGS} ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} aio rt crypt dl crypto inih z m stdc++ ${CURL_LIBRARIES} ${PCRE2_LIBRARIES}) +add_executable(maxbinlogcheck maxbinlogcheck.c blr_file.c blr_cache.c blr_master.c blr_slave.c blr.c) +target_link_libraries(maxbinlogcheck maxscale-common) install(TARGETS maxbinlogcheck DESTINATION bin) diff --git a/server/modules/routing/binlog/test/CMakeLists.txt b/server/modules/routing/binlog/test/CMakeLists.txt index 62e355b28..fdf7538a1 100644 --- a/server/modules/routing/binlog/test/CMakeLists.txt +++ b/server/modules/routing/binlog/test/CMakeLists.txt @@ -1,5 +1,5 @@ if(BUILD_TESTS) add_executable(testbinlogrouter testbinlog.c ../blr.c ../blr_slave.c ../blr_master.c ../blr_file.c ../blr_cache.c) - target_link_libraries(testbinlogrouter fullcore ssl pthread log_manager) + target_link_libraries(testbinlogrouter maxscale-common) add_test(TestBinlogRouter ${CMAKE_CURRENT_BINARY_DIR}/testbinlogrouter) endif() diff --git a/server/modules/routing/maxinfo/CMakeLists.txt b/server/modules/routing/maxinfo/CMakeLists.txt index 55d0c7c9c..d87e61cd4 100644 --- a/server/modules/routing/maxinfo/CMakeLists.txt +++ b/server/modules/routing/maxinfo/CMakeLists.txt @@ -1,4 +1,4 @@ add_library(maxinfo SHARED maxinfo.c maxinfo_parse.c maxinfo_error.c maxinfo_exec.c) set_target_properties(maxinfo PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${MAXSCALE_LIBDIR} VERSION "1.0.0") -target_link_libraries(maxinfo pthread log_manager) +target_link_libraries(maxinfo maxscale-common) install(TARGETS maxinfo DESTINATION ${MAXSCALE_LIBDIR}) diff --git a/server/modules/routing/readwritesplit/CMakeLists.txt b/server/modules/routing/readwritesplit/CMakeLists.txt index 25b017b74..f410e7662 100644 --- a/server/modules/routing/readwritesplit/CMakeLists.txt +++ b/server/modules/routing/readwritesplit/CMakeLists.txt @@ -1,5 +1,5 @@ add_library(readwritesplit SHARED readwritesplit.c) -target_link_libraries(readwritesplit ssl pthread log_manager query_classifier) +target_link_libraries(readwritesplit maxscale-common query_classifier) set_target_properties(readwritesplit PROPERTIES VERSION "1.0.2") install(TARGETS readwritesplit DESTINATION ${MAXSCALE_LIBDIR}) if(BUILD_TESTS) diff --git a/server/modules/routing/schemarouter/CMakeLists.txt b/server/modules/routing/schemarouter/CMakeLists.txt index 975143ceb..f380f6073 100644 --- a/server/modules/routing/schemarouter/CMakeLists.txt +++ b/server/modules/routing/schemarouter/CMakeLists.txt @@ -1,11 +1,11 @@ add_library(schemarouter SHARED schemarouter.c sharding_common.c) -target_link_libraries(schemarouter log_manager query_classifier) +target_link_libraries(schemarouter maxscale-common query_classifier) add_dependencies(schemarouter pcre2) set_target_properties(schemarouter PROPERTIES VERSION "1.0.0") install(TARGETS schemarouter DESTINATION ${MAXSCALE_LIBDIR}) add_library(shardrouter SHARED shardrouter.c svcconn.c sharding_common.c) -target_link_libraries(shardrouter log_manager query_classifier) +target_link_libraries(shardrouter maxscale-common query_classifier) add_dependencies(shardrouter pcre2) set_target_properties(shardrouter PROPERTIES VERSION "1.0.0") install(TARGETS shardrouter DESTINATION ${MAXSCALE_LIBDIR}) diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 8bba56eca..e5a524f98 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -1,3 +1,5 @@ +# NOTE: This is currently not used. log_manager.cc is built directly into maxscale-common. +# To be removed completely. add_library(utils skygw_utils.cc ../server/core/atomic.c) target_link_libraries(utils stdc++) add_dependencies(utils pcre2)