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:
@@ -385,9 +385,6 @@ if(UNIX AND APPLE)
|
|||||||
set(RESOURCES_DEST_DIR "${Launcher_Name}.app/Contents/Resources")
|
set(RESOURCES_DEST_DIR "${Launcher_Name}.app/Contents/Resources")
|
||||||
set(JARS_DEST_DIR "${Launcher_Name}.app/Contents/MacOS/jars")
|
set(JARS_DEST_DIR "${Launcher_Name}.app/Contents/MacOS/jars")
|
||||||
|
|
||||||
# Apps to bundle
|
|
||||||
set(APPS "\${CMAKE_INSTALL_PREFIX}/${Launcher_Name}.app")
|
|
||||||
|
|
||||||
# Mac bundle settings
|
# Mac bundle settings
|
||||||
set(MACOSX_BUNDLE_BUNDLE_NAME "${Launcher_DisplayName}")
|
set(MACOSX_BUNDLE_BUNDLE_NAME "${Launcher_DisplayName}")
|
||||||
set(MACOSX_BUNDLE_INFO_STRING "${Launcher_DisplayName}: A custom launcher for Minecraft that allows you to easily manage multiple installations of Minecraft at once.")
|
set(MACOSX_BUNDLE_INFO_STRING "${Launcher_DisplayName}: A custom launcher for Minecraft that allows you to easily manage multiple installations of Minecraft at once.")
|
||||||
@@ -404,9 +401,6 @@ if(UNIX AND APPLE)
|
|||||||
set(MACOSX_SPARKLE_SHA256 "50612a06038abc931f16011d7903b8326a362c1074dabccb718404ce8e585f0b" CACHE STRING "SHA256 checksum for Sparkle release archive")
|
set(MACOSX_SPARKLE_SHA256 "50612a06038abc931f16011d7903b8326a362c1074dabccb718404ce8e585f0b" CACHE STRING "SHA256 checksum for Sparkle release archive")
|
||||||
set(MACOSX_SPARKLE_DIR "${CMAKE_BINARY_DIR}/frameworks/Sparkle")
|
set(MACOSX_SPARKLE_DIR "${CMAKE_BINARY_DIR}/frameworks/Sparkle")
|
||||||
|
|
||||||
# directories to look for dependencies
|
|
||||||
set(DIRS ${QT_LIBS_DIR} ${QT_LIBEXECS_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${MACOSX_SPARKLE_DIR})
|
|
||||||
|
|
||||||
if(NOT MACOSX_SPARKLE_UPDATE_PUBLIC_KEY STREQUAL "" AND NOT MACOSX_SPARKLE_UPDATE_FEED_URL STREQUAL "")
|
if(NOT MACOSX_SPARKLE_UPDATE_PUBLIC_KEY STREQUAL "" AND NOT MACOSX_SPARKLE_UPDATE_FEED_URL STREQUAL "")
|
||||||
set(Launcher_ENABLE_UPDATER YES)
|
set(Launcher_ENABLE_UPDATER YES)
|
||||||
endif()
|
endif()
|
||||||
@@ -441,12 +435,6 @@ elseif(UNIX)
|
|||||||
set(PLUGIN_DEST_DIR "plugins")
|
set(PLUGIN_DEST_DIR "plugins")
|
||||||
set(BUNDLE_DEST_DIR ".")
|
set(BUNDLE_DEST_DIR ".")
|
||||||
set(RESOURCES_DEST_DIR ".")
|
set(RESOURCES_DEST_DIR ".")
|
||||||
|
|
||||||
# Apps to bundle
|
|
||||||
set(APPS "\${CMAKE_INSTALL_PREFIX}/bin/${Launcher_APP_BINARY_NAME}")
|
|
||||||
|
|
||||||
# directories to look for dependencies
|
|
||||||
set(DIRS ${QT_LIBS_DIR} ${QT_LIBEXECS_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(Launcher_ManPage)
|
if(Launcher_ManPage)
|
||||||
@@ -464,12 +452,6 @@ elseif(WIN32)
|
|||||||
set(RESOURCES_DEST_DIR ".")
|
set(RESOURCES_DEST_DIR ".")
|
||||||
set(JARS_DEST_DIR "jars")
|
set(JARS_DEST_DIR "jars")
|
||||||
|
|
||||||
# Apps to bundle
|
|
||||||
set(APPS "\${CMAKE_INSTALL_PREFIX}/${Launcher_Name}.exe")
|
|
||||||
|
|
||||||
# directories to look for dependencies
|
|
||||||
set(DIRS ${QT_LIBS_DIR} ${QT_LIBEXECS_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
|
||||||
|
|
||||||
# install as bundle
|
# install as bundle
|
||||||
set(INSTALL_BUNDLE "full" CACHE STRING "Use fixup_bundle to bundle dependencies")
|
set(INSTALL_BUNDLE "full" CACHE STRING "Use fixup_bundle to bundle dependencies")
|
||||||
else()
|
else()
|
||||||
|
|||||||
@@ -1385,6 +1385,7 @@ if(DEFINED Launcher_APP_BINARY_DEFS)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS ${Launcher_Name}
|
install(TARGETS ${Launcher_Name}
|
||||||
|
RUNTIME_DEPENDENCY_SET LAUNCHER_DEPENDENCY_SET
|
||||||
BUNDLE DESTINATION "." COMPONENT Runtime
|
BUNDLE DESTINATION "." COMPONENT Runtime
|
||||||
LIBRARY DESTINATION ${LIBRARY_DEST_DIR} COMPONENT Runtime
|
LIBRARY DESTINATION ${LIBRARY_DEST_DIR} COMPONENT Runtime
|
||||||
RUNTIME DESTINATION ${BINARY_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.
|
# 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.
|
# NOTE: it seems that this absolutely has to be here, and nowhere else.
|
||||||
if(INSTALL_BUNDLE STREQUAL "full")
|
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
|
# Add qt.conf - this makes Qt stop looking for things outside the bundle
|
||||||
install(
|
install(
|
||||||
CODE "file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${RESOURCES_DEST_DIR}/qt.conf\" \" \")"
|
CODE "file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${RESOURCES_DEST_DIR}/qt.conf\" \" \")"
|
||||||
COMPONENT Runtime
|
COMPONENT Runtime
|
||||||
)
|
)
|
||||||
# add qtlogging.ini as a config file
|
# Add qtlogging.ini as a config file
|
||||||
install(
|
install(
|
||||||
FILES "qtlogging.ini"
|
FILES "qtlogging.ini"
|
||||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${RESOURCES_DEST_DIR}
|
DESTINATION ${CMAKE_INSTALL_PREFIX}/${RESOURCES_DEST_DIR}
|
||||||
COMPONENT Runtime
|
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()
|
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@")
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user