mirror of
https://github.com/MariaDB/server.git
synced 2025-04-18 21:44:20 +03:00
MDEV-33474 Windows packaging - install runtime dependencies
Use CMake 3.21 (semi)automatic dependency resolution to install server and plugin dependencies (DLLs). This is especially useful with 3rd party dependencies, such as Curl, zlib etc
This commit is contained in:
parent
2dc9b8b78e
commit
11324875b4
@ -125,6 +125,18 @@ ENDIF()
|
||||
|
||||
FIND_PACKAGE(Git)
|
||||
|
||||
IF(WIN32 AND (CMAKE_VERSION VERSION_GREATER "3.21"))
|
||||
# Install runtime dependency by default, when using vcpkg
|
||||
IF(NOT DEFINED INSTALL_RUNTIME_DEPENDENCIES_DEFAULT)
|
||||
IF("${VCPKG_INSTALLED_DIR}")
|
||||
SET(INSTALL_RUNTIME_DEPENDENCIES_DEFAULT OFF)
|
||||
ELSE()
|
||||
SET(INSTALL_RUNTIME_DEPENDENCIES_DEFAULT ON)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
OPTION(INSTALL_RUNTIME_DEPENDENCIES "Install runtime dependencies" "${INSTALL_RUNTIME_DEPENDENCIES_DEFAULT}")
|
||||
ENDIF()
|
||||
|
||||
# Following autotools tradition, add preprocessor definitions
|
||||
# specified in environment variable CPPFLAGS
|
||||
IF(DEFINED ENV{CPPFLAGS})
|
||||
|
@ -199,7 +199,7 @@ FUNCTION(SIGN_TARGET target)
|
||||
ENDFUNCTION()
|
||||
|
||||
# Installs targets, also installs pdbs on Windows.
|
||||
#
|
||||
# Also installs runtime dependencies
|
||||
#
|
||||
|
||||
FUNCTION(MYSQL_INSTALL_TARGETS)
|
||||
@ -230,9 +230,34 @@ FUNCTION(MYSQL_INSTALL_TARGETS)
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
INSTALL(TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION} ${COMP})
|
||||
IF(WIN32 AND INSTALL_RUNTIME_DEPENDENCIES)
|
||||
STRING(JOIN "." runtime_deps_set_name ${TARGETS})
|
||||
SET(RUNTIME_DEPS RUNTIME_DEPENDENCY_SET "${runtime_deps_set_name}")
|
||||
ENDIF()
|
||||
|
||||
INSTALL(TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION} ${COMP} ${RUNTIME_DEPS})
|
||||
INSTALL_DEBUG_SYMBOLS(${TARGETS} ${COMP} INSTALL_LOCATION ${ARG_DESTINATION})
|
||||
|
||||
IF(WIN32 AND INSTALL_RUNTIME_DEPENDENCIES)
|
||||
INSTALL(
|
||||
RUNTIME_DEPENDENCY_SET
|
||||
"${runtime_deps_set_name}"
|
||||
COMPONENT RuntimeDeps
|
||||
DESTINATION ${INSTALL_BINDIR}
|
||||
PRE_EXCLUDE_REGEXES
|
||||
"api-ms-" # Windows stuff
|
||||
"ext-ms-"
|
||||
"server\\.dll" # main server DLL, installed separately
|
||||
"clang_rt" # ASAN libraries
|
||||
"vcruntime"
|
||||
POST_EXCLUDE_REGEXES
|
||||
".*system32/.*\\.dll" # Windows stuff
|
||||
POST_INCLUDE_REGEXES
|
||||
DIRECTORIES
|
||||
${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin
|
||||
$<$<CONFIG:Debug>:${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin>
|
||||
)
|
||||
ENDIF()
|
||||
ENDFUNCTION()
|
||||
|
||||
# Optionally install mysqld/client/embedded from debug build run. outside of the current build dir
|
||||
|
@ -48,9 +48,9 @@ FUNCTION (MYSQL_ADD_EXECUTABLE)
|
||||
ENDIF()
|
||||
|
||||
IF (ARG_WIN32)
|
||||
SET(WIN32 WIN32)
|
||||
SET(ARG_WIN32 WIN32)
|
||||
ELSE()
|
||||
UNSET(WIN32)
|
||||
UNSET(ARG_WIN32)
|
||||
ENDIF()
|
||||
IF (ARG_MACOSX_BUNDLE)
|
||||
SET(MACOSX_BUNDLE MACOSX_BUNDLE)
|
||||
@ -63,7 +63,7 @@ FUNCTION (MYSQL_ADD_EXECUTABLE)
|
||||
UNSET(EXCLUDE_FROM_ALL)
|
||||
ENDIF()
|
||||
|
||||
ADD_EXECUTABLE(${target} ${WIN32} ${MACOSX_BUNDLE} ${EXCLUDE_FROM_ALL} ${sources})
|
||||
ADD_EXECUTABLE(${target} ${ARG_WIN32} ${MACOSX_BUNDLE} ${EXCLUDE_FROM_ALL} ${sources})
|
||||
|
||||
# tell CPack where to install
|
||||
IF(NOT ARG_EXCLUDE_FROM_ALL)
|
||||
|
@ -37,7 +37,7 @@ add_component_group(AlwaysInstall HIDDEN
|
||||
DISPLAY_NAME "AlwaysInstall"
|
||||
DESCRIPTION "Always installed components")
|
||||
|
||||
foreach(c Readme Common VCCRT)
|
||||
foreach(c Readme Common VCCRT RuntimeDeps)
|
||||
add_component(${c} GROUP AlwaysInstall)
|
||||
endforeach()
|
||||
|
||||
@ -53,7 +53,8 @@ add_component(Backup
|
||||
DESCRIPTION "Installs backup utilities(mariabackup and mbstream)")
|
||||
|
||||
#Miscellaneous hidden components, part of server / or client programs
|
||||
foreach(comp connect-engine connect-engine-jdbc ClientPlugins aws-key-management rocksdb-engine)
|
||||
foreach(comp connect-engine connect-engine-jdbc ClientPlugins aws-key-management rocksdb-engine
|
||||
hashicorp-key-management)
|
||||
add_component(${comp} GROUP MySQLServer HIDDEN)
|
||||
endforeach()
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
# Components ignored in both ZIP and WIX generators
|
||||
set(COMPONENTS_IGNORE Debuginfo Server_Scripts SqlBench Test Embedded hashicorp-key-management plugin-hashicorp-key-management)
|
||||
set(COMPONENTS_IGNORE Debuginfo Server_Scripts SqlBench Test Embedded plugin-hashicorp-key-management)
|
||||
|
Loading…
x
Reference in New Issue
Block a user