diff options
| -rw-r--r-- | cmake/Utils.cmake | 1 | ||||
| -rwxr-xr-x | scripts/deploy.py | 46 | ||||
| -rwxr-xr-x | scripts/deployqtHelper_mac.sh | 8 |
3 files changed, 32 insertions, 23 deletions
diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake index b08aaee4a84..b1be1ccf105 100644 --- a/cmake/Utils.cmake +++ b/cmake/Utils.cmake @@ -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} diff --git a/scripts/deploy.py b/scripts/deploy.py index 70a8399c8cc..8415bd2389a 100755 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -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,26 +348,30 @@ def get_qt_install_info(qmake_binary): def main(): args = get_args() + chrpath_bin = None + if common.is_linux_platform(): + chrpath_bin = which('chrpath') + if chrpath_bin == None: + 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 - (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') - if chrpath_bin == None: - print("Cannot find required binary 'chrpath'.") - sys.exit(2) - plugins = ['assetimporters', 'accessible', 'codecs', 'designer', 'iconengines', 'imageformats', 'platformthemes', 'platforminputcontexts', 'platforms', 'printsupport', 'qmltooling', 'sqldrivers', 'styles', 'xcbglintegrations', diff --git a/scripts/deployqtHelper_mac.sh b/scripts/deployqtHelper_mac.sh index 6ef3fcdb8d1..ece10ef24d2 100755 --- a/scripts/deployqtHelper_mac.sh +++ b/scripts/deployqtHelper_mac.sh @@ -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 |
