Commit Graph

28 Commits

Author SHA1 Message Date
Xavier Claessens 748a1db1f8 doc: Fix some broken links 2023-03-28 21:46:32 +03:00
Dylan Baker b2473b61cc interpreter: add FeatureOption.enable_if and .disable_if
This adds two new methods, that are conceptually related in the same way
that `enable_auto_if` and `disable_auto_if` are. They are different
however, in that they will always replace an `auto` value with an
`enabled` or `disabled` value, or error if the feature is in the
opposite state (calling `feature(disabled).enable_if(true)`, for
example). This matters when the feature will be passed to
dependency(required : …)`, which has different behavior when passed an
enabled feature than an auto one.

The `disable_if` method will be controversial, I'm sure, since it
can be expressed via `feature.require()` (`feature.require(not
condition) == feature.disable_if(condition)`). I have two defences of
this:

1) `feature.require` is difficult to reason about, I would expect
   require to be equivalent to `feature.enable_if(condition)`, not to
   `feature.disable_if(not condition)`.
2) mixing `enable_if` and `disable_if` in the same call chain is much
   clearer than mixing `require` and `enable_if`:
   ```meson
   get_option('feat') \
     .enable_if(foo) \
     .disable_if(bar) \
     .enable_if(opt)
   ```
   vs
   ```meson
   get_option('feat') \
     .enable_if(foo) \
     .require(not bar) \
     .enable_if(opt)
   ```
   In the first chain it's immediately obvious what is happening, in the
   second, not so much, especially if you're not familiar with what
   `require` means.
2023-02-15 22:58:50 -05:00
Dylan Baker 3589815eb9 interpreter: add a feature.enable_auto_if
It's always been strange to me we don't have an opposite method of the
`disable_auto_if` method, but I've been pressed to find a case where we
_need_ one, because `disable_auto_if` can't be logically contorted to
work. I finally found the case where they're not equivalent: when you
don't want to convert to a boolean:

```meson
f = get_option('feat').disable_auto_if(not foo)
g = get_option('feat').enable_auto_if(foo)

dep1 = dependency('foo', required : f)
dep2 = dependency('foo', required : g)
```
2023-02-15 22:58:50 -05:00
Xavier Claessens d21b64487e preprocess: Add dependencies kwarg 2023-02-15 15:12:34 -05:00
Paolo Bonzini 2c8c0f9586 document declare_dependency(object: ...) 2023-01-04 09:44:32 -08:00
Xavier Claessens a0b37a77ab doc: Add missing include_directories kwarg to compiler.preprocess()
Fixes: #11202
2022-12-21 08:31:30 -05:00
Eli Schwartz 57f91bb593
docs: clarify the semantics of the required: kwarg everywhere
Link to feature options consistently, and point out that it controls
"whether" the function finds what it's trying to find. This clues people
in to the fact that disabled features exist.
2022-12-14 18:59:26 -05:00
Marvin Scholz 85a58f12f0 interpreter: compiler: Allow array for the prefix kwarg 2022-12-06 10:59:00 -05:00
Eli Schwartz fae24d86f5
docs: clarify prog.full_path even more
The previous description update was lacking an example of why
external_program cares about inter-target dependencies.
2022-11-30 20:19:56 -05:00
Eli Schwartz dcc50b9967
docs: clarify that prog.full_path has potentially valid uses
Claiming that "it should literally never be used ever no matter what" is
confusing and wrong -- it's definitely useful sometimes, but does result
in downsides, like not tracking inter-target dependencies correctly.

Ref: #10901
2022-11-30 18:26:59 -05:00
Jussi Pakkanen 4c2b64188d
Merge pull request #10916 from xclaesse/preprocess
Add cc.preprocess() method
2022-10-23 17:24:46 +03:00
Xavier Claessens d53486bf9c Add doc and release notes for cc.preprocess() 2022-10-23 12:21:46 +02:00
Elliott Sales de Andrade fa2585d0b3 Fix typos in docs 2022-10-23 03:06:39 +03:00
Daniel Mensinger 99f510a817 docs: YAML: Add `arg_flattening: false` where required 2022-04-07 17:16:26 -04:00
Daniel Mensinger 8e13e63fca docs: Fix [[true]] --> `true` 2022-04-07 17:16:26 -04:00
Dylan Baker 9cf7a12561 docs: Add docs for structured_sources 2022-03-07 12:33:33 -08:00
Eli Schwartz 0f2f87a003
find_program: add a version() method to match the one for dependencies
It is often useful to check the found version of a program without
checking whether you can successfully find
`find_program('foo', required: false, version: '>=XXX')`
2022-03-06 19:41:21 -05:00
Dylan Baker 9c7ddf59fe interpreterobjects: deprecated passing a number to configuration_data.set10
This is currently allowed, and is used in at least a few projects. It
was not intended to work or documented, but it does and since it is in
use a full deprecation period must be used. A warning has also been
added for values < 0, which have surprising behavior.
2022-01-18 17:53:29 -05:00
Dylan Baker 9cc222c048
docs/dep.yaml: davault -> default 2022-01-14 19:20:31 -08:00
Luke Drummond 150b110e7a Clarify some wording for compiler.first_supported_argument
After a discussion implementing this for muon [1] and clarification on
IRC on Meson's behaviour.

[1] https://lists.sr.ht/~lattis/muon/patches/26722
2021-11-21 18:57:23 -05:00
Eli Schwartz 39ceb67774 docs: fix refman 2.0 regression in correctly describing find_library(has_headers)
All kwargs inherited from has_header need to be prefixed `header_` so we
cannot just do straight inheritance. And the part of the description
that highlighted the way kwargs are derived and evolved, went entirely
missing.

Fixes #9551
2021-11-09 16:59:36 -08:00
Eli Schwartz 4029705cf3 docs: fix some spelling typos 2021-11-09 16:59:36 -08:00
Hofer-Julian 939394ed31 Fix typos
"seperator" -> "separator"
2021-10-21 06:57:57 -04:00
Eli Schwartz 1d17ef3edb
docs: fix a typoed arg name and another missing arg
More stuff that got overlooked during the big refman migration.
2021-10-11 21:20:36 -04:00
Eli Schwartz a864269817
docs: restore build_target method documentation which went missing
In the refman rewrite, these functions vanished. I noticed this when I
went looking at the docs for extract_all_objects(), or should I say I
tried to go looking.
2021-10-07 21:30:55 -04:00
Daniel Mensinger b672ebca88
Minor fixups 2021-10-04 19:39:36 +02:00
Daniel Mensinger 0b9c7b74be
docs: Update YAML docs after rebase 2021-10-03 12:19:46 +02:00
Daniel Mensinger 2b482e39a9
docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00