Qbs 构建配置

Projects >Build & Run >Build >Build Settings 中指定所选工具包的构建设置。

Qbs 构建设置

Qbs 会在Build Directory 字段指定的目录中构建项目。

Tooltip in target selector 字段中,您可以输入文本,当您将鼠标悬停在工具包选择器中的构建配置上时,该文本将显示为工具提示。

您可以在Configuration name 字段中输入构建配置的名称。

如果正在生成调试信息,可以在Separate debug info 字段中选择Enable ,将其放置到单独的文件中,而不是嵌入到二进制文件中。有关详细信息,请参阅分析 CPU 使用情况。要使用默认设置,请选择Leave at Default

有关 QML 调试选项的更多信息,请参阅设置 QML 调试

有关配置 Qbs 的更多信息,请参阅首选项:Qbs

Qbs 生成步骤

Qbs 构建步骤

为 Qbs 指定构建步骤:

  1. Build variant 字段中,选择
    • Debug 以在构建中包含调试符号,用于调试程序。
    • Profile 用于优化的发布版构建,会提供单独的调试信息。它最适合分析应用程序。
    • Release 创建最终安装二进制包。
  2. ABIs 字段中,选择要构建项目的Android设备架构的 ABI。
  3. Parallel jobs 字段中,指定用于构建的并行作业数量。
  4. Properties 字段中,指定要传递给项目的属性。使用冒号(:)分隔键和值。有关详细信息,请参阅《Qbs 手册》中的模块
  5. Flags 字段中,选择 :
    • Keep going 在可能的情况下,当出现错误时继续编译。
    • Show command lines编译输出(Compile Output)中打印实际命令行,而不是高级描述。
    • Force probes 强制重新执行探针的配置脚本。
  6. Installation flags 字段:
    • 选择Install ,以便在构建后将工件复制到其安装位置。该选项默认为启用。

      注意: 在 Windows 上,如果应用程序正在运行,则构建将失败,因为可执行文件无法覆盖。为避免此问题,可清除此复选框,并在运行设置中添加Qbs Install 部署步骤,该步骤将在运行应用程序之前执行。

    • 选择Clean install root 可在构建开始前删除安装根目录的内容。
    • 选择Use default location 可将工件安装到默认位置。清除复选框,以便在Installation directory 字段中指定其他位置。

Equivalent command line 字段显示根据所选选项构建的构建命令。

Qbs 清理步骤

使用 Qbs 构建时,可以在Clean Steps 中指定标记:

Qbs 清洁步骤

  • 选择Dry run 测试清理,而不执行命令或对构建图进行永久更改。
  • 如果可能,选择Keep going 可在发生错误时继续清理。

Equivalent command line 字段显示根据所选选项构建的清理命令。

另请参阅 " 构建系统":Qbs首选项:Qbs

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.