CMakeLists.txt 1.55 KB
Newer Older
pryanikov's avatar
pryanikov committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
PROJECT (replicator)

set(CMAKE_VERBOSE_MAKEFILE on)
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)

set(REPLICATOR_NAME "replicatord")
set(REPLICATOR_ROOT "${CMAKE_SOURCE_DIR}")
set(REPLICATOR_CFLAGS "-DTB_LOCAL=${REPLICATOR_ROOT}/lib/tarantool-c/lib -std=c++0x -g")
set(REPLICATOR_SRC
    ${REPLICATOR_ROOT}/dbreader.cpp
    ${REPLICATOR_ROOT}/main.cpp
    ${REPLICATOR_ROOT}/tpwriter.cpp
)

add_subdirectory(lib/tarantool-c)
add_subdirectory(lib/libslave)
pryanikov's avatar
pryanikov committed
18
add_subdirectory(lib/yaml-cpp)
pryanikov's avatar
pryanikov committed
19

pryanikov's avatar
pryanikov committed
20
21
22
23
24
25
26
include(FindPackageHandleStandardArgs)
find_path(IMYSQL mysql/mysql.h)
find_package_handle_standard_args(Mysql DEFAULT_MSG IMYSQL)

include_directories(
	"${REPLICATOR_ROOT}"
	"${REPLICATOR_ROOT}/lib/libslave"
pryanikov's avatar
pryanikov committed
27
	"${REPLICATOR_ROOT}/lib/yaml-cpp/include"
pryanikov's avatar
pryanikov committed
28
29
30
31
	"${REPLICATOR_ROOT}/lib/tarantool-c/include"
	"${REPLICATOR_ROOT}/lib/tarantool-c/third_party/msgpuck"
	"${IMYSQL}/mysql"
)
pryanikov's avatar
pryanikov committed
32

pryanikov's avatar
pryanikov committed
33
find_library(LMYSQL_CLIENT_R perconaserverclient_r PATH_SUFFIXES mysql)
pryanikov's avatar
pryanikov committed
34
35
find_library(LPTHREAD pthread)
find_library(LZMQ zmq)
pryanikov's avatar
pryanikov committed
36
37
find_library(LBOOST_SYSTEM_MT boost_system)
find_library(LBOOST_SERIALIZATION_MT boost_serialization)
pryanikov's avatar
pryanikov committed
38
39
40
41

add_executable(rp ${REPLICATOR_SRC})
set_target_properties(rp PROPERTIES COMPILE_FLAGS "${REPLICATOR_CFLAGS}")
set_target_properties(rp PROPERTIES OUTPUT_NAME ${REPLICATOR_NAME})
pryanikov's avatar
pryanikov committed
42
target_link_libraries(rp tnt slave_a yaml-cpp)
pryanikov's avatar
pryanikov committed
43
target_link_libraries(rp ${LMYSQL_CLIENT_R} ${LPTHREAD} ${LZMQ} ${LBOOST_SYSTEM_MT} ${LBOOST_SERIALIZATION_MT} rt dl ssl crypto z)
pryanikov's avatar
pryanikov committed
44
45

install(TARGETS rp RUNTIME DESTINATION sbin)
pryanikov's avatar
pryanikov committed
46
install(FILES replicatord.cfg DESTINATION etc)