aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/markdown/D.md56
-rw-r--r--docs/markdown/Dependencies.md34
-rw-r--r--docs/markdown/Dlang-module.md43
-rw-r--r--docs/markdown/Reference-manual.md2
-rw-r--r--docs/markdown/Reference-tables.md2
-rw-r--r--docs/markdown/snippets/configure_file_overwrite_warning.md39
-rw-r--r--docs/sitemap.txt1
7 files changed, 158 insertions, 19 deletions
diff --git a/docs/markdown/D.md b/docs/markdown/D.md
index 7b0d485..15de2f7 100644
--- a/docs/markdown/D.md
+++ b/docs/markdown/D.md
@@ -5,7 +5,8 @@ short-description: Compiling D sources
# Compiling D applications
-Meson has support for compiling D programs. A minimal `meson.build` file for D looks like this:
+Meson has support for compiling D programs. A minimal `meson.build`
+file for D looks like this:
```meson
project('myapp', 'd')
@@ -15,8 +16,8 @@ executable('myapp', 'app.d')
## Compiling different versions
-If you are using the [version()](https://dlang.org/spec/version.html) feature for conditional compilation, you can use it using the `d_module_versions`
-target property:
+If you are using the [version()](https://dlang.org/spec/version.html) feature for conditional compilation,
+you can use it using the `d_module_versions` target property:
```meson
project('myapp', 'd')
executable('myapp', 'app.d', d_module_versions: ['Demo', 'FeatureA'])
@@ -24,10 +25,14 @@ executable('myapp', 'app.d', d_module_versions: ['Demo', 'FeatureA'])
## Using embedded unittests
-If you are using embedded [unittest functions](https://dlang.org/spec/unittest.html), your source code needs to be compiled twice, once in regular
-mode, and once with unittests active. This is done by setting the `d_unittest` target property to `true`.
-Meson will only ever pass the respective compiler's `-unittest` flag, and never have the compiler generate an empty main function.
-If you need that feature in a portable way, create an empty `main()` function for unittests yourself, since the GNU D compiler
+If you are using embedded [unittest functions](https://dlang.org/spec/unittest.html), your source code needs
+to be compiled twice, once in regular
+mode, and once with unittests active. This is done by setting the
+`d_unittest` target property to `true`.
+Meson will only ever pass the respective compiler's `-unittest` flag,
+and never have the compiler generate an empty main function.
+If you need that feature in a portable way, create an empty `main()`
+function for unittests yourself, since the GNU D compiler
does not have this feature.
This is an example for using D unittests with Meson:
@@ -43,8 +48,10 @@ test('myapptest', test_exe)
# Compiling D libraries and installing them
-Building D libraries is a straightforward process, not different from how C libraries are built in Meson. You should generate a pkg-config file
-and install it, in order to make other software on the system find the dependency once it is installed.
+Building D libraries is a straightforward process, not different from
+how C libraries are built in Meson. You should generate a pkg-config
+file and install it, in order to make other software on the system
+find the dependency once it is installed.
This is an example on how to build a D shared library:
```meson
@@ -71,12 +78,17 @@ pkgc.generate(name: 'mylib',
install_subdir('src/mylib/', install_dir: 'include/d/mylib/')
```
-It is important to make the D sources install in a subdirectory in the include path, in this case `/usr/include/d/mylib/mylib`.
-All D compilers include the `/usr/include/d` directory by default, and if your library would be installed into `/usr/include/d/mylib`, there
-is a high chance that, when you compile your project again on a machine where you installed it, the compiler will prefer the old installed include over
-the new version in the source tree, leading to very confusing errors.
-
-This is an example of how to use the D library we just built and installed in an application:
+It is important to make the D sources install in a subdirectory in the
+ include path, in this case `/usr/include/d/mylib/mylib`.
+All D compilers include the `/usr/include/d` directory by default, and
+ if your library would be installed into `/usr/include/d/mylib`, there
+is a high chance that, when you compile your project again on a
+machine where you installed it, the compiler will prefer the old
+installed include over the new version in the source tree, leading to
+very confusing errors.
+
+This is an example of how to use the D library we just built and
+installed in an application:
```meson
project('myapp', 'd')
@@ -85,5 +97,15 @@ myapp_src = ['app.d', 'alpha.d', 'beta.d']
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.
+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..7b4262d 100644
--- a/docs/markdown/Dependencies.md
+++ b/docs/markdown/Dependencies.md
@@ -109,6 +109,38 @@ object. Since they can be used interchangeably, the rest of the build
definitions do not need to care which one it is. Meson will take care
of all the work behind the scenes to make this work.
+# Dependency method
+
+You can use the keyword `method` to let meson know what method to use
+when searching for the dependency. The default value is `auto`.
+Aditional dependencies methods are `pkg-config`, `config-tool`,
+`system`, `sysconfig`, `qmake`, `extraframework` and `dub`.
+
+```meson
+cups_dep = dependency('cups', method : 'pkg-config')
+```
+
+### Some notes on Dub
+
+Please understand that meson is only able to find dependencies that
+exist in the local Dub repository. You need to manually fetch and
+build the target dependencies.
+
+For `urld`.
+```
+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
+```
+
# Dependencies with custom lookup functionality
Some dependencies have specific detection logic.
@@ -280,7 +312,7 @@ The `language` keyword may used.
Python3 is handled specially by meson:
1. Meson tries to use `pkg-config`.
-1. If `pkg-config` fails meson uses a fallback:
+2. If `pkg-config` fails meson uses a fallback:
- On Windows the fallback is the current `python3` interpreter.
- On OSX the fallback is a framework dependency from `/Library/Frameworks`.
diff --git a/docs/markdown/Dlang-module.md b/docs/markdown/Dlang-module.md
new file mode 100644
index 0000000..ca9a381
--- /dev/null
+++ b/docs/markdown/Dlang-module.md
@@ -0,0 +1,43 @@
+# 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 fucntion, `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/). \ No newline at end of file
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index e3ae111..db8eed1 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -684,7 +684,7 @@ configuration as-is, which may be absolute, or relative to `prefix`.
[`install_dir` arguments](Installing.md) handles that as expected, but
if you need the absolute path to one of these e.g. to use in a define
etc., you should use `join_paths(get_option('prefix'),
-get_option('localstatedir')))`
+get_option('localstatedir'))`
For options of type `feature` a special object is returned instead of
a string. See [`feature` options](Build-options.md#features)
diff --git a/docs/markdown/Reference-tables.md b/docs/markdown/Reference-tables.md
index 6486aa2..91a8e3c 100644
--- a/docs/markdown/Reference-tables.md
+++ b/docs/markdown/Reference-tables.md
@@ -53,6 +53,8 @@ set in the cross file.
| ppc64 | 64 bit PPC processors |
| e2k | MCST Elbrus processor |
| parisc | HP PA-RISC processor |
+| riscv32 | 32 bit RISC-V Open ISA|
+| riscv64 | 64 bit RISC-V Open ISA|
| sparc64 | SPARC v9 processor |
Any cpu family not listed in the above list is not guaranteed to
diff --git a/docs/markdown/snippets/configure_file_overwrite_warning.md b/docs/markdown/snippets/configure_file_overwrite_warning.md
new file mode 100644
index 0000000..550407d
--- /dev/null
+++ b/docs/markdown/snippets/configure_file_overwrite_warning.md
@@ -0,0 +1,39 @@
+## Meson warns if two calls to configure_file() write to the same file
+
+If two calls to [`configure_file()`](#Reference-manual.md#configure_file)
+write to the same file Meson will print a `WARNING:` message during
+configuration. For example:
+```meson
+project('configure_file', 'cpp')
+
+configure_file(
+ input: 'a.in',
+ output: 'out',
+ command: ['./foo.sh']
+ )
+configure_file(
+ input: 'a.in',
+ output: 'out',
+ command: ['./foo.sh']
+)
+
+```
+
+This will output:
+
+```
+The Meson build system
+Version: 0.47.0.dev1
+Source dir: /path/to/srctree
+Build dir: /path/to/buildtree
+Build type: native build
+Project name: configure_file
+Project version: undefined
+Build machine cpu family: x86_64
+Build machine cpu: x86_64
+Configuring out with command
+WARNING: Output file out for configure_file overwritten. First time written in line 3 now in line 8
+Configuring out with command
+Build targets in project: 0
+Found ninja-1.8.2 at /usr/bin/ninja
+```
diff --git a/docs/sitemap.txt b/docs/sitemap.txt
index 68f0a8f..2d43e18 100644
--- a/docs/sitemap.txt
+++ b/docs/sitemap.txt
@@ -40,6 +40,7 @@ index.md
RPM-module.md
Simd-module.md
Windows-module.md
+ Dlang-module.md
Java.md
Vala.md
D.md