The Meson Build System http://mesonbuild.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1.6 KiB

Dlang module

This module provides tools related to the D programming language.

Usage

To use this module, just do: dlang = import('dlang'). You can, of course, replace the name dlang with anything else.

The module only exposes one funtion, generate_dub_file, used to automatically generate Dub configuration files.

generate_dub_file()

This method only has two required arguments, the project name and the source folder. You can pass other arguments with additional keywords, they will be automatically translated to json and added to the dub.json file.

Structure

generate_dub_file("project name", "source/folder", key: "value" ...)

Example

dlang = import('dlang')
dlang.generate_dub_file(meson.project_name().to_lower(), meson.source_root(),
                        authors: 'Meson Team',
                        description: 'Test executable',
                        copyright: 'Copyright © 2018, Meson Team',
                        license: 'MIT',
                        sourceFiles: 'test.d',
                        targetType: 'executable',
                        dependencies: my_dep
)

You can manually edit a meson generated dub.json file or provide a initial one. The module will only update the values specified in generate_dub_file().

Although not required, you will need to have a description and license if you want to publish the package in the D package registry.

Other thing to keep in mind is that currently, the module ignores configurations, subConfigurations, and buildTypes. You can configure that directly in dub.json.