Added optional RabbitMQ component configuration

Changed all the configuration variables to cached
Fixed some errors in tests
This commit is contained in:
Markus Makela
2014-09-14 07:30:41 +03:00
parent df7590c167
commit 5d26cf6fd5
5 changed files with 48 additions and 58 deletions

View File

@ -5,7 +5,7 @@ enable_testing()
project(MaxScale) project(MaxScale)
set_maxscale_version() set_maxscale_version()
set_testing_variables() set_variables()
configure_file(${CMAKE_SOURCE_DIR}/server/include/version.h.in ${CMAKE_SOURCE_DIR}/server/include/version.h) configure_file(${CMAKE_SOURCE_DIR}/server/include/version.h.in ${CMAKE_SOURCE_DIR}/server/include/version.h)

View File

@ -8,41 +8,38 @@ macro(set_maxscale_version)
endmacro() endmacro()
macro(set_testing_variables) macro(set_variables)
# hostname or IP address of MaxScale's host # hostname or IP address of MaxScale's host
if(NOT TEST_HOST) set(TEST_HOST "127.0.0.1" CACHE STRING "hostname or IP address of MaxScale's host")
set(TEST_HOST "127.0.0.1")
endif()
# port of read connection router module # port of read connection router module
if(NOT TEST_PORT_RW) set(TEST_PORT_RW "4008" CACHE STRING "port of read connection router module")
set(TEST_PORT_RW "4008")
endif()
# port of read/write split router module # port of read/write split router module
if(NOT TEST_PORT_RW) set(TEST_PORT_RW "4006" CACHE STRING "port of read/write split router module")
set(TEST_PORT_RW "4006")
endif()
# port of read/write split router module with hints # port of read/write split router module with hints
if(NOT TEST_PORT_RW_HINT) set(TEST_PORT_RW_HINT "4006" CACHE STRING "port of read/write split router module with hints")
set(TEST_PORT_RW_HINT "4006")
endif()
# master's server_id # master test server server_id
if(NOT TEST_MASTER_ID) set(TEST_MASTER_ID "3000" CACHE STRING "master test server server_id")
set(TEST_MASTER_ID "3000")
endif()
# username of MaxScale user # username of MaxScale user
if(NOT TEST_USER) set(TEST_USER "maxuser" CACHE STRING "username of MaxScale user")
set(TEST_USER "maxuser")
endif()
# password of MaxScale user # password of MaxScale user
if(NOT TEST_PASSWORD) set(TEST_PASSWORD "maxpwd" CACHE STRING "password of MaxScale user")
set(TEST_PASSWORD "maxpwd")
endif() # Use static version of libmysqld
set(STATIC_EMBEDDED FALSE CACHE BOOL "Use static version of libmysqld")
# Build RabbitMQ components
set(BUILD_RABBITMQ FALSE CACHE BOOL "Build RabbitMQ components")
# Use gcov build flags
set(GCOV FALSE CACHE BOOL "Use gcov build flags")
# Install init.d scripts and ldconf configuration files
set(INSTALL_SYSTEM_FILES TRUE CACHE BOOL "Install init.d scripts and ldconf configuration files")
endmacro() endmacro()

View File

@ -1,44 +1,35 @@
cmake_minimum_required (VERSION 2.6) cmake_minimum_required (VERSION 2.6)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64 /usr/lib/mariadb /usr/lib64/mariadb)
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} /usr/include /usr/local/include /usr/include/mysql /usr/local/include/mysql /usr/include/mariadb /usr/local/include/mariadb)
include(InstallRequiredSystemLibraries)
project (consumer) project (consumer)
find_path(MYSQL_INCLUDE_DIRS mysql.h) find_path(RABBITMQ_C_DIRS amqp.h)
find_library(MYSQL_LIBRARIES NAMES mysqlclient) find_library(RABBITMQ_C_LIB NAMES rabbitmq)
find_library(RABBITMQ_C_LIBRARIES NAMES rabbitmq) find_library(MYSQL_CLIENT_LIB NAMES mysqlclient PATHS /usr/lib /usr/lib64 PATH_SUFFIXES mysql mariadb)
include_directories(${MYSQL_INCLUDE_DIRS}) include_directories(${RABBITMQ_C_DIRS})
include_directories(${RABBITMQ_C_INCLUDE_DIRS})
include_directories(${CMAKE_SOURCE_DIR}/inih)
add_subdirectory (inih) if( ( RABBITMQ_C_LIB AND RABBITMQ_C_DIRS ) AND MYSQL_CLIENT_LIB )
link_directories(${CMAKE_SOURCE_DIR}/inih)
if(RABBITMQ_C_LIBRARIES AND MYSQL_LIBRARIES AND MYSQL_INCLUDE_DIRS) add_executable (consumer consumer.c ${MYSQL_CLIENT_LIB} ${RABBITMQ_C_LIBRARIES})
target_link_libraries(consumer mysqlclient)
add_executable (consumer consumer.c ${MYSQL_LIBRARIES} ${RABBITMQ_C_LIBRARIES}) target_link_libraries(consumer rabbitmq)
target_link_libraries(consumer mysqlclient) target_link_libraries(consumer inih)
target_link_libraries(consumer rabbitmq) install(TARGETS consumer DESTINATION bin)
target_link_libraries(consumer inih) install(FILES consumer.cnf DESTINATION etc)
install(TARGETS consumer DESTINATION bin)
install(FILES consumer.cnf DESTINATION share/consumer)
else(RABBITMQ_C_LIBRARIES AND MYSQL_LIBRARIES AND MYSQL_INCLUDE_DIRS) else()
message(FATAL_ERROR "Error: Can not find requred libraries: libmysqld, librabbitmq.") message(FATAL_ERROR "Error: Can not find requred libraries.")
endif()
endif(RABBITMQ_C_LIBRARIES AND MYSQL_LIBRARIES AND MYSQL_INCLUDE_DIRS) # Packaging of RabbitMQ disabled for now
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "RabbitMQ Consumer Client") #set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "RabbitMQ Consumer Client")
set(CPACK_PACKAGE_NAME "RabbitMQ Consumer") #set(CPACK_PACKAGE_NAME "RabbitMQ Consumer")
set(CPACK_GENERATOR "RPM") #set(CPACK_GENERATOR "RPM")
set(CPACK_PACKAGE_VERSION_MAJOR "1") #set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "0") #set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_RPM_PACKAGE_NAME "rabbitmq-consumer") #set(CPACK_RPM_PACKAGE_NAME "rabbitmq-consumer")
set(CPACK_RPM_PACKAGE_VENDOR "SkySQL Ab") #set(CPACK_RPM_PACKAGE_VENDOR "SkySQL Ab")
set(CPACK_RPM_PACKAGE_AUTOREQPROV " no") #set(CPACK_RPM_PACKAGE_AUTOREQPROV " no")
include(CPack) #include(CPack)

View File

@ -2,7 +2,7 @@ if(BUILD_RABBITMQ)
add_library(mqfilter SHARED mqfilter.c) add_library(mqfilter SHARED mqfilter.c)
set_target_properties(mqfilter PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${CMAKE_INSTALL_PREFIX}/lib) set_target_properties(mqfilter PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${CMAKE_INSTALL_PREFIX}/lib)
target_link_libraries(mqfilter utils query_classifier log_manager rabbitmq) target_link_libraries(mqfilter utils query_classifier log_manager rabbitmq)
install(TARGETS DESTINATION modules) install(TARGETS mqfilter DESTINATION modules)
endif(BUILD_RABBITMQ) endif(BUILD_RABBITMQ)
add_library(regexfilter SHARED regexfilter.c) add_library(regexfilter SHARED regexfilter.c)

View File

@ -0,0 +1,2 @@
#!/bin/sh
$1 $2 &