Commit c6c57ed7 authored by unknown's avatar unknown

Bug#29903 The CMake build method does not produce the embedded library.

- Changes to correct and test Windows embedded build.


BitKeeper/etc/ignore:
  Bug#29903 The CMake build method does not produce the embedded library.
  - Ignore auto-generated Windows embedded resources.
CMakeLists.txt:
  Bug#29903 The CMake build method does not produce the embedded library.
  - Hardcode CSV for all configurations.
  - Add client directory for gen_lex_hash dependency.
client/CMakeLists.txt:
  Bug#29903 The CMake build method does not produce the embedded library.
  - Build the mysqlclient library and echo for the embedded solution.
client/client_priv.h:
  Bug#29903 The CMake build method does not produce the embedded library.
  - Defined new option.
client/mysql.cc:
  Bug#29903 The CMake build method does not produce the embedded library.
  - Add server-arg command line parameter
libmysqld/CMakeLists.txt:
  Bug#29903 The CMake build method does not produce the embedded library.
  - Added auto generated resources; sql_yacc.cc, sql_yacc.h, message.rc
  message.h and lex_hash.h.
  - Link csv library to libmsyqld.
libmysqld/Makefile.am:
  Bug#29903 The CMake build method does not produce the embedded library.
  - Include CMakeLists.txt in dist.
libmysqld/examples/CMakeLists.txt:
  Bug#29903 The CMake build method does not produce the embedded library.
  - Follow existing naming convention.
libmysqld/examples/Makefile.am:
  Bug#29903 The CMake build method does not produce the embedded library.
  - Include CMakeLists.txt in dist.
mysql-test/mysql-test-run.pl:
  Bug#29903 The CMake build method does not produce the embedded library.
  - Move embedded option block earlier in the script.
  - Added the path to the libmysqld.dll to Windows path.
win/README:
  Bug#29903 The CMake build method does not produce the embedded library.
  - Add instructions for building/testing the embedded library.
parent 6f88aa45
...@@ -1099,6 +1099,7 @@ libmysqld/item_sum.cc ...@@ -1099,6 +1099,7 @@ libmysqld/item_sum.cc
libmysqld/item_timefunc.cc libmysqld/item_timefunc.cc
libmysqld/item_uniq.cc libmysqld/item_uniq.cc
libmysqld/key.cc libmysqld/key.cc
libmysqld/lex_hash.h
libmysqld/lib_sql.cpp libmysqld/lib_sql.cpp
libmysqld/libmysql.c libmysqld/libmysql.c
libmysqld/link_sources libmysqld/link_sources
...@@ -1107,6 +1108,8 @@ libmysqld/log.cc ...@@ -1107,6 +1108,8 @@ libmysqld/log.cc
libmysqld/log_event.cc libmysqld/log_event.cc
libmysqld/log_event_old.cc libmysqld/log_event_old.cc
libmysqld/md5.c libmysqld/md5.c
libmysqld/message.h
libmysqld/message.rc
libmysqld/mf_iocache.cc libmysqld/mf_iocache.cc
libmysqld/mini_client.cc libmysqld/mini_client.cc
libmysqld/my_decimal.cc libmysqld/my_decimal.cc
......
...@@ -18,22 +18,24 @@ PROJECT(MySql) ...@@ -18,22 +18,24 @@ PROJECT(MySql)
# This reads user configuration, generated by configure.js. # This reads user configuration, generated by configure.js.
INCLUDE(win/configure.data) INCLUDE(win/configure.data)
# By default, CMake will create Release, Debug, RelWithDebInfo and MinSizeRel # Hardcode support for CSV storage engine
# configurations. The EMBEDDED_ONLY build parameter is necessary because CMake SET(WITH_CSV_STORAGE_ENGINE TRUE)
# doesn't support custom build configurations for VS2005. Since the Debug
# configuration does not work properly with USE_TLS defined # CMAKE will not allow custom VS7+ configurations. mysqld and libmysqld
# (see mysys/CMakeLists.txt) the easiest way to debug the Embedded Server is to # cannot be built at the same time as they require different configurations
# use the RelWithDebInfo configuration without optimizations. IF(EMBEDDED_ONLY)
# ADD_DEFINITIONS(-DEMBEDDED_LIBRARY)
# Debug default CXX_FLAGS "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1" # By default, CMake will create Release, Debug, RelWithDebInfo and MinSizeRel
# RelWithDebInfo default CXX_FLAGS "/MD /Zi /O2 /Ob1 /D NDEBUG" # configurations. The EMBEDDED_ONLY build parameter is necessary because CMake
# # doesn't support custom build configurations for VS2005. Since the Debug
IF(NOT EMBEDDED_ONLY) # configuration does not work properly with USE_TLS defined
# Hardcode support for CSV storage engine # (see mysys/CMakeLists.txt) the easiest way to debug the Embedded Server is to
SET(WITH_CSV_STORAGE_ENGINE TRUE) # use the RelWithDebInfo configuration without optimizations.
ELSE(NOT EMBEDDED_ONLY) #
# Debug default CXX_FLAGS "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1"
# RelWithDebInfo default CXX_FLAGS "/MD /Zi /O2 /Ob1 /D NDEBUG"
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /Zi /Od /Ob0 /D NDEBUG" CACHE STRING "No Optimization" FORCE) SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /Zi /Od /Ob0 /D NDEBUG" CACHE STRING "No Optimization" FORCE)
ENDIF(NOT EMBEDDED_ONLY) ENDIF(EMBEDDED_ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
${CMAKE_SOURCE_DIR}/include/mysql_version.h @ONLY) ${CMAKE_SOURCE_DIR}/include/mysql_version.h @ONLY)
...@@ -241,14 +243,11 @@ ENDIF(WITH_FEDERATED_STORAGE_ENGINE) ...@@ -241,14 +243,11 @@ ENDIF(WITH_FEDERATED_STORAGE_ENGINE)
IF(WITH_INNOBASE_STORAGE_ENGINE) IF(WITH_INNOBASE_STORAGE_ENGINE)
ADD_SUBDIRECTORY(storage/innobase) ADD_SUBDIRECTORY(storage/innobase)
ENDIF(WITH_INNOBASE_STORAGE_ENGINE) ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
# CMAKE will not allow custom VS7+ configurations. mysqld and libmysqld ADD_SUBDIRECTORY(client)
# cannot be built at the same time as they require different configurations
IF(EMBEDDED_ONLY) IF(EMBEDDED_ONLY)
ADD_DEFINITIONS(-DEMBEDDED_LIBRARY)
ADD_SUBDIRECTORY(libmysqld) ADD_SUBDIRECTORY(libmysqld)
ADD_SUBDIRECTORY(libmysqld/examples) ADD_SUBDIRECTORY(libmysqld/examples)
ELSE(EMBEDDED_ONLY) ELSE(EMBEDDED_ONLY)
ADD_SUBDIRECTORY(client)
ADD_SUBDIRECTORY(sql) ADD_SUBDIRECTORY(sql)
ADD_SUBDIRECTORY(server-tools/instance-manager) ADD_SUBDIRECTORY(server-tools/instance-manager)
ADD_SUBDIRECTORY(libmysql) ADD_SUBDIRECTORY(libmysql)
......
...@@ -104,40 +104,43 @@ ADD_LIBRARY(mysqlclient ../mysys/array.c ../strings/bchange.c ../strings/bmove.c ...@@ -104,40 +104,43 @@ ADD_LIBRARY(mysqlclient ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
) )
ADD_DEPENDENCIES(mysqlclient GenError) ADD_DEPENDENCIES(mysqlclient GenError)
ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc)
LINK_DIRECTORIES(${MYSQL_BINARY_DIR}/mysys ${MYSQL_BINARY_DIR}/zlib)
TARGET_LINK_LIBRARIES(mysql mysqlclient mysys zlib dbug wsock32)
ADD_EXECUTABLE(mysqltest mysqltest.c) IF(NOT EMBEDDED_ONLY)
TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys zlib dbug regex wsock32) ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc)
LINK_DIRECTORIES(${MYSQL_BINARY_DIR}/mysys ${MYSQL_BINARY_DIR}/zlib)
TARGET_LINK_LIBRARIES(mysql mysqlclient mysys zlib dbug wsock32)
ADD_EXECUTABLE(mysqlcheck mysqlcheck.c) ADD_EXECUTABLE(mysqltest mysqltest.c)
TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient dbug zlib wsock32) TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys zlib dbug regex wsock32)
ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c) ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
TARGET_LINK_LIBRARIES(mysqldump mysqlclient mysys dbug zlib wsock32) TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient dbug zlib wsock32)
ADD_EXECUTABLE(mysqlimport mysqlimport.c) ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c)
TARGET_LINK_LIBRARIES(mysqlimport mysqlclient mysys dbug zlib wsock32) TARGET_LINK_LIBRARIES(mysqldump mysqlclient mysys dbug zlib wsock32)
ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c ../mysys/my_getpagesize.c) ADD_EXECUTABLE(mysqlimport mysqlimport.c)
TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient dbug zlib wsock32) TARGET_LINK_LIBRARIES(mysqlimport mysqlclient mysys dbug zlib wsock32)
ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs)
ADD_EXECUTABLE(mysqlshow mysqlshow.c) ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c ../mysys/my_getpagesize.c)
TARGET_LINK_LIBRARIES(mysqlshow mysqlclient mysys dbug zlib wsock32) TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient dbug zlib wsock32)
ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs)
ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc ../mysys/mf_tempdir.c ../mysys/my_new.cc ADD_EXECUTABLE(mysqlshow mysqlshow.c)
TARGET_LINK_LIBRARIES(mysqlshow mysqlclient mysys dbug zlib wsock32)
ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc ../mysys/mf_tempdir.c ../mysys/my_new.cc
../mysys/my_bit.c ../mysys/my_bitmap.c ../mysys/my_vle.c ../mysys/my_bit.c ../mysys/my_bitmap.c ../mysys/my_vle.c
../mysys/base64.c) ../mysys/base64.c)
TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient dbug zlib wsock32) TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient dbug zlib wsock32)
ADD_EXECUTABLE(mysqladmin mysqladmin.cc) ADD_EXECUTABLE(mysqladmin mysqladmin.cc)
TARGET_LINK_LIBRARIES(mysqladmin mysqlclient mysys dbug zlib wsock32) TARGET_LINK_LIBRARIES(mysqladmin mysqlclient mysys dbug zlib wsock32)
ADD_EXECUTABLE(mysqlslap mysqlslap.c) ADD_EXECUTABLE(mysqlslap mysqlslap.c)
SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS") SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqlslap mysqlclient mysys zlib wsock32 dbug) TARGET_LINK_LIBRARIES(mysqlslap mysqlclient mysys zlib wsock32 dbug)
ENDIF(NOT EMBEDDED_ONLY)
ADD_EXECUTABLE(echo echo.c) ADD_EXECUTABLE(echo echo.c)
......
...@@ -48,7 +48,7 @@ enum options_client ...@@ -48,7 +48,7 @@ enum options_client
OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL, OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL,
OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION, OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION,
OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH, OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH,
OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS, OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS, OPT_SERVER_ARG,
OPT_START_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME, OPT_START_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME,
OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY, OPT_COUNT, OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY, OPT_COUNT,
#ifdef HAVE_NDBCLUSTER_DB #ifdef HAVE_NDBCLUSTER_DB
......
...@@ -51,6 +51,9 @@ const char *VER= "14.13"; ...@@ -51,6 +51,9 @@ const char *VER= "14.13";
/* Buffer to hold 'version' and 'version_comment' */ /* Buffer to hold 'version' and 'version_comment' */
#define MAX_SERVER_VERSION_LENGTH 128 #define MAX_SERVER_VERSION_LENGTH 128
/* Array of options to pass to libemysqld */
#define MAX_SERVER_ARGS 64
void* sql_alloc(unsigned size); // Don't use mysqld alloc for these void* sql_alloc(unsigned size); // Don't use mysqld alloc for these
void sql_element_free(void *ptr); void sql_element_free(void *ptr);
#include "sql_string.h" #include "sql_string.h"
...@@ -302,7 +305,10 @@ static COMMANDS commands[] = { ...@@ -302,7 +305,10 @@ static COMMANDS commands[] = {
}; };
static const char *load_default_groups[]= { "mysql","client",0 }; static const char *load_default_groups[]= { "mysql","client",0 };
static const char *server_default_groups[]=
static int embedded_server_arg_count= 0;
static char *embedded_server_args[MAX_SERVER_ARGS];
static const char *embedded_server_groups[]=
{ "server", "embedded", "mysql_SERVER", 0 }; { "server", "embedded", "mysql_SERVER", 0 };
#ifdef HAVE_READLINE #ifdef HAVE_READLINE
...@@ -347,15 +353,6 @@ static sig_handler handle_sigint(int sig); ...@@ -347,15 +353,6 @@ static sig_handler handle_sigint(int sig);
int main(int argc,char *argv[]) int main(int argc,char *argv[])
{ {
char buff[80]; char buff[80];
char *defaults, *extra_defaults, *group_suffix;
char *emb_argv[4];
int emb_argc;
/* Get --defaults-xxx args for mysql_server_init() */
emb_argc= get_defaults_options(argc, argv, &defaults, &extra_defaults,
&group_suffix)+1;
memcpy((char*) emb_argv, (char*) argv, emb_argc * sizeof(*argv));
emb_argv[emb_argc]= 0;
MY_INIT(argv[0]); MY_INIT(argv[0]);
DBUG_ENTER("main"); DBUG_ENTER("main");
...@@ -416,7 +413,8 @@ int main(int argc,char *argv[]) ...@@ -416,7 +413,8 @@ int main(int argc,char *argv[])
my_end(0); my_end(0);
exit(1); exit(1);
} }
if (mysql_server_init(emb_argc, emb_argv, (char**) server_default_groups)) if (mysql_server_init(embedded_server_arg_count, embedded_server_args,
(char**) embedded_server_groups))
{ {
free_defaults(defaults_argv); free_defaults(defaults_argv);
my_end(0); my_end(0);
...@@ -539,6 +537,8 @@ sig_handler mysql_end(int sig) ...@@ -539,6 +537,8 @@ sig_handler mysql_end(int sig)
my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
#endif #endif
my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR)); my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR));
while (embedded_server_arg_count > 1)
my_free(embedded_server_args[--embedded_server_arg_count],MYF(0));
mysql_server_end(); mysql_server_end();
free_defaults(defaults_argv); free_defaults(defaults_argv);
my_end(info_flag ? MY_CHECK_ERROR : 0); my_end(info_flag ? MY_CHECK_ERROR : 0);
...@@ -761,6 +761,8 @@ static struct my_option my_long_options[] = ...@@ -761,6 +761,8 @@ static struct my_option my_long_options[] =
{"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it" {"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it"
" uses old (pre-4.1.1) protocol", (uchar**) &opt_secure_auth, " uses old (pre-4.1.1) protocol", (uchar**) &opt_secure_auth,
(uchar**) &opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, (uchar**) &opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"server-arg", OPT_SERVER_ARG, "Send embedded server this as a parameter.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"show-warnings", OPT_SHOW_WARNINGS, "Show warnings after every statement.", {"show-warnings", OPT_SHOW_WARNINGS, "Show warnings after every statement.",
(uchar**) &show_warnings, (uchar**) &show_warnings, 0, GET_BOOL, NO_ARG, (uchar**) &show_warnings, (uchar**) &show_warnings, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
...@@ -888,6 +890,28 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -888,6 +890,28 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name); opt->name);
break; break;
case OPT_SERVER_ARG:
#ifdef EMBEDDED_LIBRARY
/*
When the embedded server is being tested, the client needs to be
able to pass command-line arguments to the embedded server so it can
locate the language files and data directory.
*/
if (!embedded_server_arg_count)
{
embedded_server_arg_count= 1;
embedded_server_args[0]= (char*) "";
}
if (embedded_server_arg_count == MAX_SERVER_ARGS-1 ||
!(embedded_server_args[embedded_server_arg_count++]=
my_strdup(argument, MYF(MY_FAE))))
{
put_info("Can't use server argument", INFO_ERROR);
return 0;
}
#else /*EMBEDDED_LIBRARY */
printf("WARNING: --server-arg option not supported in this configuration.\n");
#endif
break; break;
case 'A': case 'A':
opt_rehash= 0; opt_rehash= 0;
......
...@@ -33,8 +33,12 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ...@@ -33,8 +33,12 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/zlib ${CMAKE_SOURCE_DIR}/zlib
) )
SET_SOURCE_FILES_PROPERTIES(${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc SET_SOURCE_FILES_PROPERTIES(sql_yacc.cc
${PROJECT_SOURCE_DIR}/sql/sql_yacc.h sql_yacc.h
message.h
message.rc
${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc
lex_hash.h
PROPERTIES GENERATED 1) PROPERTIES GENERATED 1)
ADD_LIBRARY(mysqldemb emb_qcache.cc libmysqld.c lib_sql.cc ADD_LIBRARY(mysqldemb emb_qcache.cc libmysqld.c lib_sql.cc
...@@ -80,10 +84,54 @@ ADD_LIBRARY(mysqldemb emb_qcache.cc libmysqld.c lib_sql.cc ...@@ -80,10 +84,54 @@ ADD_LIBRARY(mysqldemb emb_qcache.cc libmysqld.c lib_sql.cc
../sql/scheduler.cc ../sql/scheduler.cc
../vio/vio.c ../vio/viosocket.c ../vio/viossl.c ../vio/vio.c ../vio/viosocket.c ../vio/viossl.c
../vio/viosslfactories.c ../vio/viosslfactories.c
${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc sql_yacc.cc
${PROJECT_SOURCE_DIR}/sql/sql_yacc.h) sql_yacc.h
message.h
message.rc
lex_hash.h)
ADD_DEPENDENCIES(mysqldemb GenError) ADD_DEPENDENCIES(mysqldemb GenError)
# Sql Parser custom command
ADD_CUSTOM_COMMAND(
SOURCE ${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy
OUTPUT sql_yacc.cc
COMMAND bison.exe
ARGS -y -p MYSQL --defines=sql_yacc.h
--output=sql_yacc.cc ${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy
DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy
)
ADD_CUSTOM_COMMAND(
OUTPUT sql_yacc.h
COMMAND echo
DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
)
# Windows message file
ADD_CUSTOM_COMMAND(
SOURCE ${CMAKE_SOURCE_DIR}/sql/message.mc
OUTPUT message.rc message.h
COMMAND mc
ARGS ${CMAKE_SOURCE_DIR}/sql/message.mc
DEPENDS ${CMAKE_SOURCE_DIR}/sql/message.mc
)
# Gen_lex_hash
ADD_EXECUTABLE(gen_lex_hash ../sql/gen_lex_hash.cc)
TARGET_LINK_LIBRARIES(gen_lex_hash dbug mysqlclient wsock32)
GET_TARGET_PROPERTY(GEN_LEX_HASH_EXE gen_lex_hash LOCATION)
ADD_CUSTOM_COMMAND(
OUTPUT lex_hash.h
COMMAND ${GEN_LEX_HASH_EXE} ARGS > lex_hash.h
DEPENDS ${GEN_LEX_HASH_EXE}
)
# Remove the auto-generated files as part of 'Clean Solution'
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
"lex_hash.h;message.rc;message.h;sql_yacc.h;sql_yacc.cc")
ADD_DEPENDENCIES(mysqldemb gen_lex_hash)
# Seems we cannot make a library without at least one source file. So use a # Seems we cannot make a library without at least one source file. So use a
# dummy empty file # dummy empty file
FILE(WRITE cmake_dummy.c " ") FILE(WRITE cmake_dummy.c " ")
...@@ -120,3 +168,6 @@ ENDIF(WITH_ARCHIVE_STORAGE_ENGINE) ...@@ -120,3 +168,6 @@ ENDIF(WITH_ARCHIVE_STORAGE_ENGINE)
IF(WITH_BLACKHOLE_STORAGE_ENGINE) IF(WITH_BLACKHOLE_STORAGE_ENGINE)
TARGET_LINK_LIBRARIES(libmysqld blackhole) TARGET_LINK_LIBRARIES(libmysqld blackhole)
ENDIF(WITH_BLACKHOLE_STORAGE_ENGINE) ENDIF(WITH_BLACKHOLE_STORAGE_ENGINE)
IF(WITH_CSV_STORAGE_ENGINE)
TARGET_LINK_LIBRARIES(libmysqld csv)
ENDIF(WITH_CSV_STORAGE_ENGINE)
...@@ -22,7 +22,7 @@ MYSQLSHAREdir = $(pkgdatadir) ...@@ -22,7 +22,7 @@ MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix) MYSQLBASEdir= $(prefix)
MYSQLLIBdir= $(libdir) MYSQLLIBdir= $(libdir)
EXTRA_DIST = libmysqld.def EXTRA_DIST = libmysqld.def CMakeLists.txt
DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \ -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \ -DDATADIR="\"$(MYSQLDATAdir)\"" \
......
...@@ -23,11 +23,11 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ...@@ -23,11 +23,11 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
# Currently does not work with DBUG, there are missing symbols reported. # Currently does not work with DBUG, there are missing symbols reported.
ADD_DEFINITIONS(-DDBUG_OFF) ADD_DEFINITIONS(-DDBUG_OFF)
ADD_DEFINITIONS(-DUSE_TLS) ADD_DEFINITIONS(-DUSE_TLS)
ADD_EXECUTABLE(test_libmysqld ../../client/completion_hash.cc ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
../../client/mysql.cc ../../client/readline.cc ../../client/mysql.cc ../../client/readline.cc
../../client/sql_string.cc) ../../client/sql_string.cc)
TARGET_LINK_LIBRARIES(test_libmysqld mysys yassl taocrypt zlib dbug regex strings wsock32) TARGET_LINK_LIBRARIES(mysql_embedded mysys yassl taocrypt zlib dbug regex strings wsock32)
ADD_DEPENDENCIES(test_libmysqld libmysqld) ADD_DEPENDENCIES(mysql_embedded libmysqld)
ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.c) ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.c)
TARGET_LINK_LIBRARIES(mysqltest_embedded mysys yassl taocrypt zlib dbug regex strings wsock32) TARGET_LINK_LIBRARIES(mysqltest_embedded mysys yassl taocrypt zlib dbug regex strings wsock32)
......
...@@ -19,6 +19,7 @@ client_sources = $(mysqltest_embedded_SOURCES) $(mysql_SOURCES) ...@@ -19,6 +19,7 @@ client_sources = $(mysqltest_embedded_SOURCES) $(mysql_SOURCES)
tests_sources = $(mysql_client_test_embedded_SOURCES) tests_sources = $(mysql_client_test_embedded_SOURCES)
BUILT_SOURCES = link_sources BUILT_SOURCES = link_sources
CLEANFILES = $(client_sources) $(tests_sources) $(BUILT_SOURCES) CLEANFILES = $(client_sources) $(tests_sources) $(BUILT_SOURCES)
EXTRA_DIST = CMakeLists.txt
link_sources: link_sources:
for f in $(client_sources); do \ for f in $(client_sources); do \
......
...@@ -693,6 +693,37 @@ sub command_line_setup () { ...@@ -693,6 +693,37 @@ sub command_line_setup () {
$glob_timers= mtr_init_timers(); $glob_timers= mtr_init_timers();
# --------------------------------------------------------------------------
# Embedded server flag
# --------------------------------------------------------------------------
if ( $opt_embedded_server )
{
$glob_use_embedded_server= 1;
# Add the location for libmysqld.dll to the path.
if ( $glob_win32 )
{
my $lib_mysqld=
mtr_path_exists(vs_config_dirs('libmysqld',''));
$lib_mysqld= $glob_cygwin_perl ? ":".`cygpath "$lib_mysqld"`
: ";".$lib_mysqld;
chomp($lib_mysqld);
$ENV{'PATH'}="$ENV{'PATH'}".$lib_mysqld;
}
push(@glob_test_mode, "embedded");
$opt_skip_rpl= 1; # We never run replication with embedded
$opt_skip_ndbcluster= 1; # Turn off use of NDB cluster
$opt_skip_ssl= 1; # Turn off use of SSL
# Turn off use of bin log
push(@opt_extra_mysqld_opt, "--skip-log-bin");
if ( $opt_extern )
{
mtr_error("Can't use --extern with --embedded-server");
}
}
# #
# Find the mysqld executable to be able to find the mysqld version # Find the mysqld executable to be able to find the mysqld version
# number as early as possible # number as early as possible
......
...@@ -65,6 +65,8 @@ The options right now are: ...@@ -65,6 +65,8 @@ The options right now are:
EMBED_MANIFESTS Embed custom manifests into final exes, otherwise VS EMBED_MANIFESTS Embed custom manifests into final exes, otherwise VS
default will be used. (Note - This option should only be default will be used. (Note - This option should only be
used by MySQL AB.) used by MySQL AB.)
EMBEDDED_ONLY Configure solution to produce libmysqld.dll
default will be used.
So the command line could look like: So the command line could look like:
...@@ -98,3 +100,16 @@ may be necessary to clean the build tree to remove any stale objects. ...@@ -98,3 +100,16 @@ may be necessary to clean the build tree to remove any stale objects.
Please see this link: http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/ Please see this link: http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
At step 5 you only need to add the libraries advapi32.lib and user32.lib to At step 5 you only need to add the libraries advapi32.lib and user32.lib to
the file "corewin_express.vsprops" in order to avoid link errors. the file "corewin_express.vsprops" in order to avoid link errors.
3. Testing the Windows embedded library requires a two step process. The extra
step is necessary because the testsuite requires mysqld to run properly but both
the embedded library and the mysqld executable cannot be built at the same time.
Here's the process for building and testing the embedded library:
A. Follow steps 1 - 7 listed above to produce the Release configuration.
B. Perform step 5 from above again adding "--EMBEDDED-ONLY" to previously
supplied options.
C. Complete the build steps above to produce the Release configuration. Make
sure to Rebuild the solution so that all libraries are re-built.
D. Run the testsuite as usual.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment