Added more build options and README changes
This commit is contained in:
@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 2.6)
|
|||||||
|
|
||||||
include(macros.cmake)
|
include(macros.cmake)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
set(INSTALL_DIR "/usr/local/skysql/" CACHE PATH "MaxScale installation directory.")
|
||||||
|
set(CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "Prefix prepended to install directories." FORCE)
|
||||||
|
set(BUILD_TYPE "Release" CACHE STRING "Build type, possible values are: Debug Release.")
|
||||||
|
set(CMAKE_BUILD_TYPE "${BUILD_TYPE}" CACHE INTERNAL "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel. " FORCE)
|
||||||
project(MaxScale)
|
project(MaxScale)
|
||||||
|
|
||||||
set_maxscale_version()
|
set_maxscale_version()
|
||||||
@ -109,3 +113,11 @@ set(CPACK_RPM_PACKAGE_VENDOR "SkySQL Ab")
|
|||||||
set(CPACK_RPM_PACKAGE_AUTOREQPROV " no")
|
set(CPACK_RPM_PACKAGE_AUTOREQPROV " no")
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
|
||||||
|
#add_test(PrepareTests ${CMAKE_COMMAND} -DBUILD_TESTS=Y -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DINSTALL_SYSTEM_FILES=N ${CMAKE_SOURCE_DIR})
|
||||||
|
#set_tests_properties(PrepareTests PROPERTIES WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||||
|
#set_tests_properties(PrepareTests PROPERTIES COST 1000)
|
||||||
|
|
||||||
|
#add_test(BuildTests ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target install)
|
||||||
|
#set_tests_properties(BuildTests PROPERTIES WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||||
|
#set_tests_properties(BuildTests PROPERTIES DEPENDS PrepareTests)
|
||||||
|
#set_tests_properties(BuildTests PROPERTIES COST 900)
|
||||||
|
25
README
25
README
@ -157,15 +157,21 @@ Please check errmsg.sys is found in the MaxScale install_dir DEST/MaxScale/mysql
|
|||||||
You can also build MaxScale with CMake which makes the build process a bit more simple.
|
You can also build MaxScale with CMake which makes the build process a bit more simple.
|
||||||
|
|
||||||
All the same dependencies are required as with the normal MaxScale build with the addition of CMake
|
All the same dependencies are required as with the normal MaxScale build with the addition of CMake
|
||||||
version 2.6 for regular builds and 2.8 or newer for package generation.
|
version 2.6 for regular builds and 2.8 or newer if you wish to generate packages.
|
||||||
|
|
||||||
CMake tries to find all the required directories and files on its own but if it can't find them or you wish to
|
CMake tries to find all the required directories and files on its own but if it can't find them or you wish to
|
||||||
explicitly state the locations you can pass additional options to CMake by using the -D flag. To confirm the variable
|
explicitly state the locations you can pass additional options to CMake by using the -D flag. To confirm the variable
|
||||||
values, you can run CMake in interactive mode by using the -i flag or use the ccmake GUI.
|
values, you can run CMake in interactive mode by using the -i flag or use a CMake GUI (for example, ccmake for command line).
|
||||||
|
|
||||||
For example, to build MaxScale using CMake with a custom install location:
|
It is highly recommended to make a separate build directory to build into. This keeps the source and build trees clean and
|
||||||
|
makes it easy to get rid of everything you built.
|
||||||
|
|
||||||
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/skysql <path to MaxScale source>
|
By default, MaxScale installs to /usr/local/skysql and places init.d scripts and ldconfig files into their folders. Change the INSTALL_DIR
|
||||||
|
variable to your desired installation directory and set INSTALL_SYSTEM_FILES=N to prevent the init.d script and ldconfig file installation.
|
||||||
|
|
||||||
|
To build and install MaxScale using CMake with a custom install location and a separate build directory:
|
||||||
|
|
||||||
|
cmake -D_INSTALL_DIR=<install destination> <path to MaxScale source>
|
||||||
|
|
||||||
make
|
make
|
||||||
|
|
||||||
@ -174,15 +180,22 @@ For example, to build MaxScale using CMake with a custom install location:
|
|||||||
This generates the required makefiles in the current directory, compiles and links all the programs and installs
|
This generates the required makefiles in the current directory, compiles and links all the programs and installs
|
||||||
all the required files in their right places.
|
all the required files in their right places.
|
||||||
|
|
||||||
|
To build MaxScale using the ccmake GUI:
|
||||||
|
|
||||||
|
ccmake <path to MaxScale source>
|
||||||
|
|
||||||
|
All the parameters affecting CMake can be found in 'macros.cmake'. This file also has the parameters CMake uses for testing.
|
||||||
|
|
||||||
Variables controlling the CMake build process:
|
Variables controlling the CMake build process:
|
||||||
|
|
||||||
CMAKE_INSTALL_PREFIX=<path> Install destination prefix, same as DEST
|
INSTALL_DIR=<path> Installation directory
|
||||||
CMAKE_BUILD_TYPE=[Debug|Release] Type of the build
|
CMAKE_BUILD_TYPE=[Debug|Release] Type of the build, defaults to Release
|
||||||
INSTALL_SYSTEM_FILES=[Y|N] Install startup scripts and ld configuration files
|
INSTALL_SYSTEM_FILES=[Y|N] Install startup scripts and ld configuration files
|
||||||
EMBEDDED_LIB=<path> Path to the embedded library, filename included
|
EMBEDDED_LIB=<path> Path to the embedded library, filename included
|
||||||
MYSQL_DIR=<path> Path to MySQL headers
|
MYSQL_DIR=<path> Path to MySQL headers
|
||||||
STATIC_EMBEDDED=[Y|N] Link the static or the dynamic verson of the library
|
STATIC_EMBEDDED=[Y|N] Link the static or the dynamic verson of the library
|
||||||
GCOV=[Y|N] Generate gcov output
|
GCOV=[Y|N] Generate gcov output
|
||||||
|
BUILD_TESTS=[Y|N] Build tests
|
||||||
|
|
||||||
\section Running Running MaxScale
|
\section Running Running MaxScale
|
||||||
|
|
||||||
|
@ -2,5 +2,6 @@ cmake_minimum_required(VERSION 2.6)
|
|||||||
add_library(log_manager SHARED log_manager.cc)
|
add_library(log_manager SHARED log_manager.cc)
|
||||||
target_link_libraries(log_manager utils)
|
target_link_libraries(log_manager utils)
|
||||||
install(TARGETS log_manager DESTINATION lib)
|
install(TARGETS log_manager DESTINATION lib)
|
||||||
|
if(BUILD_TESTS)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
endif()
|
@ -43,4 +43,8 @@ macro(set_variables)
|
|||||||
# Install init.d scripts and ldconf configuration files
|
# Install init.d scripts and ldconf configuration files
|
||||||
set(INSTALL_SYSTEM_FILES TRUE CACHE BOOL "Install init.d scripts and ldconf configuration files")
|
set(INSTALL_SYSTEM_FILES TRUE CACHE BOOL "Install init.d scripts and ldconf configuration files")
|
||||||
|
|
||||||
|
# Build tests
|
||||||
|
set(BUILD_TESTS TRUE CACHE BOOL "Build tests")
|
||||||
|
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
@ -1,4 +1,6 @@
|
|||||||
set(QUERY_CLASSIFIER_HEADERS query_classifier.h)
|
set(QUERY_CLASSIFIER_HEADERS query_classifier.h)
|
||||||
add_library(query_classifier SHARED query_classifier.cc ${MYSQL_HEADERS})
|
add_library(query_classifier SHARED query_classifier.cc ${MYSQL_HEADERS})
|
||||||
install(TARGETS query_classifier DESTINATION lib)
|
install(TARGETS query_classifier DESTINATION lib)
|
||||||
|
if(BUILD_TESTS)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
endif()
|
@ -1,4 +1,6 @@
|
|||||||
add_subdirectory(core)
|
add_subdirectory(core)
|
||||||
add_subdirectory(modules)
|
add_subdirectory(modules)
|
||||||
add_subdirectory(inih)
|
add_subdirectory(inih)
|
||||||
|
if(BUILD_TESTS)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
endif()
|
@ -20,4 +20,6 @@ set_target_properties(maxpasswd PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:
|
|||||||
target_link_libraries(maxpasswd utils log_manager ssl aio pthread crypt dl ${EMBEDDED_LIB} crypto inih z rt m)
|
target_link_libraries(maxpasswd utils log_manager ssl aio pthread crypt dl ${EMBEDDED_LIB} crypto inih z rt m)
|
||||||
install(TARGETS maxpasswd DESTINATION bin)
|
install(TARGETS maxpasswd DESTINATION bin)
|
||||||
|
|
||||||
|
if(BUILD_TESTS)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
endif()
|
@ -2,4 +2,6 @@ add_library(readwritesplit SHARED readwritesplit.c)
|
|||||||
set_target_properties(readwritesplit PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${CMAKE_INSTALL_PREFIX}/lib)
|
set_target_properties(readwritesplit PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${CMAKE_INSTALL_PREFIX}/lib)
|
||||||
target_link_libraries(readwritesplit utils ssl pthread log_manager query_classifier mysqld)
|
target_link_libraries(readwritesplit utils ssl pthread log_manager query_classifier mysqld)
|
||||||
install(TARGETS readwritesplit DESTINATION modules)
|
install(TARGETS readwritesplit DESTINATION modules)
|
||||||
|
if(BUILD_TESTS)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
endif()
|
@ -1,5 +1,8 @@
|
|||||||
file(COPY MaxScale_test.cnf DESTINATION ${CMAKE_BINARY_DIR}/etc)
|
file(COPY MaxScale_test.cnf DESTINATION ${CMAKE_BINARY_DIR}/etc)
|
||||||
file(RENAME ${CMAKE_BINARY_DIR}/etc/MaxScale_test.cnf ${CMAKE_BINARY_DIR}/etc/MaxScale.cnf)
|
file(RENAME ${CMAKE_BINARY_DIR}/etc/MaxScale_test.cnf ${CMAKE_BINARY_DIR}/etc/MaxScale.cnf)
|
||||||
add_test(NAME RunExecutable COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/startmaxscale.sh "$<TARGET_FILE_DIR:maxscale>" "-c ${CMAKE_BINARY_DIR}")
|
add_test(NAME RunExecutable COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/startmaxscale.sh "$<TARGET_FILE_DIR:maxscale>" "-c ${CMAKE_BINARY_DIR}")
|
||||||
set_tests_properties(RunExecutable PROPERTIES TIMEOUT 10)
|
set_tests_properties(RunExecutable PROPERTIES TIMEOUT 5)
|
||||||
set_tests_properties(RunExecutable PROPERTIES WILL_FAIL TRUE)
|
set_tests_properties(RunExecutable PROPERTIES WILL_FAIL TRUE)
|
||||||
|
|
||||||
|
add_test(NAME KillExecutable COMMAND killall -KILL maxscale)
|
||||||
|
set_tests_properties(KillExecutable PROPERTIES COST 0.00001)
|
||||||
|
Reference in New Issue
Block a user