qt模块依赖

//1
if (containsHowOften(deploymentInfo.deployedLibraries, "libQt5Gui")
    || containsHowOften(deploymentInfo.deployedLibraries, "libQt6Gui")) {
    LogDebug() << "libQt5Gui/libQt6Gui detected";
    pluginList.append("platforms/libqxcb.so");
    // pluginList.append("iconengines");
    // pluginList.append("imageformats");
    // Platform plugin contexts - apparently needed to enter special characters
    QStringList platformPluginContexts = QDir(pluginSourcePath + QStringLiteral("/platforminputcontexts")).entryList(QStringList() << QStringLiteral("*.so"));
    foreach(const QString &plugin, platformPluginContexts) {
        pluginList.append(QStringLiteral("platforminputcontexts/") + plugin);
    }
    // Platform OpenGL context
    if ((containsHowOften(deploymentInfo.deployedLibraries, "libQt5OpenGL"))
        or(containsHowOften(deploymentInfo.deployedLibraries, "libQt6OpenGL"))
        or(containsHowOften(deploymentInfo.deployedLibraries, "libQt5Gui"))
        or(containsHowOften(deploymentInfo.deployedLibraries, "libQt6Gui"))
        or(containsHowOften(deploymentInfo.deployedLibraries, "libQt5XcbQpa"))
        or(containsHowOften(deploymentInfo.deployedLibraries, "libQt6XcbQpa"))
        or(containsHowOften(deploymentInfo.deployedLibraries, "libxcb-glx")))

    //2
    if (containsHowOften(deploymentInfo.deployedLibraries, "libQt5Svg")
        || containsHowOften(deploymentInfo.deployedLibraries, "libQt6Svg")) {
        pluginList.append(QStringLiteral("iconengines/libqsvgicon.so"));
    }
    if (containsHowOften(deploymentInfo.deployedLibraries, "libQt5Network")) {
        appendPluginToList(pluginSourcePath, "bearer", pluginList);
    }
    if (containsHowOften(deploymentInfo.deployedLibraries, "libQt6Network")) {
        appendPluginToList(pluginSourcePath, "networkaccess", pluginList);
        appendPluginToList(pluginSourcePath, "networkinformation", pluginList);
        appendPluginToList(pluginSourcePath, "tls", pluginList);
    }
    // Sql plugins if QtSql library is in use
    if (containsHowOften(deploymentInfo.deployedLibraries, "libQt5Sql")
        || containsHowOften(deploymentInfo.deployedLibraries, "libQt6Sql")) {
        appendPluginToList(pluginSourcePath, "sqldrivers", pluginList);
    }
    // Multimedia plugins if QtMultimedia library is in use
    if (containsHowOften(deploymentInfo.deployedLibraries, "libQt5Multimedia")
        || containsHowOften(deploymentInfo.deployedLibraries, "libQt6Multimedia")) {
        appendPluginToList(pluginSourcePath, "audio", pluginList);
        appendPluginToList(pluginSourcePath, "mediaservice", pluginList);

        // This plugin is specific to Qt 6
        if (containsHowOften(deploymentInfo.deployedLibraries, "libQt6Multimedia")) {
            appendPluginToList(pluginSourcePath, "playlistformats", pluginList);
        }
    }
    // 3D plugins if Qt3D library is in use
    if (containsHowOften(deploymentInfo.deployedLibraries, "libQt63DRender")) {
        appendPluginToList(pluginSourcePath, "geometryloaders", pluginList);
        appendPluginToList(pluginSourcePath, "renderers", pluginList);
        appendPluginToList(pluginSourcePath, "renderplugins", pluginList);
        appendPluginToList(pluginSourcePath, "sceneparsers", pluginList);
    }
    // Sensors plugins if QtSensors library is in use
    if (containsHowOften(deploymentInfo.deployedLibraries, "libQt6Sensors")) {
        appendPluginToList(pluginSourcePath, "sensorgestures", pluginList);
        appendPluginToList(pluginSourcePath, "sensors", pluginList);
    }
    // CAN bus plugin if QtSerialBus library is in use
    if (containsHowOften(deploymentInfo.deployedLibraries, "libQt6SerialBus")) {
        appendPluginToList(pluginSourcePath, "canbus", pluginList);
    }

    // Text to speech plugins if QtTextToSpeech library is in use
    if (containsHowOften(deploymentInfo.deployedLibraries, "libQt6TextToSpeech")) {
        appendPluginToList(pluginSourcePath, "texttospeech", pluginList);
    }

    // Location plugins if QtLocation library is in use
    if (containsHowOften(deploymentInfo.deployedLibraries, "libQt6Location")) {
        appendPluginToList(pluginSourcePath, "geoservices", pluginList);
    }

    // Qt Quick plugins if QtQuick* libraries are in use
    if (containsHowOften(deploymentInfo.deployedLibraries, "libQt6Quick")) {
        appendPluginToList(pluginSourcePath, "qmltooling", pluginList);
        appendPluginToList(pluginSourcePath, "scenegraph", pluginList);
    }

    // Qt declarative plugins if QtDeclarative library is in use
    if (containsHowOften(deploymentInfo.deployedLibraries, "Qt6Declarative")) {
        appendPluginToList(pluginSourcePath, "qml1tooling", pluginList);
    }

    // Gamepad plugins if QtGamepad library is in use
    if (containsHowOften(deploymentInfo.deployedLibraries, "libQt6Gamepad")) {
        appendPluginToList(pluginSourcePath, "gamepads", pluginList);
    }

    // Web view plugins if QtWebView library is in use
    if (containsHowOften(deploymentInfo.deployedLibraries, "libQt6WebView")) {
        appendPluginToList(pluginSourcePath, "webview", pluginList);
    }

 
    QString sourcePath;
    QString destinationPath;

    // Qt WebEngine if libQt5WebEngineCore is in use
    // https://doc-snapshots.qt.io/qt5-5.7/qtwebengine-deploying.html
    // TODO: Rather than hardcode the source paths, somehow get them dynamically
    // from the Qt instance that is to be bundled (pull requests welcome!)
    // especially since stuff that is supposed to come from resources actually
    // seems to come in libexec in the upstream Qt binary distribution
    if (containsHowOften(deploymentInfo.deployedLibraries, "libQt5WebEngineCore")) {
        // Find directories with needed files:
        QString qtLibexecPath = qtToBeBundledInfo.value("QT_INSTALL_LIBEXECS");
        QString qtDataPath = qtToBeBundledInfo.value("QT_INSTALL_DATA");
        QString qtTranslationsPath = qtToBeBundledInfo.value("QT_INSTALL_TRANSLATIONS");
        // create destination directories:
        QString dstLibexec;
        QString dstResources;
        QString dstTranslations;
        if (fhsLikeMode){
            QFileInfo qfi(appDirInfo.binaryPath);
            QString qtTargetDir = qfi.absoluteDir().absolutePath() + "/../";
            dstLibexec = qtTargetDir + "/libexec";
            dstResources = qtTargetDir + "/resources";
            dstTranslations = qtTargetDir + "/translations";
        }
        else {
            dstLibexec = appDirInfo.path + "/libexec";
            dstResources = appDirInfo.path + "/resources";
            dstTranslations = appDirInfo.path + "/translations";
        }
        QDir().mkpath(dstLibexec);
        QDir().mkpath(dstResources);
        QDir().mkpath(dstTranslations);
        // WebEngine executable:
        sourcePath = QDir::cleanPath(qtLibexecPath + "/QtWebEngineProcess");
        destinationPath = QDir::cleanPath(dstLibexec + "/QtWebEngineProcess");
        copyFilePrintStatus(sourcePath, destinationPath);
        // put qt.conf file next to browser process so it can also make use of our local Qt resources
        createQtConfForQtWebEngineProcess(dstLibexec);
        // Resources:
        sourcePath = QDir::cleanPath(qtDataPath + "/resources/qtwebengine_resources.pak");
        destinationPath = QDir::cleanPath(dstResources + "/qtwebengine_resources.pak");
        copyFilePrintStatus(sourcePath, destinationPath);
        sourcePath = QDir::cleanPath(qtDataPath + "/resources/qtwebengine_devtools_resources.pak");
        destinationPath = QDir::cleanPath(dstResources + "/qtwebengine_devtools_resources.pak");
        copyFilePrintStatus(sourcePath, destinationPath);
        sourcePath = QDir::cleanPath(qtDataPath + "/resources/qtwebengine_resources_100p.pak");
        destinationPath = QDir::cleanPath(dstResources + "/qtwebengine_resources_100p.pak");
        copyFilePrintStatus(sourcePath, destinationPath);
        sourcePath = QDir::cleanPath(qtDataPath + "/resources/qtwebengine_resources_200p.pak");
        destinationPath = QDir::cleanPath(dstResources + "/qtwebengine_resources_200p.pak");
        copyFilePrintStatus(sourcePath, destinationPath);
        sourcePath = QDir::cleanPath(qtDataPath + "/resources/icudtl.dat");
        destinationPath = QDir::cleanPath(dstResources + "/icudtl.dat");
        copyFilePrintStatus(sourcePath, destinationPath);
        // Translations:
        sourcePath = QDir::cleanPath(qtTranslationsPath + "/qtwebengine_locales");
        destinationPath = QDir::cleanPath(dstTranslations + "/qtwebengine_locales");
        recursiveCopy(sourcePath, destinationPath);
    }

    if (!extraQtPlugins.isEmpty()) {
        LogNormal() << "Deploying extra plugins.";
        foreach(const QString &plugin, extraQtPlugins) {
            QDir pluginDirectory(pluginSourcePath + "/" + plugin);
            if (pluginDirectory.exists()) {
                //If it is a plugin directory we will deploy the entire directory
                QStringList plugins = pluginDirectory.entryList(QStringList() << QStringLiteral("*.so"));
                foreach(const QString &pluginFile, plugins) {
                    pluginList.append(plugin + "/" + pluginFile);
                    LogDebug() << plugin + "/" + pluginFile << "appended";
                }
            }
            else {
                //If it isn't a directory we asume it is an explicit plugin and we will try to deploy that
                if (!pluginList.contains(plugin)) {
                    if (QFile::exists(pluginSourcePath + "/" + plugin)) {
                        pluginList.append(plugin);
                        LogDebug() << plugin << "appended";
                    }
                    else {
                        LogWarning() << "The plugin" << pluginSourcePath + "/" + plugin << "could not be found. Please check spelling and try again!";
                    }
                }
                else {
                    LogDebug() << "The plugin" << plugin << "was already deployed.";
                }
            }
        }
    }
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

季截

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值