Meson安装

2023-05-16

Meson出现的原因:

  C++需要一个仓库管理系统,用于管理依赖包。类似于Java里的Maven。Maven可以做什么呢?Maven是Java的项目构建工具+仓库管理工具。

  由此需求下,Cargo和Meson应运而生。它们相比之前的CMake来说,自然要更加的有用。它不仅仅支持C/C++,还支持多种语言。如今,很多项目都由CMake转向到了Meson,例如DPDK和Mapnik。

收录时间2013-11-26

开发语言:Python

开发单位:Apache基金会

Meson使用:https://my.oschina.net/u/4349408/blog/3295014

ninja:一个简单的构建方式:https://my.oschina.net/u/4292686/blog/4708023

从CMake转Meson:https://www.bilibili.com/video/BV1D5411H7F5

Meson跨平台吗?https://www.ctolib.com/meson.html 

Meson® is a project to create the best possible next-generation build system.

Status:

Dependencies

  • Python (version 3.5 or newer)
  • Ninja (version 1.7 or newer)

Installing from source

Meson is available on PyPi, so it can be installed with pip3 install meson. The exact command to type to install with pip can vary between systems, be sure to use the Python 3 version of pip.

If you wish you can install it locally with the standard Python command:

python3 -m pip install meson

For builds using Ninja, Ninja can be downloaded directly from Ninja GitHub release page or via PyPi

python3 -m pip install ninja

More on Installing Meson build can be found at the getting meson page.

Running

Meson requires that you have a source directory and a build directory and that these two are different. In your source root must exist a file called meson.build. To generate the build system run this command:

meson setup <source directory> <build directory>

Depending on how you obtained Meson the command might also be called meson.py instead of plain meson. In the rest of this document we are going to use the latter form.

You can omit either of the two directories, and Meson will substitute the current directory and autodetect what you mean. This allows you to do things like this:

cd <source root>
meson setup builddir

To compile, cd into your build directory and type ninja. To run unit tests, type ninja test.

More on running Meson build system commands can be found at the running meson page or by typing meson --help.

Contributing

We love code contributions. See the contribution page on the website for details.

IRC

The irc channel for Meson is #mesonbuild over at Freenode.

You can use FreeNode's official webchat to connect to this channel.

Further info

More information about the Meson build system can be found at the project's home page.

Meson is a registered trademark of Jussi Pakkanen.

GitHub:https://github.com/mesonbuild/meson

官网:https://mesonbuild.com/

The Absolute Beginner's Guide to Installing and Using Meson

This page is meant for people who are new to using Meson and possibly even to compiling C and/or C++ code in general. It is meant to contain one simple way of getting your build environment up and running. If you are more experienced and have your own preferred way of installing and using development software, feel free to use that instead. This guide only deals with Linux, Windows and macOS platforms. If you use some other platform, such as one of the BSDs, you probably already know how to install development tools on it (probably better than we do, even).

There are three phases to getting a development environment running.

  1. Installing a compiler toolchain
  2. Installing Meson
  3. Creating a project and building it

1. Installing a compiler toolchain安装编译器工具链

Linux

All Linux distributions provide easy access to development tools. Typically you need to open a terminal and execute one command, which depends on your distro.

  • Debian, Ubuntu and derivatives: sudo apt install build-essential
  • Fedora, Centos, RHEL and derivatives: sudo dnf install gcc-c++
  • Arch: sudo pacman -S gcc

Windows

The most common development toolchain on Windows is Visual Studio, which can be downloaded from the Visual Studio web site. Select the Community version unless you have bought a license.

Download page of Visual Studio

Download the installer and run it. When you are given a list of things to install, select Desktop development with C++. This installs both a C and a C++ compiler.

Installing the Visual Studio compilers

Once the installer finishes the compiler toolchain is ready to use.

macOS

On macOS the development toolchain must be installed via the Mac app store. Search for an app called XCode and install it.

App store page for XCode

Note: Installing XCode is not sufficient by itself. You also need to start XCode' GUI application once. This will make XCode download and install more files that are needed for compilation.

2. Installing Meson

Linux

Installing Meson is just as simple as installing the compiler toolchain.

  • Debian, Ubuntu and derivatives: sudo apt install meson ninja-build
  • Fedora, Centos, RHEL and derivatives: sudo dnf install meson ninja-build
  • Arch: sudo pacman -S meson

Windows

Meson provides a standard Windows .msi installer that can be downloaded from the Releases page.

Meson installed download

Download and run it to install all the necessary bits. You can verify that your installation is working by running the Visual Studio developer tools command prompt that can be found in the start menu.

Devtool prompt

You should be able to run both meson and ninja and query their versions.

A working Windows install

macOS

Due to the way Apple has set things up, getting macOS working is a bit more complicated. The first thing you need to do is to install the newest version of Python 3 from the project's web site.

Downloading the Python for macOS installer

Once you have a working Python you can install the necessary bits using Python's Pip package manager.

pip install --user meson ninja

This will install the necessary files in your home directory, but sadly they are not directly usable. You need to add the directory they are written to in the system's PATH environment variable so the programs can be used directly from the terminal. This requires editing a text configuration file.

The correct file to edit depends on which shell you are currently using. If you have an old macOS install it is probably Bash and the file you need to edit is .bash_profile. If, on the other hand, you have a new macOS install then you are probably using Zsh and the file to edit is .zshrc. In either case the file should be in your home directory.

For Bash the line you need to add is this:

PATH=$PATH:/Users/username/Library/Python/3.9/bin

whereas for Zsh it is this:

export PATH=$PATH:/Users/username/Library/Python/3.9/bin

In both case you need to change the values for username and 3.9. The former needs to be substituted with your Unix username while the latter needs to contain the actual Python version you installed.

Once this is done close the terminal application and start it again. Now you should be able to run the meson command.

A working macOS install

3. Running Meson

Start a terminal application. On Windows you have to use the Visual Studio Developer Tools Command Prompt as discussed above, because the compilers are only available in that terminal. You also need to change into your home directory (Linux and macOS terminals start in the home directory by default).

cd \users\username

Create a new directory to hold your project.

mkdir testproject
cd testproject

Use Meson to create and build a new sample project.

meson init --name testproject --build

This will create a project skeleton for you and compile it. The result is put in the build subdirectory and can be run directly from there.

build/testproject

All finished and ready to go

The project is now ready for development. You can edit the code with any editor and it is rebuilt by going in the build subdirectory and executing the meson compile command. If your version of Meson is too old, you can compile the project by running the command ninja instead.

https://mesonbuild.com/SimpleStart.html

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Meson安装 的相关文章

  • Maven的安装、配置以及在Eclipse中安装maven插件

    一 需要准备的东西 xff08 原文链接 xff09 1 首先确保安装了JDK xff0c 并且成功配置了JDK的环境变量 2 已安装Eclipse 3 Maven程序包 二 maven下载与安装 1 前往https maven apach
  • ros多机通信配置

    ros多机通信配置 xff0c 以两台计算机为例 xff0c 主机hostname为master从机hostname为slaver 1 在主机和从机 etc hosts内添加ip和hostname 例如两台计算机ip和hostname分别为
  • RS422接线方法

  • ORB-SLAM2的编译运行以及TUM数据集测试

    近段时间一直在学习高翔博士的 视觉SLAM十四讲 xff0c 学了以后发现自己欠缺的东西实在太多 xff0c 好多都需要深入系统的学习 ORB SLAM2是一套完整的SLAM方案 xff0c 提供了单目 xff0c 双目和RGB D三种接口
  • 【VINS论文翻译】VINS-Mono: A Robust and Versatile Monocular Visual-Inertial State Estimator

    回到目录 写在前面 港科大的VINS Mono作为目前state of the art的开源VIO项目 xff0c 是研究视觉与IMU紧耦合的必读算法 xff0c 网上的论文解读与代码实现也非常丰富 xff08 感谢 xff01 xff09
  • 视觉SLAM十四讲(第二版)章节总结+课后习题分析

    感谢博主nullwh 的分享 xff0c 原文链接 视觉SLAM十四讲 视觉SLAM十四讲 第二版 笔记及课后习题 xff08 第一讲 xff09 视觉SLAM十四讲 第二版 笔记及课后习题 xff08 第二讲 xff09 视觉SLAM十四
  • FFMPEG 编解码失败 non-existing PPS 0 referenced

    最近在尝试用ffmpeg进行编解码 大部分的rtsp拉流正常 编解码正常 但是有的rtsp不能解码 提示如下 xff1a 后来把把packet数据打印出来发现是没有sps pps信息 导致 ffmpeg不能正常解码 程序里面 经过测试 把
  • ROS主从机配置

    目标 xff1a 小车上运行SLAM算法 xff0c 在PC上使用rviz可视化观察 第一步 xff1a 分别在两台机器上使用 hostname 指令查看用户名 ifconfig 指令查看ip地址 wlp3s0是我的pc的无线网卡 xff0
  • Docker入门指南

    https yeasy gitbook io docker practice
  • STL迭代器模版详解

    1 STL iterator迭代器 STL xff08 Standard Template Library xff0c 标准模板库 是惠普实验室开发的一系列软件的统称 它是由Alexander Stepanov Meng Lee和David
  • 4种YOLO目标检测的C++和Python两种版本实现

    本文原创首发于极市平台公众号 xff0c 如需转载请私信作者 2020年 xff0c 新出了几个新版本的YOLO目标检测 xff0c 在微信朋友圈里转发的最多的有YOLOv4 xff0c Yolo Fastest xff0c YOLObil
  • Activity的任务栈Task以及启动模式与Intent的Flag详解

    什么是任务栈 Task 官方文档是这么解释的 任务是指在执行特定作业时与用户交互的一系列 Activity 这些 Activity 按照各自的打开顺序排列在堆栈 xff08 即 返回栈 xff09 中 其实就是以栈的结构 先进后出 将依次打
  • 什么是标记化?令牌?

    什么是标记化 xff1f 标记化就是 xff1a 将敏感数据元素 xff08 例如银行帐号 xff09 替换为非敏感替代项 xff08 称为令牌 xff09 令牌是一个随机数据字符串 xff0c 没有基本或可利用的值或含义 它是一个唯一的标
  • 如何使用c语言解析httppost请求

    头文件 ifndef UPLOAD define UPLOAD include 34 fastcgi fcgiapp h 34 include 34 sysinc h 34 ifdef WIN32 def GRCALL the callin
  • STM32F103ZET6单片机双串口互发程序设计与实现

    STM32库函数开发系列文章目录 第一篇 xff1a STM32F103ZET6单片机双串口互发程序设计与实现 文章目录 STM32库函数开发系列文章目录前言一 STM32F103ZET6单片机双串口互发程序设计与实现是什么 xff1f 二
  • STL的一些常见应用场景

    set 集合 去除重复元素并从小到大排序 平衡二叉树 xff08 红黑树 xff09 维护 span class token comment 华为机试 gt HJ3 span span class token macro property

随机推荐

  • Pixhawk原生固件Linux环境下编译

    Pixhawk原生固件在Linux下编译的资料网上很多 xff0c 官网 http dev px4 io starting installing linux html 也有其具体流程 xff0c 本文只是针对自己从安装ubuntu14 04
  • GNGGA 解析北斗数据获得经纬度 以及数据NMEA数据转换

    char GPS1 61 34 GNGGA 121252 000 3937 3032 N 11611 6046 E 1 05 2 0 45 9 M 5 7 M 0000 77 34 int Parse GPS char data char
  • C++ math.h函数

    include int abs int num double fabs double arg long labs long num 函数返回num的绝对值 include double acos double arg 函数返回arg的反余弦
  • 动态ip原理

    所谓动态是指每次上网时 xff0c 运营商会随机从池子中分配一个IP地址 xff0c 动态ip池子因不同服务机构质量有所不同 xff0c 透明一般是在免费代理中出现 xff0c 而不同透明度还是有相应区分 代理IP的匿名度 xff1a 匿名
  • 自建隧道代理

    隧道代理可自动变更 xff0c 免去频繁更换代理的麻烦 xff0c 仅需一次性配置一个代理IP xff0c 其它变IP工作由隧道自动完成 假设你从免费代理手上拿到一些池子 xff0c 当然你也可以用爬虫程序自己爬找出后测试筛选可用的 xff
  • socks5代理怎么用?如何使用?

    SOCKS5代理不会重写数据包的标头 xff0c 并结合了TCP和UDP协议 Sock5代理服务器是把你的网络数据请求通过一条连接你和代理服务器之间的通道 xff0c 由服务器转发到目的地 Proxifier是一款功能非常强大的socks5
  • Python代理ip代码示例

    隧道代理和其他代理ip也有共同点优势比路由器更容易配置 xff0c 可以在工作过程中生成各种记录 xff0c 工作在应用层 xff0c 可以对各种数据进行检查 xff0c 按照一定的准则 xff0c 生成各种日志 记录 除此之外 xff0c
  • python 爬虫SSL错误是怎么回事?

    今天摸鱼 xff08 划掉 xff09 看道一个问题蛮有意思的 xff0c 想来展开说说 xff1a 别急 xff0c 解决办法是有的 1 这个错误很可能是因为你正在尝试读取一个 JSON 格式的响应 xff0c 但是实际返回的却是 HTM
  • python写的爬虫,抓取百度的搜索结果,被屏蔽了怎么办?

    某乎上有个热门话题 xff0c 引起了很大的讨论 这个问题通常是由于频繁的请求导致百度的反爬虫机制触发了验证码的保护机制 解决办法无非是那几套流程走一遍 1 增加请求的时间间隔 通过在每个请求之间增加一些时间间隔 xff0c 可以降低请求频
  • HTTP代理挑选最强攻略

    最近上班合理上网的时候 xff0c 在某乎上刷到一个话题 xff0c 本来这个话题我也经常刷到没打算看 xff0c 本着看新动态的心思 xff0c 点进来一看 xff0c 好家伙 xff0c 这话题底下除了各大HTTP代理服务商 xff0c
  • 电设飞控从零学起(一) 基础篇 无人机硬件与结构设计简介

    1 常见无人机的分类 xff08 1 xff09 固定翼 xff1a 续航时间长 xff0c 载荷最大 xff0c 但必须助跑 滑行 xff08 2 xff09 直升机 xff1a 可垂直起降 xff0c 但机械结构复杂 维护成本高 xff
  • ROS编程 csv文件读取/输出 与 YAML文件生成

    前言 代码是抄的 感想是真的 cpp的文件操作对比起python来说是比较繁复的 而每次学习cpp的时候都会去刻意留文件操作的教程 其实直接做一次实验就可以理解了 下面的代码是抄回来 xff0c 分别是做手眼标定与力传感器标定过程中需要将采
  • Android 引入FFmpeg 读取RTSP流 解封装获取H264原始数据

    之前 写了Android中怎么引入FFMmpeg的例子 本编文章将会写一个简单的demo实现ffmpeg拉去rtsp流并在界面中打印前五个字节 懒得往下细看的可以点击这里下载工程 基于andorid studio 实际效果下图 xff1a
  • 单片机: 自定义串口通信协议的实现

    使用51单片机完成一个简单的串口通信协议 要求 xff1a 一个协议帧为8个字节 xff0c 其中头部两个字节 xff0c 分别是0xFF 0xFE 第3个字节代表第一个数据 xff0c 第4个字节代表第二个数据 xff08 均为正数 xf
  • ThreeJS和BabylonJS对比

    Threejs从2009年就问世了 xff0c 当时还是基于ActionScript的 xff0c 后来换成了JavaScript Babylon是2013年微软出品的 xff0c 有一部分代码基于TS写的 xff0c 即TypeScrip
  • dojo是什么?

    现在Web端vue React Angular大行其道 xff0c 安卓端js也有React Native等 xff0c 那么学习dojo有什么意义呢 xff1f 有些老的项目还是用的dojo 例如arcgis javascript api
  • threejs导入json模型

    其实现在的json模型有两种格式 一个是Geometry类型 xff0c 需要JSONLoader加载 xff1b 一个是Object类型 xff0c 需要ObjectLoader加载 1 Geometry var js loader 61
  • three.js的x,y,z坐标轴

    three js中坐标系使用的是左手坐标系还是右手坐标系 xff1f 无论是左手坐标系 xff0c 还是右手坐标系 xff0c x和y轴方向是不变的 改变的只是z轴的方向 threejs和gis中的三维世界坐标系的联系 xff1a gis中
  • 云计算和GIS如何结合?

    GIS的发展离不开计算机技术的发展 每一次GIS的变革 xff0c 背后都是由于计算机技术的进步引起的 而这一次GIS的大变革 xff0c 背后正是云计算技术的愈加成熟 你是否有过这样的经历 xff0c GIS数据量太大 xff0c 加载太
  • Meson安装

    Meson出现的原因 xff1a C 43 43 需要一个仓库管理系统 xff0c 用于管理依赖包 类似于Java里的Maven Maven可以做什么呢 xff1f Maven是Java的项目构建工具 43 仓库管理工具 由此需求下 xff