Build/deploy: Move copying plugins to deploy.py

Moving things away from deployqtHelper_mac.sh

Change-Id: I0470432a0ffa33437e3249d3fb3766d511073caf
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Eike Ziller
2023-07-26 14:19:37 +02:00
parent fe18525326
commit fc29c72b65
2 changed files with 35 additions and 49 deletions

View File

@@ -108,12 +108,15 @@ def is_ignored_windows_file(use_debug, basepath, filename):
def ignored_qt_lib_files(path, filenames): def ignored_qt_lib_files(path, filenames):
# Qt ships some unneeded object files in the qml plugins # Qt ships some unneeded object files in the qml plugins
# On Windows we also do not want to ship the wrong debug/release .dlls or .lib files etc # On Windows we also do not want to ship the wrong debug/release .dlls or .lib files etc
if not common.is_windows_platform(): # And get rid of debug info directories (.dSYM) on macOS
if common.is_linux_platform():
return [fn for fn in filenames if fn.endswith('.cpp.o')] return [fn for fn in filenames if fn.endswith('.cpp.o')]
if common.is_mac_platform():
return [fn for fn in filenames if fn.endswith('.dylib.dSYM')]
return [fn for fn in filenames return [fn for fn in filenames
if fn.endswith('.cpp.obj') or is_ignored_windows_file(debug_build, path, fn)] if fn.endswith('.cpp.obj') or is_ignored_windows_file(debug_build, path, fn)]
def copy_qt_libs(target_qt_prefix_path, qt_bin_dir, qt_libs_dir, qt_plugin_dir, qt_qml_dir, plugins): def copy_qt_libs(target_qt_prefix_path, qt_bin_dir, qt_libs_dir, qt_qml_dir):
print("copying Qt libraries...") print("copying Qt libraries...")
if common.is_windows_platform(): if common.is_windows_platform():
@@ -143,16 +146,6 @@ def copy_qt_libs(target_qt_prefix_path, qt_bin_dir, qt_libs_dir, qt_plugin_dir,
else: else:
shutil.copy(library, lib_dest) shutil.copy(library, lib_dest)
print("Copying plugins:", plugins)
for plugin in plugins:
target = os.path.join(target_qt_prefix_path, 'plugins', plugin)
if (os.path.exists(target)):
shutil.rmtree(target)
pluginPath = os.path.join(qt_plugin_dir, plugin)
if (os.path.exists(pluginPath)):
print('{0} -> {1}'.format(pluginPath, target))
common.copytree(pluginPath, target, ignore=ignored_qt_lib_files, symlinks=True)
if (os.path.exists(qt_qml_dir)): if (os.path.exists(qt_qml_dir)):
print("Copying qt quick 2 imports") print("Copying qt quick 2 imports")
target = os.path.join(target_qt_prefix_path, 'qml') target = os.path.join(target_qt_prefix_path, 'qml')
@@ -178,6 +171,29 @@ def deploy_qtdiag(qtc_binary_path, qt_install):
subprocess.check_call(['xcrun', 'install_name_tool', '-delete_rpath', '@loader_path/../lib', qtdiag_dest]) subprocess.check_call(['xcrun', 'install_name_tool', '-delete_rpath', '@loader_path/../lib', qtdiag_dest])
def deploy_plugins(qtc_binary_path, qt_install):
plugins = ['assetimporters', 'accessible', 'codecs', 'designer', 'iconengines', 'imageformats', 'platformthemes',
'platforminputcontexts', 'platforms', 'printsupport', 'qmltooling', 'sqldrivers', 'styles',
'xcbglintegrations',
'wayland-decoration-client',
'wayland-graphics-integration-client',
'wayland-shell-integration',
'tls'
]
print("Copying plugins:", plugins)
destdir = (os.path.join(qtc_binary_path, 'plugins') if common.is_windows_platform()
else os.path.join(qtc_binary_path, 'Contents', 'PlugIns') if common.is_mac_platform()
else os.path.join(qtc_binary_path, '..', 'lib', 'Qt', 'plugins'))
for plugin in plugins:
target = os.path.join(destdir, plugin)
if (os.path.exists(target)):
shutil.rmtree(target)
pluginPath = os.path.join(qt_install.plugins, plugin)
if (os.path.exists(pluginPath)):
print('{0} -> {1}'.format(pluginPath, target))
common.copytree(pluginPath, target, ignore=ignored_qt_lib_files, symlinks=True)
def add_qt_conf(target_path, qt_prefix_path): def add_qt_conf(target_path, qt_prefix_path):
qtconf_filepath = os.path.join(target_path, 'qt.conf') qtconf_filepath = os.path.join(target_path, 'qt.conf')
prefix_path = os.path.relpath(qt_prefix_path, target_path).replace('\\', '/') prefix_path = os.path.relpath(qt_prefix_path, target_path).replace('\\', '/')
@@ -355,12 +371,17 @@ def main():
print("Cannot find required binary 'chrpath'.") print("Cannot find required binary 'chrpath'.")
sys.exit(2) sys.exit(2)
if common.is_windows_platform():
global debug_build
debug_build = is_debug(args.qtcreator_binary)
(qt_install_info, qt_install) = get_qt_install_info(args.qmake_binary) (qt_install_info, qt_install) = get_qt_install_info(args.qmake_binary)
# <qtc>/bin for Win/Lin, <path>/<appname>.app for macOS # <qtc>/bin for Win/Lin, <path>/<appname>.app for macOS
qtcreator_binary_path = (args.qtcreator_binary if common.is_mac_platform() qtcreator_binary_path = (args.qtcreator_binary if common.is_mac_platform()
else os.path.dirname(args.qtcreator_binary)) else os.path.dirname(args.qtcreator_binary))
deploy_qtdiag(qtcreator_binary_path, qt_install) deploy_qtdiag(qtcreator_binary_path, qt_install)
deploy_plugins(qtcreator_binary_path, qt_install)
if common.is_mac_platform(): if common.is_mac_platform():
deploy_mac(args) deploy_mac(args)
@@ -372,23 +393,10 @@ def main():
else: else:
qt_deploy_prefix = os.path.join(install_dir, 'bin') qt_deploy_prefix = os.path.join(install_dir, 'bin')
plugins = ['assetimporters', 'accessible', 'codecs', 'designer', 'iconengines', 'imageformats', 'platformthemes',
'platforminputcontexts', 'platforms', 'printsupport', 'qmltooling', 'sqldrivers', 'styles',
'xcbglintegrations',
'wayland-decoration-client',
'wayland-graphics-integration-client',
'wayland-shell-integration',
'tls'
]
if common.is_windows_platform(): if common.is_windows_platform():
global debug_build copy_qt_libs(qt_deploy_prefix, qt_install.bin, qt_install.bin, qt_install.qml)
debug_build = is_debug(args.qtcreator_binary)
if common.is_windows_platform():
copy_qt_libs(qt_deploy_prefix, qt_install.bin, qt_install.bin, qt_install.plugins, qt_install.qml, plugins)
else: else:
copy_qt_libs(qt_deploy_prefix, qt_install.bin, qt_install.lib, qt_install.plugins, qt_install.qml, plugins) copy_qt_libs(qt_deploy_prefix, qt_install.bin, qt_install.lib, qt_install.qml)
copy_translations(install_dir, qt_install.translations) copy_translations(install_dir, qt_install.translations)
if args.llvm_path: if args.llvm_path:
deploy_clang(install_dir, args.llvm_path, chrpath_bin) deploy_clang(install_dir, args.llvm_path, chrpath_bin)

View File

@@ -11,32 +11,10 @@ resource_path="$app_path/Contents/Resources"
libexec_path="$app_path/Contents/Resources/libexec" libexec_path="$app_path/Contents/Resources/libexec"
bin_src="$2" bin_src="$2"
translation_src="$3" translation_src="$3"
plugin_src="$4"
quick2_src="$5" quick2_src="$5"
echo "Deploying Qt" echo "Deploying Qt"
# collect designer plugins
designerDestDir="$app_path/Contents/PlugIns/designer"
if [ ! -d "$designerDestDir" ]; then
echo "- Copying designer plugins"
mkdir -p "$designerDestDir"
for plugin in "$plugin_src"/designer/*.dylib; do
cp "$plugin" "$designerDestDir"/ || exit 1
done
fi
# collect 3d assetimporter plugins
assetimporterDestDir="$app_path/Contents/PlugIns/assetimporters"
assetimporterSrcDir="$plugin_src/assetimporters"
if [ -d "$assetimporterSrcDir" ]; then
if [ ! -d "$assetimporterDestDir" ]; then
echo "- Copying 3d assetimporter plugins"
mkdir -p "$assetimporterDestDir"
find "$assetimporterSrcDir" -iname "*.dylib" -maxdepth 1 -exec cp {} "$assetimporterDestDir"/ \;
fi
fi
# copy Qt Quick 2 imports # copy Qt Quick 2 imports
imports2Dir="$app_path/Contents/Imports/qtquick2" imports2Dir="$app_path/Contents/Imports/qtquick2"
if [ -d "$quick2_src" ]; then if [ -d "$quick2_src" ]; then