build: modernize launcher bundling
Replaces fixup_bundle with Qt's deployment scripts and CMake's newer RUNTIME_DEPENDENCY_SET target, making it a bit easier to find and include linked dependencies with less code on our end Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
parent
91abebbb59
commit
1688db055e
3 changed files with 43 additions and 213 deletions
|
@ -1385,6 +1385,7 @@ if(DEFINED Launcher_APP_BINARY_DEFS)
|
|||
endif()
|
||||
|
||||
install(TARGETS ${Launcher_Name}
|
||||
RUNTIME_DEPENDENCY_SET LAUNCHER_DEPENDENCY_SET
|
||||
BUNDLE DESTINATION "." COMPONENT Runtime
|
||||
LIBRARY DESTINATION ${LIBRARY_DEST_DIR} COMPONENT Runtime
|
||||
RUNTIME DESTINATION ${BINARY_DEST_DIR} COMPONENT Runtime
|
||||
|
@ -1498,183 +1499,56 @@ endif()
|
|||
# Bundle utilities are used to complete the portable packages - they add all the libraries that would otherwise be missing on the target system.
|
||||
# NOTE: it seems that this absolutely has to be here, and nowhere else.
|
||||
if(INSTALL_BUNDLE STREQUAL "full")
|
||||
if(WIN32)
|
||||
set(QT_DEPLOY_TOOL_OPTIONS "--no-opengl-sw --no-quick-import --no-system-d3d-compiler --no-system-dxc-compiler --skip-plugin-types generic,networkinformation")
|
||||
endif()
|
||||
|
||||
qt_generate_deploy_script(
|
||||
TARGET ${Launcher_Name}
|
||||
OUTPUT_SCRIPT QT_DEPLOY_SCRIPT
|
||||
CONTENT "
|
||||
qt_deploy_runtime_dependencies(
|
||||
EXECUTABLE ${BINARY_DEST_DIR}/$<TARGET_FILE_NAME:${Launcher_Name}>
|
||||
BIN_DIR ${BINARY_DEST_DIR}
|
||||
LIBEXEC_DIR ${LIBRARY_DEST_DIR}
|
||||
LIB_DIR ${LIBRARY_DEST_DIR}
|
||||
PLUGINS_DIR ${PLUGIN_DEST_DIR}
|
||||
NO_OVERWRITE
|
||||
NO_TRANSLATIONS
|
||||
NO_COMPILER_RUNTIME
|
||||
DEPLOY_TOOL_OPTIONS ${QT_DEPLOY_TOOL_OPTIONS}
|
||||
)"
|
||||
)
|
||||
|
||||
# Bundle our linked dependencies
|
||||
install(RUNTIME_DEPENDENCY_SET LAUNCHER_DEPENDENCY_SET
|
||||
DIRECTORIES
|
||||
${CMAKE_SYSTEM_LIBRARY_PATH}
|
||||
${QT_LIBS_DIR}
|
||||
${QT_LIBEXECS_DIR}
|
||||
PRE_EXCLUDE_REGEXES
|
||||
"^(api-ms-win|ext-ms)-.*\\.dll$"
|
||||
# FIXME: Why aren't these caught by the below regex???
|
||||
"^azure.*\\.dll$"
|
||||
"^vcruntime.*\\.dll$"
|
||||
POST_EXCLUDE_REGEXES
|
||||
"system32"
|
||||
LIBRARY DESTINATION ${LIBRARY_DEST_DIR}
|
||||
RUNTIME DESTINATION ${BINARY_DEST_DIR}
|
||||
FRAMEWORK DESTINATION ${FRAMEWORK_DEST_DIR}
|
||||
)
|
||||
# Deploy Qt plugins
|
||||
install(SCRIPT ${QT_DEPLOY_SCRIPT})
|
||||
|
||||
# Add qt.conf - this makes Qt stop looking for things outside the bundle
|
||||
install(
|
||||
CODE "file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${RESOURCES_DEST_DIR}/qt.conf\" \" \")"
|
||||
COMPONENT Runtime
|
||||
)
|
||||
# add qtlogging.ini as a config file
|
||||
# Add qtlogging.ini as a config file
|
||||
install(
|
||||
FILES "qtlogging.ini"
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${RESOURCES_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
)
|
||||
# Bundle plugins
|
||||
# Image formats
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/imageformats"
|
||||
CONFIGURATIONS Debug RelWithDebInfo ""
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
REGEX "tga|tiff|mng" EXCLUDE
|
||||
)
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/imageformats"
|
||||
CONFIGURATIONS Release MinSizeRel
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
REGEX "tga|tiff|mng" EXCLUDE
|
||||
REGEX "d\\." EXCLUDE
|
||||
REGEX "_debug\\." EXCLUDE
|
||||
REGEX "\\.dSYM" EXCLUDE
|
||||
)
|
||||
# Icon engines
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/iconengines"
|
||||
CONFIGURATIONS Debug RelWithDebInfo ""
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
REGEX "fontawesome" EXCLUDE
|
||||
)
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/iconengines"
|
||||
CONFIGURATIONS Release MinSizeRel
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
REGEX "fontawesome" EXCLUDE
|
||||
REGEX "d\\." EXCLUDE
|
||||
REGEX "_debug\\." EXCLUDE
|
||||
REGEX "\\.dSYM" EXCLUDE
|
||||
)
|
||||
# Platform plugins
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/platforms"
|
||||
CONFIGURATIONS Debug RelWithDebInfo ""
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
REGEX "minimal|linuxfb|offscreen" EXCLUDE
|
||||
)
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/platforms"
|
||||
CONFIGURATIONS Release MinSizeRel
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
REGEX "minimal|linuxfb|offscreen" EXCLUDE
|
||||
REGEX "[^2]d\\." EXCLUDE
|
||||
REGEX "_debug\\." EXCLUDE
|
||||
REGEX "\\.dSYM" EXCLUDE
|
||||
)
|
||||
# Style plugins
|
||||
if(EXISTS "${QT_PLUGINS_DIR}/styles")
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/styles"
|
||||
CONFIGURATIONS Debug RelWithDebInfo ""
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
)
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/styles"
|
||||
CONFIGURATIONS Release MinSizeRel
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
REGEX "d\\." EXCLUDE
|
||||
REGEX "_debug\\." EXCLUDE
|
||||
REGEX "\\.dSYM" EXCLUDE
|
||||
)
|
||||
endif()
|
||||
# TLS plugins (Qt 6 only)
|
||||
if(EXISTS "${QT_PLUGINS_DIR}/tls")
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/tls"
|
||||
CONFIGURATIONS Debug RelWithDebInfo ""
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
PATTERN "*qcertonlybackend*" EXCLUDE
|
||||
)
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/tls"
|
||||
CONFIGURATIONS Release MinSizeRel
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
REGEX "dd\\." EXCLUDE
|
||||
REGEX "_debug\\." EXCLUDE
|
||||
REGEX "\\.dSYM" EXCLUDE
|
||||
PATTERN "*qcertonlybackend*" EXCLUDE
|
||||
)
|
||||
endif()
|
||||
# Wayland support
|
||||
if(EXISTS "${QT_PLUGINS_DIR}/wayland-graphics-integration-client")
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/wayland-graphics-integration-client"
|
||||
CONFIGURATIONS Debug RelWithDebInfo ""
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
)
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/wayland-graphics-integration-client"
|
||||
CONFIGURATIONS Release MinSizeRel
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
REGEX "dd\\." EXCLUDE
|
||||
REGEX "_debug\\." EXCLUDE
|
||||
REGEX "\\.dSYM" EXCLUDE
|
||||
)
|
||||
endif()
|
||||
if(EXISTS "${QT_PLUGINS_DIR}/wayland-graphics-integration-server")
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/wayland-graphics-integration-server"
|
||||
CONFIGURATIONS Debug RelWithDebInfo ""
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
)
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/wayland-graphics-integration-server"
|
||||
CONFIGURATIONS Release MinSizeRel
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
REGEX "dd\\." EXCLUDE
|
||||
REGEX "_debug\\." EXCLUDE
|
||||
REGEX "\\.dSYM" EXCLUDE
|
||||
)
|
||||
endif()
|
||||
if(EXISTS "${QT_PLUGINS_DIR}/wayland-decoration-client")
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/wayland-decoration-client"
|
||||
CONFIGURATIONS Debug RelWithDebInfo ""
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
)
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/wayland-decoration-client"
|
||||
CONFIGURATIONS Release MinSizeRel
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
REGEX "dd\\." EXCLUDE
|
||||
REGEX "_debug\\." EXCLUDE
|
||||
REGEX "\\.dSYM" EXCLUDE
|
||||
)
|
||||
endif()
|
||||
if(EXISTS "${QT_PLUGINS_DIR}/wayland-shell-integration")
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/wayland-shell-integration"
|
||||
CONFIGURATIONS Debug RelWithDebInfo ""
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
)
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/wayland-shell-integration"
|
||||
CONFIGURATIONS Release MinSizeRel
|
||||
DESTINATION ${PLUGIN_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
REGEX "dd\\." EXCLUDE
|
||||
REGEX "_debug\\." EXCLUDE
|
||||
REGEX "\\.dSYM" EXCLUDE
|
||||
)
|
||||
endif()
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/install_prereqs.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/install_prereqs.cmake"
|
||||
@ONLY
|
||||
)
|
||||
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/install_prereqs.cmake" COMPONENT Runtime)
|
||||
endif()
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
set(CMAKE_MODULE_PATH "@CMAKE_MODULE_PATH@")
|
||||
file(GLOB_RECURSE QTPLUGINS "${CMAKE_INSTALL_PREFIX}/@PLUGIN_DEST_DIR@/*@CMAKE_SHARED_LIBRARY_SUFFIX@")
|
||||
function(gp_resolved_file_type_override resolved_file type_var)
|
||||
if(resolved_file MATCHES "^/(usr/)?lib/libQt")
|
||||
set(${type_var} other PARENT_SCOPE)
|
||||
elseif(resolved_file MATCHES "^/(usr/)?lib(.+)?/libxcb-")
|
||||
set(${type_var} other PARENT_SCOPE)
|
||||
elseif(resolved_file MATCHES "^/(usr/)?lib(.+)?/libicu")
|
||||
set(${type_var} other PARENT_SCOPE)
|
||||
elseif(resolved_file MATCHES "^/(usr/)?lib(.+)?/libpng")
|
||||
set(${type_var} other PARENT_SCOPE)
|
||||
elseif(resolved_file MATCHES "^/(usr/)?lib(.+)?/libproxy")
|
||||
set(${type_var} other PARENT_SCOPE)
|
||||
elseif((resolved_file MATCHES "^/(usr/)?lib(.+)?/libstdc\\+\\+") AND (UNIX AND NOT APPLE))
|
||||
set(${type_var} other PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
set(gp_tool "@CMAKE_GP_TOOL@")
|
||||
set(gp_cmd_paths ${gp_cmd_paths}
|
||||
"@CMAKE_GP_CMD_PATHS@"
|
||||
)
|
||||
|
||||
include(BundleUtilities)
|
||||
fixup_bundle("@APPS@" "${QTPLUGINS}" "@DIRS@")
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue