vala

Meson

Introduction#

Meson is a next-generation build system designed with simplicity and explicitness in mind.

Basic project

project('Vala Project')

glib_dep = dependency('glib-2.0')
gobject_dep = dependency('gobject-2.0')

executable('foo', 'foo.vala', dependencies: [glib_dep, gobject_dep])

Note: both glib-2.0 and gobject-2.0 dependencies are required unless --nostdpkg is explicitly given.

Posix-based project (no GLib or GObject)

project('Posix-based Project', 'vala')

add_project_arguments(['--nostdpkg'], language: 'vala')

posix_dep = meson.get_compiler('vala').find_library('posix')

executable('foo', 'foo.vala', dependencies: [posix_dep])

Mixed sources

project('Mixed sources Project', 'vala')

glib_dep = dependency('glib-2.0')
gobject_dep = dependency('gobject-2.0')

executable('foo', 'foo.vala', 'bar.c', dependencies: [glib_dep, gobject_dep])

In foo.vala:

namespace Foo {
    public extern int bar ();

    public int main (string[] args) {
        return bar ();
    }
}

In bar.c:

int 
bar () 
{
    return 0;
}

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow