aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2018-01-03 11:46:13 -0500
committerXavier Claessens <xavier.claessens@collabora.com>2018-04-03 15:38:01 -0400
commit68f9846b7c584815d821c60fcdff866fe629955a (patch)
treed90a14a8d2e790bea3084e3226d0f5f326e5f482 /docs/markdown
parent809f01833336be63eb07441e120de2e4f8c4b3c4 (diff)
downloadmeson-68f9846b7c584815d821c60fcdff866fe629955a.zip
meson-68f9846b7c584815d821c60fcdff866fe629955a.tar.gz
meson-68f9846b7c584815d821c60fcdff866fe629955a.tar.bz2
Add both_libraries() to build both shared and static libraries
Also support default_library='both' to make library() build both shared and static libraries. Closes #484
Diffstat (limited to 'docs/markdown')
-rw-r--r--docs/markdown/Reference-manual.md33
-rw-r--r--docs/markdown/snippets/both-libraries.md9
2 files changed, 36 insertions, 6 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index 5109b25..d98fc19 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -112,6 +112,24 @@ run. The behavior of this function is identical to `test` with the
exception that there is no `is_parallel` keyword, because benchmarks
are never run in parallel.
+### both_libraries()
+
+``` meson
+ buildtarget both_libraries(library_name, list_of_sources, ...)
+```
+
+Builds both a static and shared library with the given sources. Positional and
+keyword arguments are otherwise the same as for [`library`](#library). Source
+files will be compiled only once and object files will be reused to build both
+shared and static libraries, unless `b_staticpic` user option or `pic` argument
+are set to false in which case sources will be compiled twice.
+
+The returned [buildtarget](#build-target-object) always represents the shared
+library. In addition it supports the following extra methods:
+
+- `get_shared_lib()` returns the shared library build target
+- `get_static_lib()` returns the static library build target
+
### build_target()
Creates a build target whose type can be set dynamically with the
@@ -885,10 +903,11 @@ dropped. That means that `join_paths('foo', '/bar')` returns `/bar`.
buildtarget library(library_name, list_of_sources, ...)
```
-Builds a library that is either static or shared depending on the
-value of `default_library` user option. You should use this instead of
-[`shared_library`](#shared_library) or
-[`static_library`](#static_library) most of the time. This allows you
+Builds a library that is either static, shared or both depending on the value of
+`default_library` user option. You should use this instead of
+[`shared_library`](#shared_library),
+[`static_library`](#static_library) or
+[`both_libraries`](#both_libraries) most of the time. This allows you
to toggle your entire project (including subprojects) from shared to
static with only one option.
@@ -911,7 +930,8 @@ The keyword arguments for this are the same as for [`executable`](#executable) w
libraries. Defaults to `dylib` for shared libraries and `rlib` for
static libraries.
-`static_library` and `shared_library` also accept these keyword arguments.
+`static_library`, `shared_library` and `both_libraries` also accept these keyword
+arguments.
### message()
@@ -1670,7 +1690,8 @@ These are objects returned by the [functions listed above](#functions).
### `build target` object
A build target is either an [executable](#executable),
-[shared](#shared_library), [static library](#static_library) or
+[shared library](#shared_library), [static library](#static_library),
+[both shared and static library](#both_libraries) or
[shared module](#shared_module).
- `extract_all_objects()` is same as `extract_objects` but returns all
diff --git a/docs/markdown/snippets/both-libraries.md b/docs/markdown/snippets/both-libraries.md
new file mode 100644
index 0000000..1632f63
--- /dev/null
+++ b/docs/markdown/snippets/both-libraries.md
@@ -0,0 +1,9 @@
+## Building both shared and static libraries
+
+A new function `both_libraries()` has been added to build both shared and static
+libraries at the same time. Source files will be compiled only once and object
+files will be reused to build both shared and static libraries, unless
+`b_staticpic` user option or `pic` argument are set to false in which case
+sources will be compiled twice.
+
+The returned `buildtarget` object always represents the shared library.