diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2017-05-21 16:20:35 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-21 16:20:35 +0300 |
commit | 3bd6130df2e6fbf1ab33f999c0990082fcb42fb3 (patch) | |
tree | d204ffbec6328b768b37b2fc951c6c6a2bc1e96a | |
parent | a24a91b29eecc7a3b4b77712703265e588e0afdc (diff) | |
parent | 75099510f1c7d1a52b589b4364fe6bb64d7aeb4e (diff) | |
download | meson-3bd6130df2e6fbf1ab33f999c0990082fcb42fb3.zip meson-3bd6130df2e6fbf1ab33f999c0990082fcb42fb3.tar.gz meson-3bd6130df2e6fbf1ab33f999c0990082fcb42fb3.tar.bz2 |
Merge pull request #1823 from jon-turney/master
Improve documentation of build target and custom target objects
-rw-r--r-- | docs/markdown/Reference-manual.md | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index 62c0fb3..366ece7 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -132,7 +132,7 @@ These are all the supported keyword arguments: ### custom_target() ``` meson - ctarget custom_target(*name*, ...) + customtarget custom_target(*name*, ...) ``` Create a custom top level build target. The only positional argument is the name of this target and the keyword arguments are the following. @@ -158,6 +158,8 @@ The list of strings passed to the `command` keyword argument accept the followin - `@OUTDIR@` the full path to the directory where the output(s) must be written - `@DEPFILE@` the full path to the dependency file passed to `depfile` +The returned object also has methods that are documented in the [object methods section](#custom-target-object) below. + ### declare_dependency() ``` meson @@ -212,7 +214,7 @@ Returns an empty [environment variable object](#environment-object). ### executable() ``` meson - exe executable(*exe_name*, *sources*, ...) + buildtarget executable(*exe_name*, *sources*, ...) ``` Creates a new executable. The first argument specifies its name and the remaining positional arguments define the input files to use. They can be of the following types: @@ -647,7 +649,7 @@ Defined tests can be run in a backend-agnostic way by calling `mesontest` inside ### vcs_tag() ``` meson - ctarget vcs_tag(...) + customtarget vcs_tag(...) ``` This command detects revision control commit information at build time and places it in the specified output file. This file is guaranteed to be up to date on every build. Keywords are similar to `custom_target`. @@ -737,18 +739,6 @@ When all compilation is 'native', all the methods return the same values as `bui Note that while cross-compiling, it simply returns the values defined in the cross-info file. If `target_machine` values are not defined in the cross-info file, `host_machine` values are returned instead. -### `build target` object - -A build target is either an [executable](#executable), [shared](#shared_library) or [static library](#static_library). - -- `extract_objects()` returns an opaque value representing the generated object files of arguments, usually used to take single object files and link them to unit tests or to compile some source files with custom flags. To use the object file(s) in another build target, use the `objects:` keyword argument. - -- `extract_all_objects()` is same as above but returns all object files generated by this target - -- `private_dir_include()` returns a opaque value that works like `include_directories` but points to the private directory of this target, usually only needed if an another target needs to access some generated internal headers of this target - -- `full_path()` returns a full path pointing to the result target file - ### `compiler` object This object is returned by [`meson.get_compiler(lang)`](#meson-object). It represents a compiler for a given language and allows you to query its properties. It has the following methods: @@ -833,14 +823,17 @@ You can also iterate over arrays with the [`foreach` statement](https://github.c These are objects returned by the [functions listed above](#functions). -### `run result` object +### `build target` object -This object encapsulates the result of trying to compile and run a sample piece of code with [`compiler.run()`](#compiler-object) or [`run_command()`](#run_command). It has the following methods: +A build target is either an [executable](#executable), [shared](#shared_library), [static library](#static_library) or [shared module](#shared_module). -- `compiled()` if true, the compilation succeeded, if false it did not and the other methods return unspecified data -- `returncode()` the return code of executing the compiled binary -- `stdout()` the standard out produced when the binary was run -- `stderr()` the standard error produced when the binary was run +- `extract_objects()` returns an opaque value representing the generated object files of arguments, usually used to take single object files and link them to unit tests or to compile some source files with custom flags. To use the object file(s) in another build target, use the `objects:` keyword argument. + +- `extract_all_objects()` is same as above but returns all object files generated by this target + +- `private_dir_include()` returns a opaque value that works like `include_directories` but points to the private directory of this target, usually only needed if an another target needs to access some generated internal headers of this target + +- `full_path()` returns a full path pointing to the result target file ### `configuration` data object @@ -854,6 +847,12 @@ This object is returned by [`configuration_data()`](#configuration_data) and enc They all take the `description` keyword that will be written in the result file. The replacement assumes a file with C syntax. If your generated file is source code in some other language, you probably don't want to add a description field because it most likely will cause a syntax error. +### `custom target` object + +This object is returned by [`custom_target`](#custom_target) and contains a target with the following methods: + +- `full_path()` returns a full path pointing to the result target file + ### `dependency` object This object is returned by [`dependency()`](#dependency) and contains an external dependency with the following methods: @@ -906,3 +905,11 @@ This object is returned by [`subproject()`](#subproject) and is an opaque object subproject. This is useful to, for instance, get a [declared dependency](#declare_dependency) from the subproject. +### `run result` object + +This object encapsulates the result of trying to compile and run a sample piece of code with [`compiler.run()`](#compiler-object) or [`run_command()`](#run_command). It has the following methods: + +- `compiled()` if true, the compilation succeeded, if false it did not and the other methods return unspecified data +- `returncode()` the return code of executing the compiled binary +- `stdout()` the standard out produced when the binary was run +- `stderr()` the standard error produced when the binary was run |