mirror of
https://github.com/MariaDB/server.git
synced 2025-01-26 00:34:18 +01:00
implement convenience libraries
This commit is contained in:
parent
9abc7cf070
commit
7377c50cb4
20 changed files with 476 additions and 309 deletions
CMakeLists.txt
cmake
Makefile.amcharacter_sets.cmakeconfigurable_file_content.ininstall_macros.cmakelibutils.cmakemisc.cmakeplugin.cmake
dbug
extra
libmysql
libmysqld
mysys
regex
strings
vio
zlib
|
@ -61,7 +61,7 @@ INCLUDE(cmake/zlib.cmake)
|
|||
INCLUDE(cmake/ssl.cmake)
|
||||
INCLUDE(cmake/readline.cmake)
|
||||
INCLUDE(cmake/mysql_version.cmake)
|
||||
INCLUDE(cmake/misc.cmake)
|
||||
INCLUDE(cmake/libutils.cmake)
|
||||
INCLUDE(cmake/dtrace.cmake)
|
||||
INCLUDE(cmake/plugin.cmake)
|
||||
INCLUDE(cmake/install_macros.cmake)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
EXTRA_DIST = \
|
||||
cat.cmake \
|
||||
ConfigurableFileContent.in \
|
||||
check_minimal_version.cmake \
|
||||
create_initial_db.cmake.in \
|
||||
make_dist.cmake.in \
|
||||
|
@ -8,7 +9,7 @@ EXTRA_DIST = \
|
|||
bison.cmake \
|
||||
configure.pl \
|
||||
character_sets.cmake \
|
||||
misc.cmake \
|
||||
libutils.cmake \
|
||||
readline.cmake \
|
||||
mysql_version.cmake \
|
||||
install_macros.cmake \
|
||||
|
|
|
@ -33,13 +33,9 @@ latin1 latin2 latin5 latin7 macce macroman
|
|||
sjis swe7 tis620 ucs2 ujis utf8 utf8mb3 utf16 utf32)
|
||||
|
||||
|
||||
IF(WIN32)
|
||||
SET (EXTRA_CHARSETS "all")
|
||||
ELSE()
|
||||
SET (EXTRA_CHARSETS "none")
|
||||
ENDIF()
|
||||
SET (EXTRA_CHARSETS "all")
|
||||
SET(WITH_EXTRA_CHARSETS ${EXTRA_CHARSETS} CACHE
|
||||
STRING "Options are: none, complex,all")
|
||||
STRING "Options are: none, complex, all")
|
||||
|
||||
|
||||
IF(WITH_EXTRA_CHARSETS MATCHES "complex")
|
||||
|
|
1
cmake/configurable_file_content.in
Normal file
1
cmake/configurable_file_content.in
Normal file
|
@ -0,0 +1 @@
|
|||
@CMAKE_CONFIGURABLE_FILE_CONTENT@
|
|
@ -19,13 +19,13 @@ MACRO (INSTALL_DEBUG_SYMBOLS targets)
|
|||
GET_TARGET_PROPERTY(location ${target} LOCATION)
|
||||
GET_TARGET_PROPERTY(type ${target} TYPE)
|
||||
IF(NOT INSTALL_LOCATION)
|
||||
IF(type MATCHES "STATIC_LIBRARY" OR type MATCHES "MODULE_LIBRARY" OR type MATCHES "SHARED_LIBRARY")
|
||||
IF(type MATCHES "STATIC_LIBRARY" OR type MATCHES "MODULE_LIBRARY" OR type MATCHES "SHARED_LIBRARY")
|
||||
SET(INSTALL_LOCATION "lib")
|
||||
ELSEIF(type MATCHES "EXECUTABLE")
|
||||
ELSEIF(type MATCHES "EXECUTABLE")
|
||||
SET(INSTALL_LOCATION "bin")
|
||||
ELSE()
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "cannot determine type of ${target}. Don't now where to install")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
STRING(REPLACE ".exe" ".pdb" pdb_location ${location})
|
||||
STRING(REPLACE ".dll" ".pdb" pdb_location ${pdb_location})
|
||||
|
|
291
cmake/libutils.cmake
Normal file
291
cmake/libutils.cmake
Normal file
|
@ -0,0 +1,291 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
# This file exports macros that emulate some functionality found in GNU libtool
|
||||
# on Unix systems. One such feature is convenience libraries. In this context,
|
||||
# convenience library is a static library that can be linked to shared library
|
||||
# On systems that force position-independent code, linking into shared library
|
||||
# normally requires compilation with a special flag (often -fPIC). To enable
|
||||
# linking static libraries to shared, we compile source files that come into
|
||||
# static library with the PIC flag (${CMAKE_SHARED_LIBRARY_C_FLAGS} in CMake)
|
||||
# Some systems, like Windows or OSX do not need special compilation (Windows
|
||||
# never uses PIC and OSX always uses it).
|
||||
#
|
||||
# The intention behind convenience libraries is simplify the build and to reduce
|
||||
# excessive recompiles.
|
||||
|
||||
# Except for convenience libraries, this file provides macros to merge static
|
||||
# libraries (we need it for mysqlclient) and to create shared library out of
|
||||
# convenience libraries(again, for mysqlclient)
|
||||
|
||||
# Following macros are exported
|
||||
# - ADD_CONVENIENCE_LIBRARY(target source1...sourceN)
|
||||
# This macro creates convenience library. The functionality is similar to
|
||||
# ADD_LIBRARY(target STATIC source1...sourceN), the difference is that resulting
|
||||
# library can always be linked to shared library
|
||||
#
|
||||
# - MERGE_LIBRARIES(target [STATIC|SHARED|MODULE] [linklib1 .... linklibN]
|
||||
# [EXPORTS exported_func1 .... exported_func_N]
|
||||
# [OUTPUT_NAME output_name]
|
||||
# This macro merges several static libraries into a single one or creates a shared
|
||||
# library from several convenience libraries
|
||||
|
||||
# Important global flags
|
||||
# - WITH_PIC : If set, it is assumed that everything is compiled as position
|
||||
# independent code (that is CFLAGS/CMAKE_C_FLAGS contain -fPIC or equivalent)
|
||||
# If defined, ADD_CONVENIENCE_LIBRARY does not add PIC flag to compile flags
|
||||
#
|
||||
# - DISABLE_SHARED: If set, it is assumed that shared libraries are not produced
|
||||
# during the build. ADD_CONVENIENCE_LIBRARY does not add anything to compile flags
|
||||
|
||||
|
||||
GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
IF(NOT WIN32 AND NOT CYGWIN AND NOT APPLE AND NOT WITH_PIC AND NOT DISABLE_SHARED
|
||||
AND CMAKE_SHARED_LIBRARY_C_FLAGS)
|
||||
SET(_SKIP_PIC 1)
|
||||
ENDIF()
|
||||
|
||||
# CREATE_EXPORT_FILE (VAR target api_functions)
|
||||
# Internal macro, used to create source file for shared libraries that
|
||||
# otherwise consists entirely of "convenience" libraries. On Windows,
|
||||
# also exports API functions as dllexport. On unix, creates a dummy file
|
||||
# that references all exports and this prevents linker from creating an
|
||||
# empty library(there are unportable alternatives, --whole-archive)
|
||||
MACRO(CREATE_EXPORT_FILE VAR TARGET API_FUNCTIONS)
|
||||
IF(WIN32)
|
||||
SET(DUMMY ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_dummy.c)
|
||||
SET(EXPORTS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_exports.def)
|
||||
CONFIGURE_FILE_CONTENT("" ${DUMMY})
|
||||
SET(CONTENT "EXPORTS\n")
|
||||
FOREACH(FUNC ${API_FUNCTIONS})
|
||||
SET(CONTENT "${CONTENT} ${FUNC}\n")
|
||||
ENDFOREACH()
|
||||
CONFIGURE_FILE_CONTENT(${CONTENT} ${EXPORTS})
|
||||
SET(${VAR} ${DUMMY} ${EXPORTS})
|
||||
ELSE()
|
||||
SET(EXPORTS ${CMAKE_CURRENT_BINARY_DIR}/${target}_exports_file.cc)
|
||||
SET(CONTENT)
|
||||
FOREACH(FUNC ${API_FUNCTIONS})
|
||||
SET(CONTENT "${CONTENT} extern void* ${FUNC}\;\n")
|
||||
ENDFOREACH()
|
||||
SET(CONTENT "${CONTENT} void *${TARGET}_api_funcs[] = {\n")
|
||||
FOREACH(FUNC ${API_FUNCTIONS})
|
||||
SET(CONTENT "${CONTENT} &${FUNC},\n")
|
||||
ENDFOREACH()
|
||||
SET(CONTENT "${CONTENT} (void *)0\n}\;")
|
||||
CONFIGURE_FILE_CONTENT(${CONTENT} ${EXPORTS})
|
||||
SET(${VAR} ${EXPORTS})
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
|
||||
# MYSQL_ADD_CONVENIENCE_LIBRARY(name source1...sourceN)
|
||||
# Create static library that can be linked to shared library.
|
||||
# On systems that force position-independent code, adds -fPIC or
|
||||
# equivalent flag to compile flags.
|
||||
MACRO(ADD_CONVENIENCE_LIBRARY)
|
||||
SET(TARGET ${ARGV0})
|
||||
SET(SOURCES ${ARGN})
|
||||
LIST(REMOVE_AT SOURCES 0)
|
||||
ADD_LIBRARY(${TARGET} STATIC ${SOURCES})
|
||||
IF(NOT _SKIP_PIC)
|
||||
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS
|
||||
"${CMAKE_SHARED_LIBRARY_C_FLAGS}")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
|
||||
# Handy macro to parse macro arguments
|
||||
MACRO(CMAKE_PARSE_ARGUMENTS prefix arg_names option_names)
|
||||
SET(DEFAULT_ARGS)
|
||||
FOREACH(arg_name ${arg_names})
|
||||
SET(${prefix}_${arg_name})
|
||||
ENDFOREACH(arg_name)
|
||||
FOREACH(option ${option_names})
|
||||
SET(${prefix}_${option} FALSE)
|
||||
ENDFOREACH(option)
|
||||
|
||||
SET(current_arg_name DEFAULT_ARGS)
|
||||
SET(current_arg_list)
|
||||
FOREACH(arg ${ARGN})
|
||||
SET(larg_names ${arg_names})
|
||||
LIST(FIND larg_names "${arg}" is_arg_name)
|
||||
IF (is_arg_name GREATER -1)
|
||||
SET(${prefix}_${current_arg_name} ${current_arg_list})
|
||||
SET(current_arg_name ${arg})
|
||||
SET(current_arg_list)
|
||||
ELSE (is_arg_name GREATER -1)
|
||||
SET(loption_names ${option_names})
|
||||
LIST(FIND loption_names "${arg}" is_option)
|
||||
IF (is_option GREATER -1)
|
||||
SET(${prefix}_${arg} TRUE)
|
||||
ELSE (is_option GREATER -1)
|
||||
SET(current_arg_list ${current_arg_list} ${arg})
|
||||
ENDIF (is_option GREATER -1)
|
||||
ENDIF (is_arg_name GREATER -1)
|
||||
ENDFOREACH(arg)
|
||||
SET(${prefix}_${current_arg_name} ${current_arg_list})
|
||||
ENDMACRO()
|
||||
|
||||
# Write content to file, using CONFIGURE_FILE
|
||||
# The advantage compared to FILE(WRITE) is that timestamp
|
||||
# does not change if file already has the same content
|
||||
MACRO(CONFIGURE_FILE_CONTENT content file)
|
||||
SET(CMAKE_CONFIGURABLE_FILE_CONTENT
|
||||
"${content}\n")
|
||||
CONFIGURE_FILE(
|
||||
${MYSQL_CMAKE_SCRIPT_DIR}/configurable_file_content.in
|
||||
${file}
|
||||
@ONLY)
|
||||
ENDMACRO()
|
||||
|
||||
# Merge static libraries into a big static lib. The resulting library
|
||||
# should not not have dependencies on other static libraries.
|
||||
# We use it in MySQL to merge mysys,dbug,vio etc into mysqlclient
|
||||
|
||||
MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
|
||||
# To produce a library we need at least one source file.
|
||||
# It is created by ADD_CUSTOM_COMMAND below and will helps
|
||||
# also help to track dependencies.
|
||||
SET(SOURCE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_depends.c)
|
||||
ADD_LIBRARY(${TARGET} STATIC ${SOURCE_FILE})
|
||||
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES OUTPUT_NAME ${OUTPUT_NAME})
|
||||
|
||||
FOREACH(LIB ${LIBS_TO_MERGE})
|
||||
GET_TARGET_PROPERTY(LIB_LOCATION ${LIB} LOCATION)
|
||||
GET_TARGET_PROPERTY(LIB_TYPE ${LIB} TYPE)
|
||||
IF(NOT LIB_LOCATION)
|
||||
# 3rd party library like libz.so. Make sure that everything
|
||||
# that links to our library links to this one as well.
|
||||
TARGET_LINK_LIBRARIES(${TARGET} ${LIB})
|
||||
ELSE()
|
||||
# This is a target in current project
|
||||
# (can be a static or shared lib)
|
||||
IF(LIB_TYPE STREQUAL "STATIC_LIBRARY")
|
||||
SET(STATIC_LIBS ${STATIC_LIBS} ${LIB_LOCATION})
|
||||
ADD_DEPENDENCIES(${TARGET} ${LIB})
|
||||
ELSE()
|
||||
# This is a shared library our static lib depends on.
|
||||
TARGET_LINK_LIBRARIES(${TARGET} ${LIB})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
# Make the generated dummy source file depended on all static input
|
||||
# libs. If input lib changes,the source file is touched
|
||||
# which causes the desired effect (relink).
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${SOURCE_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${SOURCE_FILE}
|
||||
DEPENDS ${STATIC_LIBS})
|
||||
|
||||
IF(MSVC)
|
||||
# To merge libs, just pass them to lib.exe command line.
|
||||
SET(LINKER_EXTRA_FLAGS "")
|
||||
FOREACH(LIB ${STATIC_LIBS})
|
||||
SET(LINKER_EXTRA_FLAGS "${LINKER_EXTRA_FLAGS} ${LIB}")
|
||||
ENDFOREACH()
|
||||
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES STATIC_LIBRARY_FLAGS
|
||||
"${LINKER_EXTRA_FLAGS}")
|
||||
ELSE()
|
||||
GET_TARGET_PROPERTY(TARGET_LOCATION ${TARGET} LOCATION)
|
||||
IF(APPLE)
|
||||
# Use OSX's libtool to merge archives (ihandles universal
|
||||
# binaries properly)
|
||||
ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND rm ${TARGET_LOCATION}
|
||||
COMMAND /usr/bin/libtool -static -o ${TARGET_LOCATION}
|
||||
${STATIC_LIBS}
|
||||
)
|
||||
ELSE()
|
||||
# Generic Unix, Cygwin or MinGW. In post-build step, call
|
||||
# script, that extracts objects from archives with "ar x"
|
||||
# and repacks them with "ar r"
|
||||
SET(TARGET ${TARGET})
|
||||
CONFIGURE_FILE(
|
||||
${MYSQL_CMAKE_SCRIPT_DIR}/merge_archives_unix.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET}.cmake
|
||||
@ONLY
|
||||
)
|
||||
ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND rm ${TARGET_LOCATION}
|
||||
COMMAND ${CMAKE_COMMAND} -P
|
||||
${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET}.cmake
|
||||
)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
# Create libs from libs.
|
||||
# Merges static libraries, creates shared libraries out of convenience libraries.
|
||||
# MYSQL_MERGE_LIBRARIES(target [STATIC|SHARED|MODULE]
|
||||
# [linklib1 .... linklibN]
|
||||
# [EXPORTS exported_func1 .... exportedFuncN]
|
||||
# [OUTPUT_NAME output_name]
|
||||
#)
|
||||
MACRO(MERGE_LIBRARIES)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG
|
||||
"EXPORTS;OUTPUT_NAME"
|
||||
"STATIC;SHARED;MODULE"
|
||||
${ARGN}
|
||||
)
|
||||
LIST(GET ARG_DEFAULT_ARGS 0 TARGET)
|
||||
SET(LIBS ${ARG_DEFAULT_ARGS})
|
||||
LIST(REMOVE_AT LIBS 0)
|
||||
IF(ARG_STATIC)
|
||||
IF (NOT "${ARG_OUTPUT_NAME}")
|
||||
SET(ARG_OUTPUT_NAME ${TARGET})
|
||||
ENDIF()
|
||||
MERGE_STATIC_LIBS(${TARGET} ${ARG_OUTPUT_NAME} "${LIBS}")
|
||||
ELSEIF(ARG_SHARED OR ARG_MODULE)
|
||||
IF(ARG_SHARED)
|
||||
SET(LIBTYPE SHARED)
|
||||
ELSE()
|
||||
SET(LIBTYPE MODULE)
|
||||
ENDIF()
|
||||
# check for non-PIC libraries
|
||||
IF(NOT _SKIP_PIC)
|
||||
FOREACH(LIB ${LIBS})
|
||||
GET_TARGET_PROPERTY(${LIB} TYPE LIBTYPE)
|
||||
IF(LIBTYPE STREQUAL "STATIC_LIBRARY")
|
||||
GET_TARGET_PROPERTY(LIB COMPILE_FLAGS LIB_COMPILE_FLAGS)
|
||||
STRING(REPLACE "${CMAKE_SHARED_LIBRARY_C_FLAGS}"
|
||||
"<PIC_FLAG>" LIB_COMPILE_FLAGS ${LIB_COMPILE_FLAG})
|
||||
IF(NOT LIB_COMPILE_FLAGS MATCHES "<PIC_FLAG>")
|
||||
MESSAGE(FATAL_ERROR
|
||||
"Attempted to link non-PIC static library ${LIB} to shared library ${TARGET}\n"
|
||||
"Please use ADD_CONVENIENCE_LIBRARY, instead of ADD_LIBRARY for ${LIB}"
|
||||
)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
CREATE_EXPORT_FILE(SRC ${TARGET} "${EXPORTS}")
|
||||
ADD_LIBRARY(${TARGET} SHARED ${SRC})
|
||||
TARGET_LINK_LIBRARIES(${TARGET} ${LIBS})
|
||||
IF(ARG_OUTPUT_NAME)
|
||||
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES OUTPUT_NAME "${ARG_OUTPUT_NAME}")
|
||||
ENDIF()
|
||||
# Disallow undefined symbols in shared libraries, but allow for modules
|
||||
# (they export from loading executable)
|
||||
IF(LIBTYPE MATCHES "SHARED" AND CMAKE_SYSTEM_TYPE MATCHES "Linux")
|
||||
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unknown library type")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
128
cmake/misc.cmake
128
cmake/misc.cmake
|
@ -1,128 +0,0 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Merge static libraries.
|
||||
MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
|
||||
# To produce a library we need at least one source file.
|
||||
# It is created by ADD_CUSTOM_COMMAND below and will helps
|
||||
# also help to track dependencies.
|
||||
SET(SOURCE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_depends.c)
|
||||
ADD_LIBRARY(${TARGET} STATIC ${SOURCE_FILE})
|
||||
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES OUTPUT_NAME ${OUTPUT_NAME})
|
||||
|
||||
FOREACH(LIB ${LIBS_TO_MERGE})
|
||||
GET_TARGET_PROPERTY(LIB_LOCATION ${LIB} LOCATION)
|
||||
GET_TARGET_PROPERTY(LIB_TYPE ${LIB} TYPE)
|
||||
IF(NOT LIB_LOCATION)
|
||||
# 3rd party library like libz.so. Make sure that everything
|
||||
# that links to our library links to this one as well.
|
||||
TARGET_LINK_LIBRARIES(${TARGET} ${LIB})
|
||||
ELSE()
|
||||
# This is a target in current project
|
||||
# (can be a static or shared lib)
|
||||
IF(LIB_TYPE STREQUAL "STATIC_LIBRARY")
|
||||
SET(STATIC_LIBS ${STATIC_LIBS} ${LIB_LOCATION})
|
||||
ADD_DEPENDENCIES(${TARGET} ${LIB})
|
||||
ELSE()
|
||||
# This is a shared library our static lib depends on.
|
||||
TARGET_LINK_LIBRARIES(${TARGET} ${LIB})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
# Make the generated dummy source file depended on all static input
|
||||
# libs. If input lib changes,the source file is touched
|
||||
# which causes the desired effect (relink).
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${SOURCE_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${SOURCE_FILE}
|
||||
DEPENDS ${STATIC_LIBS})
|
||||
|
||||
IF(MSVC)
|
||||
# To merge libs, just pass them to lib.exe command line.
|
||||
SET(LINKER_EXTRA_FLAGS "")
|
||||
FOREACH(LIB ${STATIC_LIBS})
|
||||
SET(LINKER_EXTRA_FLAGS "${LINKER_EXTRA_FLAGS} ${LIB}")
|
||||
ENDFOREACH()
|
||||
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES STATIC_LIBRARY_FLAGS
|
||||
"${LINKER_EXTRA_FLAGS}")
|
||||
ELSE()
|
||||
GET_TARGET_PROPERTY(TARGET_LOCATION ${TARGET} LOCATION)
|
||||
IF(APPLE)
|
||||
# Use OSX's libtool to merge archives (ihandles universal
|
||||
# binaries properly)
|
||||
ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND rm ${TARGET_LOCATION}
|
||||
COMMAND /usr/bin/libtool -static -o ${TARGET_LOCATION}
|
||||
${STATIC_LIBS}
|
||||
)
|
||||
ELSE()
|
||||
# Generic Unix, Cygwin or MinGW. In post-build step, call
|
||||
# script, that extracts objects from archives with "ar x"
|
||||
# and repacks them with "ar r"
|
||||
SET(TARGET ${TARGET})
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_SOURCE_DIR}/cmake/merge_archives_unix.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET}.cmake
|
||||
@ONLY
|
||||
)
|
||||
ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND rm ${TARGET_LOCATION}
|
||||
COMMAND ${CMAKE_COMMAND} -P
|
||||
${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET}.cmake
|
||||
)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
# Convert static library to shared
|
||||
MACRO(STATIC_TO_SHARED STATIC_LIB SHARED_LIB EXPORTS_FILE)
|
||||
IF(NOT MSVC)
|
||||
MESSAGE(FATAL_ERROR
|
||||
"Cannot convert static ${STATIC_LIB} to shared ${TARGET} library."
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
# Need one source file.
|
||||
SET(SOURCE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${SHARED_LIB}_dummy.c)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${SOURCE_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${SOURCE_FILE}
|
||||
)
|
||||
|
||||
ADD_LIBRARY(${SHARED_LIB} SHARED ${SOURCE_FILE} ${EXPORTS_FILE})
|
||||
TARGET_LINK_LIBRARIES(${SHARED_LIB} ${STATIC_LIB})
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(SET_TARGET_SOURCEDIR TARGET)
|
||||
SET(${TARGET}_SOURCEDIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "source directory for a target")
|
||||
ENDMACRO()
|
||||
|
||||
# Handy macro to use when source projects maybe used somewhere else
|
||||
# For example, embedded or client library may recompile mysys sources
|
||||
# In such cases, using absolute names in ADD_LIBRARY has the advantage that
|
||||
# GET_TARGET_PROPERTY(xxx SOURCES) also returns absolute names, so there is
|
||||
# no need to know the base directory of a target.
|
||||
MACRO(USE_ABSOLUTE_FILENAMES FILELIST)
|
||||
# Use absolute file paths for sources
|
||||
# It helps when building embedded where we need to
|
||||
# sources files for the plugin to recompile.
|
||||
SET(RESOLVED_PATHS)
|
||||
FOREACH(FILE ${${FILELIST}})
|
||||
GET_FILENAME_COMPONENT(ABSOLUTE_PATH ${FILE} ABSOLUTE)
|
||||
LIST(APPEND RESOLVED_PATHS ${ABSOLUTE_PATH})
|
||||
ENDFOREACH()
|
||||
SET(${FILELIST} ${RESOLVED_PATHS})
|
||||
ENDMACRO()
|
|
@ -72,19 +72,26 @@ MACRO(MYSQL_PLUGIN plugin)
|
|||
ENDIF()
|
||||
|
||||
|
||||
USE_ABSOLUTE_FILENAMES(${plugin}_SOURCES)
|
||||
|
||||
IF (WITH_${plugin} AND ${plugin}_PLUGIN_STATIC)
|
||||
ADD_DEFINITIONS(-DMYSQL_SERVER)
|
||||
#Create static library.
|
||||
ADD_LIBRARY(${target} ${${plugin}_SOURCES})
|
||||
DTRACE_INSTRUMENT(${target})
|
||||
ADD_DEPENDENCIES(${target} GenError)
|
||||
IF(WITH_EMBEDDED_SERVER AND NOT ${plugin}_PLUGIN_DYNAMIC)
|
||||
# Recompile couple of plugins for embedded
|
||||
ADD_LIBRARY(${target}_embedded ${${plugin}_SOURCES})
|
||||
DTRACE_INSTRUMENT(${target}_embedded)
|
||||
SET_TARGET_PROPERTIES(${target}_embedded
|
||||
PROPERTIES COMPILE_DEFINITIONS "EMBEDDED_LIBRARY")
|
||||
ADD_DEPENDENCIES(${target}_embedded GenError)
|
||||
ENDIF()
|
||||
IF(${plugin}_LIBS)
|
||||
TARGET_LINK_LIBRARIES(${target} ${${plugin}_LIBS})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET_TARGET_PROPERTIES(${target} PROPERTIES
|
||||
OUTPUT_NAME "${${plugin}_PLUGIN_STATIC}")
|
||||
OUTPUT_NAME "${${plugin}_PLUGIN_STATIC}")
|
||||
# Update mysqld dependencies
|
||||
SET (MYSQLD_STATIC_PLUGIN_LIBS ${MYSQLD_STATIC_PLUGIN_LIBS}
|
||||
${target} PARENT_SCOPE)
|
||||
|
@ -92,6 +99,7 @@ MACRO(MYSQL_PLUGIN plugin)
|
|||
PARENT_SCOPE)
|
||||
SET(${with_var} ON CACHE BOOL "Link ${plugin} statically to the server"
|
||||
FORCE)
|
||||
|
||||
ELSEIF(NOT WITHOUT_${plugin} AND ${plugin}_PLUGIN_DYNAMIC
|
||||
AND NOT WITHOUT_DYNAMIC_PLUGINS)
|
||||
|
||||
|
@ -105,22 +113,21 @@ MACRO(MYSQL_PLUGIN plugin)
|
|||
SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX "")
|
||||
TARGET_LINK_LIBRARIES (${target} mysqlservices)
|
||||
|
||||
# Plugin uses symbols defined in mysqld executable.
|
||||
# Plugin uses symbols defined in mysqld executable.
|
||||
# Some operating systems like Windows and OSX and are pretty strict about
|
||||
# unresolved symbols. Others are less strict and allow unresolved symbols
|
||||
# unresolved symbols. Others are less strict and allow unresolved symbols
|
||||
# in shared libraries. On Linux for example, CMake does not even add
|
||||
# executable to the linker command line (it would result into link error).
|
||||
# Thus we skip TARGET_LINK_LIBRARIES on Linux, as it would only generate
|
||||
# an additional dependency.
|
||||
IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
TARGET_LINK_LIBRARIES (${target} mysqld)
|
||||
ENDIF()
|
||||
|
||||
ENDIF()
|
||||
ADD_DEPENDENCIES(${target} GenError)
|
||||
|
||||
IF(${plugin}_PLUGIN_DYNAMIC)
|
||||
SET_TARGET_PROPERTIES(${target} PROPERTIES
|
||||
OUTPUT_NAME "${${plugin}_PLUGIN_DYNAMIC}")
|
||||
OUTPUT_NAME "${${plugin}_PLUGIN_DYNAMIC}")
|
||||
ENDIF()
|
||||
|
||||
# Update cache "WITH" variable for plugins that support static linking
|
||||
|
|
|
@ -18,6 +18,5 @@ INCLUDE_DIRECTORIES(
|
|||
${CMAKE_SOURCE_DIR}/include
|
||||
)
|
||||
SET(DBUG_SOURCES dbug.c sanity.c)
|
||||
USE_ABSOLUTE_FILENAMES(DBUG_SOURCES)
|
||||
ADD_LIBRARY(dbug ${DBUG_SOURCES})
|
||||
ADD_CONVENIENCE_LIBRARY(dbug ${DBUG_SOURCES})
|
||||
TARGET_LINK_LIBRARIES(dbug mysys)
|
||||
|
|
|
@ -27,7 +27,7 @@ ${CMAKE_SOURCE_DIR}/storage/ndb/include/mgmapi)
|
|||
|
||||
IF(NOT CMAKE_CROSSCOMPILING)
|
||||
ADD_EXECUTABLE(comp_err comp_err.c)
|
||||
TARGET_LINK_LIBRARIES(comp_err ${ZLIB_LIBRARY} mysys)
|
||||
TARGET_LINK_LIBRARIES(comp_err mysys)
|
||||
ENDIF()
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/include/mysqld_error.h
|
||||
|
|
|
@ -29,6 +29,6 @@ ENDIF()
|
|||
SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp src/handshake.cpp src/lock.cpp
|
||||
src/log.cpp src/socket_wrapper.cpp src/ssl.cpp src/timer.cpp src/yassl_error.cpp
|
||||
src/yassl_imp.cpp src/yassl_int.cpp)
|
||||
USE_ABSOLUTE_FILENAMES(YASSL_SOURCES)
|
||||
ADD_LIBRARY(yassl ${YASSL_SOURCES})
|
||||
ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES})
|
||||
|
||||
|
||||
|
|
|
@ -18,9 +18,6 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL
|
|||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
|
||||
ADD_DEFINITIONS(${SSL_DEFINES})
|
||||
IF(PREVENT_CPP_RUNTIME)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PREVENT_CPP_RUNTIME}")
|
||||
ENDIF()
|
||||
SET(TAOCRYPT_SOURCES src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp src/asn.cpp src/coding.cpp
|
||||
src/des.cpp src/dh.cpp src/dsa.cpp src/file.cpp src/hash.cpp src/integer.cpp src/md2.cpp
|
||||
src/md4.cpp src/md5.cpp src/misc.cpp src/random.cpp src/ripemd.cpp src/rsa.cpp src/sha.cpp
|
||||
|
@ -29,6 +26,5 @@ SET(TAOCRYPT_SOURCES src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp
|
|||
include/error.hpp include/file.hpp include/hash.hpp include/hmac.hpp include/integer.hpp
|
||||
include/md2.hpp include/md5.hpp include/misc.hpp include/modarith.hpp include/modes.hpp
|
||||
include/random.hpp include/ripemd.hpp include/rsa.hpp include/sha.hpp)
|
||||
USE_ABSOLUTE_FILENAMES(TAOCRYPT_SOURCES)
|
||||
ADD_LIBRARY(taocrypt ${TAOCRYPT_SOURCES})
|
||||
ADD_CONVENIENCE_LIBRARY(taocrypt ${TAOCRYPT_SOURCES})
|
||||
|
||||
|
|
|
@ -24,13 +24,115 @@ INCLUDE_DIRECTORIES(
|
|||
${ZLIB_INCLUDE_DIR})
|
||||
ADD_DEFINITIONS(${SSL_DEFINES})
|
||||
|
||||
SET(CLIENT_API_FUNCTIONS
|
||||
load_defaults
|
||||
mysql_thread_end
|
||||
mysql_thread_init
|
||||
myodbc_remove_escape
|
||||
mysql_affected_rows
|
||||
mysql_autocommit
|
||||
mysql_stmt_bind_param
|
||||
mysql_stmt_bind_result
|
||||
mysql_change_user
|
||||
mysql_character_set_name
|
||||
mysql_close
|
||||
mysql_commit
|
||||
mysql_data_seek
|
||||
mysql_debug
|
||||
mysql_dump_debug_info
|
||||
mysql_eof
|
||||
mysql_errno
|
||||
mysql_error
|
||||
mysql_escape_string
|
||||
mysql_hex_string
|
||||
mysql_stmt_execute
|
||||
mysql_stmt_fetch
|
||||
mysql_stmt_fetch_column
|
||||
mysql_fetch_field
|
||||
mysql_fetch_field_direct
|
||||
mysql_fetch_fields
|
||||
mysql_fetch_lengths
|
||||
mysql_fetch_row
|
||||
mysql_field_count
|
||||
mysql_field_seek
|
||||
mysql_field_tell
|
||||
mysql_free_result
|
||||
mysql_get_client_info
|
||||
mysql_get_host_info
|
||||
mysql_get_proto_info
|
||||
mysql_get_server_info
|
||||
mysql_get_client_version
|
||||
mysql_get_ssl_cipher
|
||||
mysql_info
|
||||
mysql_init
|
||||
mysql_insert_id
|
||||
mysql_kill
|
||||
mysql_set_server_option
|
||||
mysql_list_dbs
|
||||
mysql_list_fields
|
||||
mysql_list_processes
|
||||
mysql_list_tables
|
||||
mysql_more_results
|
||||
mysql_next_result
|
||||
mysql_num_fields
|
||||
mysql_num_rows
|
||||
mysql_odbc_escape_string
|
||||
mysql_options
|
||||
mysql_stmt_param_count
|
||||
mysql_stmt_param_metadata
|
||||
mysql_ping
|
||||
mysql_stmt_result_metadata
|
||||
mysql_query
|
||||
mysql_read_query_result
|
||||
mysql_real_connect
|
||||
mysql_real_escape_string
|
||||
mysql_real_query
|
||||
mysql_refresh
|
||||
mysql_rollback
|
||||
mysql_row_seek
|
||||
mysql_row_tell
|
||||
mysql_select_db
|
||||
mysql_stmt_send_long_data
|
||||
mysql_send_query
|
||||
mysql_shutdown
|
||||
mysql_ssl_set
|
||||
mysql_stat
|
||||
mysql_stmt_affected_rows
|
||||
mysql_stmt_close
|
||||
mysql_stmt_reset
|
||||
mysql_stmt_data_seek
|
||||
mysql_stmt_errno
|
||||
mysql_stmt_error
|
||||
mysql_stmt_free_result
|
||||
mysql_stmt_num_rows
|
||||
mysql_stmt_row_seek
|
||||
mysql_stmt_row_tell
|
||||
mysql_stmt_store_result
|
||||
mysql_store_result
|
||||
mysql_thread_id
|
||||
mysql_thread_safe
|
||||
mysql_use_result
|
||||
mysql_warning_count
|
||||
mysql_stmt_sqlstate
|
||||
mysql_sqlstate
|
||||
mysql_get_server_version
|
||||
mysql_stmt_prepare
|
||||
mysql_stmt_init
|
||||
mysql_stmt_insert_id
|
||||
mysql_stmt_attr_get
|
||||
mysql_stmt_attr_set
|
||||
mysql_stmt_field_count
|
||||
mysql_set_local_infile_default
|
||||
mysql_set_local_infile_handler
|
||||
mysql_embedded
|
||||
mysql_server_init
|
||||
mysql_server_end
|
||||
mysql_set_character_set
|
||||
mysql_get_character_set_info
|
||||
|
||||
#Remove -fno-implicit-templates
|
||||
#(yassl sources cannot be compiled with it)
|
||||
STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
ADD_DEFINITIONS(-DDISABLE_DTRACE)
|
||||
|
||||
CACHE INTERNAL "Functions exported by client API"
|
||||
|
||||
)
|
||||
|
||||
SET(CLIENT_SOURCES
|
||||
get_password.c
|
||||
|
@ -42,71 +144,22 @@ SET(CLIENT_SOURCES
|
|||
../sql-common/pack.c
|
||||
../sql/password.c
|
||||
)
|
||||
|
||||
ADD_LIBRARY(clientlib STATIC ${CLIENT_SOURCES})
|
||||
ADD_CONVENIENCE_LIBRARY(clientlib ${CLIENT_SOURCES})
|
||||
DTRACE_INSTRUMENT(clientlib)
|
||||
ADD_DEPENDENCIES(clientlib GenError)
|
||||
|
||||
# Merge several static libraries into one big mysqlclient.
|
||||
SET(LIBS dbug strings vio mysys ${ZLIB_LIBRARY} ${SSL_LIBRARIES})
|
||||
MERGE_STATIC_LIBS(mysqlclient mysqlclient "${LIBS};clientlib")
|
||||
|
||||
ADD_DEPENDENCIES(mysqlclient GenError)
|
||||
SET_TARGET_PROPERTIES(mysqlclient PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
|
||||
|
||||
# Make shared client library
|
||||
IF(WIN32)
|
||||
SET(SHARED_OUTPUT_NAME libmysql)
|
||||
ELSE()
|
||||
SET(SHARED_OUTPUT_NAME mysqlclient)
|
||||
ENDIF()
|
||||
|
||||
# On Windows, we can make a shared library out of static.
|
||||
# On Unix, we need to recompile all sources, unless we compiled with -fPIC, in
|
||||
# which case we can link static libraries to shared.
|
||||
IF(MSVC)
|
||||
STATIC_TO_SHARED(mysqlclient libmysql libmysql.def)
|
||||
ELSE()
|
||||
SET(LIBMYSQL_SOURCES ${CLIENT_SOURCES})
|
||||
|
||||
IF(NOT WITH_PIC)
|
||||
# Add all sources that come into common static libs.
|
||||
FOREACH(LIB ${LIBS})
|
||||
GET_TARGET_PROPERTY(SRC ${LIB} SOURCES)
|
||||
IF (NOT SRC)
|
||||
# This must be system shared lib (zlib or openssl)
|
||||
# Users of libmysql must link with it too.
|
||||
LIST(APPEND OS_LIBS ${LIB})
|
||||
ELSE()
|
||||
LIST(APPEND LIBMYSQL_SOURCES ${SRC})
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
# Some extra flags as in mysys
|
||||
IF(CMAKE_COMPILER_IS_GNUCC AND NOT HAVE_CXX_NEW)
|
||||
SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/mysys/my_new.cc
|
||||
PROPERTIES COMPILE_FLAGS "-DUSE_MYSYS_NEW")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
|
||||
ADD_LIBRARY(libmysql SHARED ${LIBMYSQL_SOURCES})
|
||||
ADD_DEPENDENCIES(libmysql GenError)
|
||||
SET_TARGET_PROPERTIES(libmysql PROPERTIES OUTPUT_NAME ${SHARED_OUTPUT_NAME}
|
||||
SOVERSION "${SHARED_LIB_MAJOR_VERSION}.0")
|
||||
SET_TARGET_PROPERTIES(libmysql PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
|
||||
IF(WITH_PIC)
|
||||
TARGET_LINK_LIBRARIES(libmysql ${LIBS})
|
||||
ENDIF()
|
||||
|
||||
IF(OS_LIBS)
|
||||
TARGET_LINK_LIBRARIES(libmysql ${OS_LIBS})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET(LIBS clientlib dbug strings vio mysys ${ZLIB_LIBRARY} ${SSL_LIBRARIES})
|
||||
|
||||
# Merge several convenience libraries into one big mysqlclient
|
||||
# and link them together into shared library.
|
||||
MERGE_LIBRARIES(mysqlclient STATIC ${LIBS})
|
||||
MERGE_LIBRARIES(libmysql SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS})
|
||||
IF(UNIX)
|
||||
# Name of shared library is mysqlclient on Unix
|
||||
SET_TARGET_PROPERTIES(libmysql PROPERTIES OUTPUT_NAME mysqlclient)
|
||||
# clean direct output needs to be set several targets have the same name
|
||||
#(mysqlclient in this case)
|
||||
SET_TARGET_PROPERTIES(mysqlclient PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
# Install links to shared and static libraries
|
||||
# (append _r to base name)
|
||||
INSTALL_SYMLINK(${CMAKE_SHARED_LIBRARY_PREFIX}mysqlclient_r libmysql lib)
|
||||
|
@ -114,4 +167,4 @@ IF(UNIX)
|
|||
ENDIF()
|
||||
|
||||
INSTALL(TARGETS mysqlclient libmysql DESTINATION lib)
|
||||
INSTALL_DEBUG_SYMBOLS( "mysqlclient;libmysql")
|
||||
INSTALL_DEBUG_SYMBOLS("mysqlclient;libmysql")
|
||||
|
|
|
@ -1,33 +1,7 @@
|
|||
LIBRARY LIBMYSQL
|
||||
VERSION 6.0
|
||||
EXPORTS
|
||||
_dig_vec_lower
|
||||
_dig_vec_upper
|
||||
bmove_upp
|
||||
delete_dynamic
|
||||
free_defaults
|
||||
getopt_compare_strings
|
||||
getopt_ull_limit_value
|
||||
handle_options
|
||||
init_dynamic_array
|
||||
insert_dynamic
|
||||
int2str
|
||||
is_prefix
|
||||
list_add
|
||||
list_delete
|
||||
load_defaults
|
||||
my_end
|
||||
my_getopt_print_errors
|
||||
my_init
|
||||
my_malloc
|
||||
my_memdup
|
||||
my_no_flags_free
|
||||
my_path
|
||||
mysql_get_parameters
|
||||
my_print_help
|
||||
my_print_variables
|
||||
my_realloc
|
||||
my_strdup
|
||||
mysql_thread_end
|
||||
mysql_thread_init
|
||||
myodbc_remove_escape
|
||||
|
@ -118,22 +92,12 @@ EXPORTS
|
|||
mysql_stmt_sqlstate
|
||||
mysql_sqlstate
|
||||
mysql_get_server_version
|
||||
set_dynamic
|
||||
strcend
|
||||
strcont
|
||||
strdup_root
|
||||
strfill
|
||||
strinstr
|
||||
strmake
|
||||
strmov
|
||||
strxmov
|
||||
mysql_stmt_prepare
|
||||
mysql_stmt_init
|
||||
mysql_stmt_insert_id
|
||||
mysql_stmt_attr_get
|
||||
mysql_stmt_attr_set
|
||||
mysql_stmt_field_count
|
||||
client_errors
|
||||
mysql_set_local_infile_default
|
||||
mysql_set_local_infile_handler
|
||||
mysql_embedded
|
||||
|
@ -141,5 +105,3 @@ EXPORTS
|
|||
mysql_server_end
|
||||
mysql_set_character_set
|
||||
mysql_get_character_set_info
|
||||
get_defaults_options
|
||||
modify_defaults_file
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
ADD_DEFINITIONS(-DMYSQL_SERVER -DEMBEDDED_LIBRARY -DDISABLE_DTRACE
|
||||
ADD_DEFINITIONS(-DMYSQL_SERVER -DEMBEDDED_LIBRARY
|
||||
${SSL_DEFINES})
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
|
@ -29,7 +29,7 @@ ${SSL_INTERNAL_INCLUDE_DIRS}
|
|||
${NDB_CLUSTER_INCLUDES}
|
||||
${CMAKE_SOURCE_DIR}/sql/backup
|
||||
)
|
||||
|
||||
|
||||
SET(GEN_SOURCES
|
||||
${CMAKE_BINARY_DIR}/sql/sql_yacc.h
|
||||
${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
|
||||
|
@ -37,23 +37,8 @@ ${CMAKE_BINARY_DIR}/sql/lex_hash.h
|
|||
)
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES(${GEN_SOURCES} PROPERTIES GENERATED TRUE)
|
||||
SET(LIBS dbug strings regex mysys vio ${ZLIB_LIBRARY} ${SSL_LIBRARIES}
|
||||
${MYSQLD_STATIC_PLUGIN_LIBS} ${NDB_CLIENT_LIBS})
|
||||
|
||||
# Quirk: recompile selected storage engines with -DEMBEDDED_LIBRARY
|
||||
# They depend on internal structures like THD that is different in embedded.
|
||||
SET(RECOMPILE_ENGINES myisam myisammrg heap ndbcluster)
|
||||
FOREACH(ENGINE ${RECOMPILE_ENGINES})
|
||||
LIST(REMOVE_ITEM LIBS ${ENGINE})
|
||||
GET_TARGET_PROPERTY(SRC ${ENGINE} SOURCES)
|
||||
IF(SRC)
|
||||
LIST(APPEND ENGINE_SOURCES ${SRC})
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
|
||||
|
||||
SET(LIBMYSQLD_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
|
||||
SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
|
||||
../libmysql/libmysql.c ../libmysql/errmsg.c ../client/get_password.c
|
||||
../sql-common/client.c ../sql-common/my_time.c
|
||||
../sql-common/my_user.c ../sql-common/pack.c
|
||||
|
@ -96,13 +81,13 @@ SET(LIBMYSQLD_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
|
|||
../sql/sql_signal.cc ../sql/rpl_handler.cc
|
||||
${CMAKE_BINARY_DIR}/sql/sql_builtin.cc
|
||||
${GEN_SOURCES}
|
||||
${ENGINE_SOURCES}
|
||||
${MYSYS_LIBWRAP_SOURCE}
|
||||
)
|
||||
|
||||
|
||||
ADD_LIBRARY(mysqlserver_int STATIC ${LIBMYSQLD_SOURCES})
|
||||
ADD_DEPENDENCIES(mysqlserver_int GenError GenServerSource)
|
||||
ADD_LIBRARY(sql_embedded STATIC ${SQL_EMBEDDED_SOURCES})
|
||||
DTRACE_INSTRUMENT(sql_embedded)
|
||||
ADD_DEPENDENCIES(sql_embedded GenError GenServerSource)
|
||||
|
||||
# On Windows, static embedded server library is called mysqlserver.lib
|
||||
# On Unix, it is libmysqld.a
|
||||
|
@ -112,17 +97,31 @@ ELSE()
|
|||
SET(MYSQLSERVER_OUTPUT_NAME mysqld)
|
||||
ENDIF()
|
||||
|
||||
# Merge slim mysqlserver_int with other libraries like mysys to create a big
|
||||
# static library that contains everything.
|
||||
MERGE_STATIC_LIBS(mysqlserver ${MYSQLSERVER_OUTPUT_NAME}
|
||||
"mysqlserver_int;${LIBS}")
|
||||
|
||||
IF(LIBWRAP_LIBRARY)
|
||||
TARGET_LINK_LIBRARIES(mysqlserver ${LIBWRAP_LIBRARY})
|
||||
ENDIF()
|
||||
SET(LIBS
|
||||
dbug strings regex mysys vio
|
||||
${ZLIB_LIBRARY} ${SSL_LIBRARIES} ${LIBWRAP_LIBRARY}
|
||||
${MYSQLD_STATIC_PLUGIN_LIBS} ${NDB_CLIENT_LIBS}
|
||||
sql_embedded
|
||||
)
|
||||
|
||||
# Some storage engine were compiled for embedded specifically
|
||||
# (with corresponding target ${engine}_embedded)
|
||||
SET(EMBEDDED_LIBS)
|
||||
FOREACH(LIB ${LIBS})
|
||||
GET_TARGET_PROPERTY(EMBEDDED_LOCATION ${LIB}_embedded LOCATION)
|
||||
IF(EMBEDDED_LOCATION)
|
||||
LIST(APPEND EMBEDDED_LIBS ${LIB}_embedded)
|
||||
ELSE()
|
||||
LIST(APPEND EMBEDDED_LIBS ${LIB})
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
MERGE_LIBRARIES(mysqlserver STATIC ${EMBEDDED_LIBS}
|
||||
OUTPUT_NAME ${MYSQLSERVER_OUTPUT_NAME})
|
||||
INSTALL(TARGETS mysqlserver DESTINATION lib)
|
||||
|
||||
IF(MSVC)
|
||||
STATIC_TO_SHARED(mysqlserver libmysqld libmysqld.def)
|
||||
MERGE_LIBRARIES(libmysqld SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS})
|
||||
INSTALL(TARGETS libmysqld DESTINATION lib)
|
||||
ENDIF()
|
||||
|
|
|
@ -56,7 +56,6 @@ IF(UNIX)
|
|||
SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_atomic.c)
|
||||
SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_getncpus.c)
|
||||
ENDIF()
|
||||
USE_ABSOLUTE_FILENAMES(MYSYS_SOURCES)
|
||||
ADD_LIBRARY(mysys ${MYSYS_SOURCES})
|
||||
ADD_CONVENIENCE_LIBRARY(mysys ${MYSYS_SOURCES})
|
||||
TARGET_LINK_LIBRARIES(mysys dbug strings ${ZLIB_LIBRARY})
|
||||
DTRACE_INSTRUMENT(mysys)
|
||||
|
|
|
@ -17,6 +17,4 @@
|
|||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
|
||||
|
||||
SET(REGEX_SOURCES regcomp.c regerror.c regexec.c regfree.c reginit.c)
|
||||
USE_ABSOLUTE_FILENAMES(REGEX_SOURCES)
|
||||
ADD_LIBRARY(regex ${REGEX_SOURCES})
|
||||
|
||||
ADD_CONVENIENCE_LIBRARY(regex STATIC ${REGEX_SOURCES})
|
||||
|
|
|
@ -24,6 +24,4 @@ SET(STRINGS_SOURCES bchange.c bcmp.c bfill.c bmove512.c bmove_upp.c ctype-big5.c
|
|||
strtod.c strtol.c strtoll.c strtoul.c strtoull.c strxmov.c strxnmov.c xml.c
|
||||
my_strchr.c strcont.c strinstr.c strnlen.c strappend.c)
|
||||
|
||||
USE_ABSOLUTE_FILENAMES(STRINGS_SOURCES)
|
||||
ADD_LIBRARY(strings ${STRINGS_SOURCES})
|
||||
|
||||
ADD_CONVENIENCE_LIBRARY(strings STATIC ${STRINGS_SOURCES})
|
||||
|
|
|
@ -19,7 +19,4 @@ ${SSL_INCLUDE_DIRS})
|
|||
ADD_DEFINITIONS(${SSL_DEFINES})
|
||||
|
||||
SET(VIO_SOURCES vio.c viosocket.c viossl.c viosslfactories.c)
|
||||
USE_ABSOLUTE_FILENAMES(VIO_SOURCES)
|
||||
ADD_LIBRARY(vio ${VIO_SOURCES})
|
||||
ADD_DEPENDENCIES(vio GenError)
|
||||
|
||||
ADD_CONVENIENCE_LIBRARY(vio ${VIO_SOURCES})
|
||||
|
|
|
@ -18,10 +18,8 @@ INCLUDE_DIRECTORIES(
|
|||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/zlib
|
||||
)
|
||||
|
||||
SET(ZLIB_SOURCES adler32.c compress.c crc32.c crc32.h deflate.c deflate.h gzio.c infback.c inffast.c inffast.h
|
||||
inffixed.h inflate.c inflate.h inftrees.c inftrees.h trees.c trees.h uncompr.c zconf.h zlib.h
|
||||
zutil.c zutil.h)
|
||||
USE_ABSOLUTE_FILENAMES(ZLIB_SOURCES)
|
||||
ADD_LIBRARY(zlib ${ZLIB_SOURCES})
|
||||
ADD_CONVENIENCE_LIBRARY(zlib ${ZLIB_SOURCES})
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue