Dub support was added to Meson

Filipe Laíns lains at archlinux.org
Sat Aug 4 16:07:45 UTC 2018


Hello,

Dub support was finally merged to the Meson's upstream.
For the ones that don't know, Meson[1] is a fast build system 
that uses ninja[2] as a backend. Until now it was impossible to 
use dependencies via the Dub and many many packages only 
supported Dub. Now you can import dependencies that already exist 
in Dub's local repo. You still need to fetch and build them 
though.

First, you need to fetch and build the dependency.

   dub fetch vibe-d
   dub build vibe-d

Then you just need to specify Dub as the dependency method.

   vibed_dep = dependency('vibe-d', method: 'dub')

Together with this, a 'dlang' module was also merged. You can use 
it to automatically generate a dub.json file.

Here's an example.

   dlang = import('dlang') # Import the module
   # dlang.generate_dub_file(project-name, 
path/to/where/to/install/the/dub/file,
   #                         arguments... )
   dlang.generate_dub_file(meson.project_name().to_lower(), 
meson.source_root(),
                           authors: 'Foo',
                           description: 'Bar',
                           copyright: 'Copyright © 2018, Foo',
                           license: 'MIT',
                           sourceFiles: 'foobar.d',
                           targetType: 'executable',
                           dependencies: vibed_dep
   )

If you have any issue with this, contact me at 
lains at archlinux.org.

Thank you,
Filipe Laíns

[1] https://github.com/mesonbuild/meson
[2] https://github.com/ninja-build/ninja



More information about the Digitalmars-d-announce mailing list