简体   繁体   English

QBS 配置文件不会随时保存和更新

[英]QBS profiles are not saved and updated at any time

I have QtCreator on a PC running Windows and Ubuntu.我在运行 Windows 和 Ubuntu 的 PC 上安装了 QtCreator。 Ubuntu I use to build a project for Linux and for RaspberryPi. Ubuntu 我用来为 Linux 和 RaspberryPi 构建一个项目。 A Windows PC is used to build the project in x86, x86_64 and android: armv7a, arm64, x86 (for the emulator).使用 Windows PC 在 x86、x86_64 和 android 中构建项目:armv7a、arm64、x86(用于模拟器)。 Also windows is used to develop embedded software for stm32. windows也用于为stm32开发嵌入式软件。 Accordingly, I need 6 qbs profiles for windows and 3 profiles for linux.因此,我需要 6 个用于 Windows 的 qbs 配置文件和用于 linux 的 3 个配置文件。 The project itself uses QBS as a build system.该项目本身使用 QBS 作为构建系统。

The problem is that it is very difficult to determine which set is currently in use.问题是很难确定当前使用的是哪个集合。 Below I give the beginning of my qbs file, where I initialize the main variables.下面我给出了我的 qbs 文件的开头,在那里我初始化了主要变量。

import qbs

Project {

    property var _TargetEnum: ({
                                   win_x86      : 1,
                                   win_x86_64   : 2,
                                   raspberryPi  : 3,
                                   stm32        : 4,
                                   android      : 5, 
                                   linux        : 6, 
                               })

    property var Target
    Properties {
        condition: (qbs.targetPlatform === "windows")
        Target: (qbs.architecture === "x86") ? _TargetEnum.win_x86 : _TargetEnum.win_x86_64
    }
    Properties {
        condition: (qbs.targetPlatform === "RaspberryPi")
        Target: _TargetEnum.raspberryPi
    }
    Properties {
        condition: (qbs.targetPlatform === "stm32")
        Target: _TargetEnum.stm32
    }
    Properties {
        condition: (qbs.targetPlatform === "android")
        Target: _TargetEnum.android
    }
    Properties {
        condition: (qbs.targetPlatform === "linux")
        Target: _TargetEnum.linux
    }

    property var _BuildModeEnum: ({
                                  debug     : 1,
                                  release   : 2
                              })

    property var BuildMode: qbs.buildVariant.contains("debug") ?
                                 _BuildModeEnum.debug :
                                 _BuildModeEnum.release
...
}

QBS profiles created automatically do not have completely filled fields and I have to manually fill in these fields using the qbs-config-ui utility.自动创建的 QBS 配置文件没有完全填充的字段,我必须使用 qbs-config-ui 实​​用程序手动填充这些字段。 Moreover, the behavior of this utility and qtcreator is different in windows and linux.此外,此实用程序和 qtcreator 的行为在 windows 和 linux 中是不同的。

In windows, the following happens: after opening qtcreator, the old settings in Tools-Kit-Qbs remain from the last working session, after opening a working project, the settings are reset to the default state.在windows中,会发生以下情况:打开qtcreator后,Tools-Kit-Qbs中的旧设置保留上次工作会话,打开工作项目后,设置重置为默认状态。 Next, I open the qbs-config-ui utility and manually make changes to qbs.targetPlatform and qbs.architecture in the packages I need, I save the settings.接下来,我打开 qbs-config-ui 实​​用程序并手动更改我需要的包中的 qbs.targetPlatform 和 qbs.architecture,我保存设置。 In QtCreator, I open the settings window and see that my changes have been made.在 QtCreator 中,我打开设置窗口并看到我的更改已经完成。 Then I can work until the next working session.然后我可以工作到下一个工作会议。

In Linux, this behavior is generally absent, no regularities how the profile is updated in QtCreator and how it flies I have not yet been able to see.在 Linux 中,这种行为通常不存在,没有规律性如何在 QtCreator 中更新配置文件以及它如何运行我还没有看到。

My question is how do I properly configure QBS profiles once and for all so that I don't have to reconfigure them.我的问题是如何一劳永逸地正确配置 QBS 配置文件,以便我不必重新配置它们。

Do not try to attempt to amend qbs profiles derived from Qt Creator kits "from the outside" -- that will not work reliably, as you've discovered.不要试图“从外部”修改从 Qt Creator 工具包派生的 qbs 配置文件——正如您所发现的那样,这不会可靠地工作。 These profiles can get regenerated at any time.这些配置文件可以随时重新生成。 Instead, go to Tools -> Options -> Kits and do your changes via the "Additional Qbs Properties" entry in the kit dialog.相反,转到工具 -> 选项 -> 套件并通过套件对话框中的“附加 Qbs 属性”条目进行更改。 These changes will persist.这些变化将持续存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM