Homepage:
https://github.com/mesonbuild/meson
Dependencies
Python (version 3.6 or newer)
Ninja (version 1.8.2 or newer)
python --version
Python 2.7.18
python3 --version
Python 3.8.5
Ninja:
sudo apt-get install -y ninja-build
or
python3 -m pip install ninja
ninja --version
1.10.0
Install
python3 -m pip install meson
meson --version
0.56.0
As root (for DPDK):
sudo su
pip3 install meson
which meson
/usr/local/bin/meson
Setup
hello
: Autosetup (create and build sample C code)
mkdir hello && cd hello && meson init --name hello --build
./build/hello
This is project hello.
hello2
: Manual setup
Existing files: meson-hello2.build
, hello2.c
meson-hello2.build
----------------------------------------
project('hello2', 'c',
version : '0.1',
default_options : ['warning_level=3'])
exe = executable('hello2', 'hello2.c',
install : true)
test('basic', exe)
----------------------------------------
hello2.c
----------------------------------------
#include <stdio.h>
int main(int argc, char *argv[])
{
(void)argc; (void)argv;
printf("Hello, world 2.0!\n");
return 0;
}
----------------------------------------
Setup:
mkdir -p hello2
cp hello2.c hello2/
cp meson-hello2.build hello2/meson.build
cd hello2
meson setup build
cd build/
ninja
./hello2
Hello, world 2.0!
Test:
ninja test
Using scripts
./setup-hello.sh
./setup-hello2.sh