Build/deploy: Move copying qtdiag to deploy.py

Moving things away from deployqtHelper_mac.sh

Change-Id: Ic71ad9a8ed522dc8c4eaa745ec519d9d705d1073
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
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 09:07:15 +02:00
parent 22476fc26f
commit fe18525326
3 changed files with 35 additions and 26 deletions

View File

@@ -41,6 +41,7 @@ function(setup_dependencies_component)
endif()
execute_process(COMMAND
\"${Python3_EXECUTABLE}\"
\"-u\"
\"${CMAKE_CURRENT_LIST_DIR}/scripts/deploy.py\"
${_llvm_arg}
${_elfutils_arg}

View File

@@ -49,6 +49,9 @@ def get_args():
return args
def with_exe_ext(filepath):
return filepath + '.exe' if common.is_windows_platform() else filepath
def which(program):
def is_exe(fpath):
return os.path.exists(fpath) and os.access(fpath, os.X_OK)
@@ -158,12 +161,21 @@ def copy_qt_libs(target_qt_prefix_path, qt_bin_dir, qt_libs_dir, qt_plugin_dir,
print('{0} -> {1}'.format(qt_qml_dir, target))
common.copytree(qt_qml_dir, target, ignore=ignored_qt_lib_files, symlinks=True)
def deploy_qtdiag(qtc_binary_path, qt_install):
print("Copying qtdiag")
bin_dest = target_qt_prefix_path if common.is_windows_platform() else os.path.join(target_qt_prefix_path, 'bin')
qtdiag_src = os.path.join(qt_bin_dir, 'qtdiag.exe' if common.is_windows_platform() else 'qtdiag')
if not os.path.exists(bin_dest):
os.makedirs(bin_dest)
shutil.copy(qtdiag_src, bin_dest)
qtdiag_src = os.path.join(qt_install.bin, with_exe_ext('qtdiag'))
destdir = (qtc_binary_path if common.is_windows_platform()
else os.path.join(qtc_binary_path, 'Contents', 'MacOS') if common.is_mac_platform()
else os.path.join(qtc_binary_path, '..', 'lib', 'Qt', 'bin'))
if not os.path.exists(destdir):
os.makedirs(destdir)
shutil.copy(qtdiag_src, destdir)
if common.is_mac_platform():
# fix RPATHs
qtdiag_dest = os.path.join(destdir, 'qtdiag')
subprocess.check_call(['xcrun', 'install_name_tool', '-add_rpath', '@loader_path/../Frameworks', qtdiag_dest])
subprocess.check_call(['xcrun', 'install_name_tool', '-delete_rpath', '@loader_path/../lib', qtdiag_dest])
def add_qt_conf(target_path, qt_prefix_path):
@@ -336,19 +348,6 @@ def get_qt_install_info(qmake_binary):
def main():
args = get_args()
if common.is_mac_platform():
deploy_mac(args)
return
(qt_install_info, qt_install) = get_qt_install_info(args.qmake_binary)
qtcreator_binary_path = os.path.dirname(args.qtcreator_binary)
install_dir = os.path.abspath(os.path.join(qtcreator_binary_path, '..'))
if common.is_linux_platform():
qt_deploy_prefix = os.path.join(install_dir, 'lib', 'Qt')
else:
qt_deploy_prefix = os.path.join(install_dir, 'bin')
chrpath_bin = None
if common.is_linux_platform():
chrpath_bin = which('chrpath')
@@ -356,6 +355,23 @@ def main():
print("Cannot find required binary 'chrpath'.")
sys.exit(2)
(qt_install_info, qt_install) = get_qt_install_info(args.qmake_binary)
# <qtc>/bin for Win/Lin, <path>/<appname>.app for macOS
qtcreator_binary_path = (args.qtcreator_binary if common.is_mac_platform()
else os.path.dirname(args.qtcreator_binary))
deploy_qtdiag(qtcreator_binary_path, qt_install)
if common.is_mac_platform():
deploy_mac(args)
return
install_dir = os.path.abspath(os.path.join(qtcreator_binary_path, '..'))
if common.is_linux_platform():
qt_deploy_prefix = os.path.join(install_dir, 'lib', 'Qt')
else:
qt_deploy_prefix = os.path.join(install_dir, 'bin')
plugins = ['assetimporters', 'accessible', 'codecs', 'designer', 'iconengines', 'imageformats', 'platformthemes',
'platforminputcontexts', 'platforms', 'printsupport', 'qmltooling', 'sqldrivers', 'styles',
'xcbglintegrations',

View File

@@ -16,14 +16,6 @@ quick2_src="$5"
echo "Deploying Qt"
# copy qtdiag
echo "- Copying qtdiag"
cp "$bin_src/qtdiag" "$app_path/Contents/MacOS/" || exit 1
# fix rpath if qtdiag was from binary Qt package
( xcrun install_name_tool -delete_rpath "@loader_path/../lib" "$app_path/Contents/MacOS/qtdiag" &&
xcrun install_name_tool -add_rpath "@loader_path/../Frameworks" "$app_path/Contents/MacOS/qtdiag" ) || true
# collect designer plugins
designerDestDir="$app_path/Contents/PlugIns/designer"
if [ ! -d "$designerDestDir" ]; then