Search notes:

Meson

The Meson languages is strongly typed and not turing complete.

The humble beginning

The following simple example was copy-pased from https://mesonbuild.com/Tutorial.html. It compiles just one c source unit to produce an executable.

main.c

The c source is:
#include<stdio.h>

int main(int argc, char **argv) {
  printf("Hello there.\n");
  return 0;
}
Github repository about-meson, path: /The-humble-beginning/main.c

meson.build

meson.build is the file which describes the relationships between source files and buildable objects.
project('tutorial', 'c')
executable('demo', 'main.c')

Building

In the directory where meson.build is located, the meson compiler(?) needs to be invoked:
$ meson builddir
This command creates the directory builddir in which ninja is used to compile the project:
$ cd builddir
$ ninja
$ ./demo

Nice features

Meson seems to have a few nice features. The following meson.build script determines the version of the c compiler and issues a message if it is smaller than 7.0.0:
project('nice-features', 'c')

c=meson.get_compiler('c')

c_version = c.version()

message('compiler version ' + c_version)

if c_version.version_compare('< 7.0.0')
   message('Please upgrade to at least 7.0.0')
endif
Github repository about-meson, path: /nice-features/meson.build

See also

Creating a shared and static library with the Meson build system
build systems

Index