Meson

Meson是一个开源的多平台构建系统生成器,使用 Ninja 作为主要后台。构建定义位于meson.build 文件中,而构建选项位于meson_options.txt 中。

注意: Meson 构建中的许多可用功能或通常可从Qt Creator 获取的功能缺失。

Qt Creator PATH您可以添加其他 Meson 可执行文件的路径,并在不同的构建和运行工具包中使用它们。

注意: 启用 Meson 插件才能使用。

添加 Meson 工具

Qt Creator 对 Meson 联编包的版本没有严格要求,任何 0.49.0 以上的版本都应兼容。

指定 Meson 可执行文件的路径:

  1. 选择 "首选项" >Meson >Tools >Add

    介子偏好设置中的 "工具 "选项卡

  2. Name 字段中,指定工具名称。
  3. Path 字段中,指定 Meson 可执行文件的路径。
  4. 选择Apply 保存更改。

选择首选项>Kits >Kits 选项卡,将 Meson 工具添加到构建和运行工具包中:

在 "工具包 "偏好设置的 "工具包 "选项卡中设置 Meson 可执行程序

更多信息,请参阅工具包

编辑 Meson 构建说明

要打开 meson.build 文件进行编辑,请在项目树中双击该文件。现在只有纯文本编辑器可用。

代码完成和外部库

通过外部库,Qt Creator 可以支持代码自动补全和语法高亮,就好像它们是当前项目或 Qt 库的一部分。

Qt Creator 通过 Meson 自省数据中的编译标志处理代码自动补全。使用 添加的或在 include path 中找到的任何外部库都会被 知晓,以便完成代码。dependency() Qt Creator

一旦项目配置成功,语法补全和高亮显示就会发挥作用。

当前 Meson 支持限制

暂不支持以下功能:

  • 在项目树中显示头文件。
  • 配置变更检测,例如在构建时首先触发 Meson 配置。
  • 来自定位器的操作,如搜索或触发构建。
  • Qt Creator 向 Meson 项目添加文件。

另请参阅 启用和禁用插件打开项目Meson 构建配置指定运行设置

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.