跳转至

meson

  • https://mesonbuild.com/Tutorial.html
meson 是一个类似 CMake 的构建工具。meson语法很像其它高级语言,许多灵感来自 Python 编程语言,支持不同类型的变量(字符串、数值、数值、字典...类型),方法。

1 安装

  • 方法一:dnf install meson
  • 方法二:pip install meson

2 使用

2.1 命令行

  • https://mesonbuild.com/Commands.html 简单示例:
  • meson setup builddir :配置项目,生成的配置文件放在 builddir 目录下
  • cd builddir&&meson compile :在 builddir 目录下编译,默认是使用 ninja 编译
  • meson install :

主要命令如下: - setup:Configure the project - configure:Change project options - dist:Generate release archive - install:Install the project - introspect:Introspect project - init:Create a new project - test:Run tests - wrap :Wrap tools - subprojects:Manage subprojects - rewrite:Modify the project definition - compile:Build the project - devenv:Run commands in developer environment - env2mfile:Convert current environment to a crosor native file - help:Print help of a subcommand

2.2 meson setup

  • 功能:用于生成 build 所需要的文件,比如 build.ninja 文件

2.3 meson compile

  • 功能:用于编译项目,会根据 meson setup 生成的文件,选择编译工具,如使用 ninja 命令构建出库或可执行程序。