mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Install static client and embedded debug libraries
This commit is contained in:
@ -161,3 +161,53 @@ FUNCTION(MYSQL_INSTALL_TARGETS)
|
||||
SET(INSTALL_LOCATION)
|
||||
ENDFUNCTION()
|
||||
|
||||
# Optionally install mysqld/client/embedded from debug build run. outside of the current build dir
|
||||
# (unless multi-config generator is used like Visual Studio or Xcode).
|
||||
# For Makefile generators we default Debug build directory to ${buildroot}/../debug.
|
||||
GET_FILENAME_COMPONENT(BINARY_PARENTDIR ${CMAKE_BINARY_DIR} PATH)
|
||||
SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug build")
|
||||
|
||||
|
||||
FUNCTION(INSTALL_DEBUG_TARGET target)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG
|
||||
"DESTINATION;RENAME"
|
||||
""
|
||||
${ARGN}
|
||||
)
|
||||
GET_TARGET_PROPERTY(target_type ${target} TYPE)
|
||||
IF(ARG_RENAME)
|
||||
SET(RENAME_PARAM RENAME ${ARG_RENAME}${CMAKE_${target_type}_SUFFIX})
|
||||
ELSE()
|
||||
SET(RENAME_PARAM)
|
||||
ENDIF()
|
||||
IF(NOT ARG_DESTINATION)
|
||||
MESSAGE(FATAL_ERROR "Need DESTINATION parameter for INSTALL_DEBUG_TARGET")
|
||||
ENDIF()
|
||||
GET_TARGET_PROPERTY(target_location ${target} LOCATION)
|
||||
IF(CMAKE_GENERATOR MATCHES "Makefiles")
|
||||
STRING(REPLACE "${CMAKE_BINARY_DIR}" "${DEBUGBUILDDIR}" debug_target_location "${target_location}")
|
||||
ELSE()
|
||||
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "Debug" debug_target_location "${target_location}" )
|
||||
ENDIF()
|
||||
|
||||
INSTALL(FILES ${debug_target_location}
|
||||
DESTINATION ${ARG_DESTINATION}
|
||||
${RENAME_PARAM}
|
||||
CONFIGURATIONS Release RelWithDebInfo
|
||||
OPTIONAL)
|
||||
|
||||
IF(MSVC)
|
||||
GET_FILENAME_COMPONENT(ext ${debug_target_location} EXT)
|
||||
STRING(REPLACE "${ext}" ".pdb" debug_pdb_target_location "${debug_target_location}" )
|
||||
IF(RENAME_PARAM)
|
||||
STRING(REPLACE "${ext}" ".pdb" "${ARG_RENAME}" pdb_rename)
|
||||
SET(PDB_RENAME_PARAM RENAME ${pdb_rename})
|
||||
ENDIF()
|
||||
INSTALL(FILES ${debug_pdb_target_location}
|
||||
DESTINATION ${ARG_DESTINATION}
|
||||
${RPDB_RENAME_PARAM}
|
||||
CONFIGURATIONS Release RelWithDebInfo
|
||||
OPTIONAL)
|
||||
ENDIF()
|
||||
ENDFUNCTION()
|
||||
|
||||
|
@ -88,6 +88,7 @@ IF(MSVC)
|
||||
# Fix CMake's predefined huge stack size
|
||||
FOREACH(type EXE SHARED MODULE)
|
||||
STRING(REGEX REPLACE "/STACK:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS}")
|
||||
STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}")
|
||||
ENDFOREACH()
|
||||
|
||||
ADD_DEFINITIONS(-DPTHREAD_STACK_MIN=1048576)
|
||||
|
@ -157,6 +157,11 @@ IF(UNIX)
|
||||
INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r mysqlclient ${INSTALL_LIBDIR})
|
||||
ENDIF()
|
||||
|
||||
# Visual Studio users need debug static library for debug projects
|
||||
IF(MSVC)
|
||||
INSTALL_DEBUG_TARGET(mysqlclient DESTINATION ${INSTALL_LIBDIR}/debug)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT DISABLE_SHARED)
|
||||
MERGE_LIBRARIES(libmysql SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS})
|
||||
IF(UNIX)
|
||||
|
@ -126,6 +126,11 @@ ENDFOREACH()
|
||||
MERGE_LIBRARIES(mysqlserver STATIC ${EMBEDDED_LIBS}
|
||||
OUTPUT_NAME ${MYSQLSERVER_OUTPUT_NAME})
|
||||
|
||||
# Visual Studio users need debug static library
|
||||
IF(MSVC)
|
||||
INSTALL_DEBUG_TARGET(mysqlserver DESTINATION ${INSTALL_LIBDIR}/debug)
|
||||
ENDIF()
|
||||
|
||||
IF(MSVC AND NOT DISABLE_SHARED)
|
||||
MERGE_LIBRARIES(libmysqld SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS})
|
||||
ENDIF()
|
||||
|
@ -156,6 +156,7 @@ IF(WITH_MYSQLD_LDFLAGS)
|
||||
SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS
|
||||
"${MYSQLD_LINK_FLAGS} ${WITH_MYSQLD_LDFLAGS}")
|
||||
ENDIF()
|
||||
INSTALL_DEBUG_TARGET(mysqld DESTINATION ${INSTALL_SBINDIR} RENAME mysqld-debug)
|
||||
|
||||
# Handle out-of-source build from source package with possibly broken
|
||||
# bison. Copy bison output to from source to build directory, if not already
|
||||
@ -189,7 +190,7 @@ ADD_CUSTOM_COMMAND(
|
||||
${CMAKE_COMMAND} -E copy_if_different lex_hash.h.tmp lex_hash.h
|
||||
COMMAND ${CMAKE_COMMAND} -E remove -f lex_hash.h.tmp
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
DEPENDS gen_lex_hash)
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen_lex_hash.cc)
|
||||
|
||||
ADD_CUSTOM_TARGET(
|
||||
GenServerSource
|
||||
@ -275,39 +276,3 @@ ELSE()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Optionally install mysqld from debug build run. outside of the current build dir
|
||||
# (unless multi-config generator is used# like Visual Studio or Xcode).
|
||||
# For Makefile generators we default Debug build directory to ${buildroot}/../debug.
|
||||
|
||||
GET_FILENAME_COMPONENT(BINARY_PARENTDIR ${CMAKE_BINARY_DIR} PATH)
|
||||
SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug build")
|
||||
|
||||
IF(WIN32)
|
||||
SET(EXE ".exe")
|
||||
ELSE()
|
||||
SET(EXE)
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_GENERATOR MATCHES "Makefiles")
|
||||
SET(MYSQLD_DEBUG_EXE ${DEBUGBUILDDIR}/sql/mysqld${EXE})
|
||||
ELSE()
|
||||
# Visual Studio and Xcode
|
||||
SET(MYSQLD_DEBUG_EXE ${CMAKE_BINARY_DIR}/sql/Debug/mysqld${EXE})
|
||||
ENDIF()
|
||||
|
||||
INSTALL(FILES ${MYSQLD_DEBUG_EXE}
|
||||
DESTINATION ${INSTALL_SBINDIR}
|
||||
RENAME mysqld-debug${EXE}
|
||||
CONFIGURATIONS Release RelWithDebInfo
|
||||
OPTIONAL)
|
||||
|
||||
IF(WIN32)
|
||||
STRING(REPLACE ".exe" ".pdb" MYSQLD_DEBUG_PDB ${MYSQLD_DEBUG_EXE})
|
||||
INSTALL(FILES ${MYSQLD_DEBUG_PDB}
|
||||
CONFIGURATIONS Release RelWithDebInfo
|
||||
DESTINATION ${INSTALL_SBINDIR}
|
||||
RENAME mysqld-debug.pdb
|
||||
OPTIONAL)
|
||||
ENDIF()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user