diff options
-rw-r--r-- | docs/markdown/D.md | 5 | ||||
-rw-r--r-- | docs/markdown/Dependencies.md | 19 | ||||
-rw-r--r-- | docs/markdown/Dlang-module.md | 41 | ||||
-rw-r--r-- | docs/sitemap.txt | 1 |
4 files changed, 66 insertions, 0 deletions
diff --git a/docs/markdown/D.md b/docs/markdown/D.md index 7b0d485..0956166 100644 --- a/docs/markdown/D.md +++ b/docs/markdown/D.md @@ -87,3 +87,8 @@ executable('myapp', myapp_src, dependencies: [mylib_dep]) Please keep in mind that the library and executable would both need to be built with the exact same D compiler and D compiler version. The D ABI is not stable across compilers and their versions, and mixing compilers will lead to problems. + +# Integrating with DUB + +DUB is a fully integrated build system for D, but it is also a way to provide dependencies. Adding dependencies from the [D package registry](https://code.dlang.org/) is pretty straight forward. +You can find how to do this in [Dependencies](Dependencies.md#Dub). You can also automatically generate a `dub.json` file as explained in [Dlang](Dlang-module.md#generatedubfile). diff --git a/docs/markdown/Dependencies.md b/docs/markdown/Dependencies.md index 3e4e5ad..0a9b5a8 100644 --- a/docs/markdown/Dependencies.md +++ b/docs/markdown/Dependencies.md @@ -186,6 +186,25 @@ have been compiled for single-threaded use instead. `method` may be `auto`, `config-tool`, `pkg-config` or `extraframework`. +## Dub + +Use `method` to find dependencies with Dub. Just create a dependency as you would normally, but add `dub` as the dependency method. +```meson +urld_dep = dependency('urld', method: 'dub') +``` +If the dependency is not resolved using Dub, meson will still try to find it with Pkg-Config. + +Please understand that meson is only able to find existing dependencies. You still need to manually fetch and build them with Dub. +``` +dub fetch urld +dub build urld +``` +Other thing you need to keep in mind is that both meson and Dub need to be using the same compiler. This can be achieved using Dub's `-compiler` argument and/or manually setting the `DC` environment variable when running meson. +``` +dub build urld --compiler=dmd +DC="dmd" meson builddir +``` + ## GL This finds the OpenGL library in a way appropriate to the platform. diff --git a/docs/markdown/Dlang-module.md b/docs/markdown/Dlang-module.md new file mode 100644 index 0000000..d344143 --- /dev/null +++ b/docs/markdown/Dlang-module.md @@ -0,0 +1,41 @@ +# 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** +```meson +generate_dub_file("project name", "source/folder", key: "value" ...) +``` + +**Example** +```meson +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](https://code.dlang.org/). + +Other thing to keep in mind is that currently, the module ignores `configurations`, `subConfigurations`, and `buildTypes`. +You can configure that directly in `dub.json`. diff --git a/docs/sitemap.txt b/docs/sitemap.txt index 46b3b6a..e915df2 100644 --- a/docs/sitemap.txt +++ b/docs/sitemap.txt @@ -39,6 +39,7 @@ index.md RPM-module.md Simd-module.md Windows-module.md + Dlang-module.md Java.md Vala.md D.md |