Fix linker problems and add mysql_server_init for test program
This commit is contained in:
parent
83de4c4458
commit
ab294a18f0
@ -1,13 +1,22 @@
|
||||
project(examples)
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
|
||||
link_directories(${PROJECT_BUILD_DIR}/lib)
|
||||
include_directories(${PROJECT_BUILD_DIR}/include)
|
||||
|
||||
# Find MySQL client library and header files
|
||||
find_library(MySQL_LIBRARY NAMES libmysqld.a PATHS
|
||||
/usr/lib64/mysql /usr/lib/mysql /usr/local/mysql/lib)
|
||||
find_path(MySQL_INCLUDE_DIR mysql.h
|
||||
/usr/local/include/mysql /usr/include/mysql)
|
||||
include_directories(${MySQL_INCLUDE_DIR})
|
||||
|
||||
|
||||
# Create build rules for all the simple examples that only require a
|
||||
# single file.
|
||||
foreach(prog basic-1 basic-2 jan_test)
|
||||
ADD_EXECUTABLE(${prog} ${prog}.cpp)
|
||||
TARGET_LINK_LIBRARIES(${prog} replication boost_system pthread)
|
||||
TARGET_LINK_LIBRARIES(${prog} replication boost_system pthread aio crypt ${MySQL_LIBRARY})
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(mysql2lucene EXCLUDE_FROM_ALL)
|
||||
|
@ -12,7 +12,7 @@ IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
|
||||
STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
|
||||
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
|
||||
ELSE(BUILD_TYPE)
|
||||
SET(CMAKE_INSTALL_CONFIG_NAME "")
|
||||
SET(CMAKE_INSTALL_CONFIG_NAME "Debug")
|
||||
ENDIF(BUILD_TYPE)
|
||||
MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
|
||||
ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
|
||||
@ -37,3 +37,13 @@ IF(NOT CMAKE_INSTALL_LOCAL_ONLY)
|
||||
|
||||
ENDIF(NOT CMAKE_INSTALL_LOCAL_ONLY)
|
||||
|
||||
IF(CMAKE_INSTALL_COMPONENT)
|
||||
SET(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
|
||||
ELSE(CMAKE_INSTALL_COMPONENT)
|
||||
SET(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
|
||||
ENDIF(CMAKE_INSTALL_COMPONENT)
|
||||
|
||||
FILE(WRITE "/home/jan/skysql/skygateway/skygateway/replication_listener/examples/${CMAKE_INSTALL_MANIFEST}" "")
|
||||
FOREACH(file ${CMAKE_INSTALL_MANIFEST_FILES})
|
||||
FILE(APPEND "/home/jan/skysql/skygateway/skygateway/replication_listener/examples/${CMAKE_INSTALL_MANIFEST}" "${file}\n")
|
||||
ENDFOREACH(file)
|
||||
|
@ -12,12 +12,31 @@
|
||||
#include <string.h>
|
||||
#include <regex.h>
|
||||
#include <algorithm>
|
||||
#include <mysql.h>
|
||||
|
||||
using mysql::Binary_log;
|
||||
using mysql::system::create_transport;
|
||||
using namespace std;
|
||||
using namespace mysql::system;
|
||||
|
||||
static char* server_options[] = {
|
||||
"jan test",
|
||||
"--datadir=/tmp/",
|
||||
"--skip-innodb",
|
||||
"--default-storage-engine=myisam",
|
||||
NULL
|
||||
};
|
||||
|
||||
const int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;
|
||||
|
||||
static char* server_groups[] = {
|
||||
"embedded",
|
||||
"server",
|
||||
"server",
|
||||
"server",
|
||||
NULL
|
||||
};
|
||||
|
||||
void* binlog_reader(void * arg)
|
||||
{
|
||||
replication_listener_t *rlt = (replication_listener_t*)arg;
|
||||
@ -159,6 +178,9 @@ int main(int argc, char** argv) {
|
||||
std::cerr << "Usage: basic-2 <uri>" << std::endl;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
mysql_server_init(num_elements, server_options, server_groups);
|
||||
|
||||
argc =0;
|
||||
while(argc != number_of_args)
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
|
||||
STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
|
||||
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
|
||||
ELSE(BUILD_TYPE)
|
||||
SET(CMAKE_INSTALL_CONFIG_NAME "")
|
||||
SET(CMAKE_INSTALL_CONFIG_NAME "Debug")
|
||||
ENDIF(BUILD_TYPE)
|
||||
MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
|
||||
ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
|
||||
|
Loading…
x
Reference in New Issue
Block a user