Skip to content

Commit

Permalink
docs: Add docs for structured_sources
Browse files Browse the repository at this point in the history
  • Loading branch information
dcbaker committed Feb 23, 2022
1 parent 37455a4 commit 9893416
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 12 deletions.
25 changes: 25 additions & 0 deletions docs/markdown/snippets/structured_sources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## structured_sources()

A new function, `structured_sources()` has been added. This function allows
languages like Rust and Cython which depend on the filesystem layout at compile
time to mix generated and static sources.

```meson
executable(
'main',
structured_sources(
'main.rs,
mod : generated_mod_rs,
)
)
```

Meson will then at build time copy the files into the build directory, so that
the desired file structure is laid out, and compile that. In this case:

```
root/
main.rs
mod/
mod.rs
```
22 changes: 10 additions & 12 deletions docs/yaml/functions/structured_sources.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
name: structured_source
returns: structured_src
description: Creates a StructuredSource object from the given arguments
since: 0.62.0
description: |
Create a StructuredSource object, which is opaque and may be passed as a source
to any build_target (including static_library, shared_library, executable,
etc.). This is useful for languages like Rust, which use the filesystem layout
to determine import names. This is only allowed in Rust and Cython targets, and
cannot be mixed non structured inputs
posargs:
root:
type: list[str | file | custom_tgt | cusomt_id | generated_list]
type: list[str | file | custom_tgt | custom_idx | generated_list]
description: Sources to put at the root of the generated structure

optargs:
additional:
type: dict[str | file | custom_tgt | cusomt_id | generated_list]
drescription: |
type: dict[str | file | custom_tgt | custom_idx | generated_list]
description: |
Additional sources, where the key is the directory under the root to place
the values
*Since 0.61.0*

Create a StructuredSource object, which is opaque and may be passed as a source
to any build_target (including static_library, shared_library, executable,
etc.). This is useful for languages like Rust, which use the filesystem layout
to determine import names. This is only allowed in Rust and Cython targets, and
cannot be mixed non structured inputs
3 changes: 3 additions & 0 deletions docs/yaml/objects/structured_src.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: structured_src
long_name: Structured Source
description: Opaque object returned by [[structured_source]].

0 comments on commit 9893416

Please sign in to comment.