Requesting some feedback for my Dub module for Meson

Filipe Laíns filipe.lains at gmail.com
Fri May 25 20:57:53 UTC 2018


Hi, I am writing regarding my Dub module for Meson.
I wanted to check with the D community before my changes get 
merged.

The module allows you to use dependencies provided by Dub in 
Meson. It also allows you to automatically generate/update a 
dub.json file for your Meson project.

Due Meson's policies, we can't download or build anything using 
an external tool (Dub, in this case). My module only uses Dub as 
a dependency resolver, kinda like pkgconfig. You will need to 
build the dependencies before running meson.

Something to be aware when interfacing Dub and Meson is the 
compiler. The libraries that we are linking should be built with 
the same compiler Meson is using. This can be achieved as follows.

dub fetch vibe-d
dub build vibe-d compiler=ldc2
DC="ldc2" meson builddir

You can then use Dub to resolve the dependency as follows.

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

You can generate/update a dub.json file for your project as 
follows.

dub = import('dub')
dub.generate_dub_file(meson.project_name().to_lower(), 
meson.source_root(),
   authors: 'Filipe Laíns',
   description: 'Test executable',
   copyright: 'Copyright © 2018, Filipe Laíns',
   license: 'MIT',
   sourceFiles: 'test.d',
   targetType: 'executable',
   dependencies: vibed_dep
)

The only required arguments for generate_dub_file() are the 
project name and the dub.json folder path.
All the other arguments can be passed as dictionaries.

key: 'value'

Currently, the module ignores configurations, subConfigurations, 
and buildTypes because that would require unnecessary additional 
code. You can configure that directly in dub.json. If you do 
manually change dub.json, the configurations should be kept 
unless you overwrite them in the meson config.

If you want to check the changes, you can take a look at the PR.
https://github.com/mesonbuild/meson/pull/3592

The questions I have to ask are:
   - Does this fit your needs?
   - Is there something I missed?
   - Would you like me to add other features?

Thank you,
Filipe Laíns (FFY00)
3DCE 51D6 0930 EBA4 7858 BA41 46F6 33CB B0EB 4BF2


More information about the Digitalmars-d mailing list