@ -223,45 +223,45 @@ c/c++ compiler supports this option.
Since *0.63.0* all compiler options can be set per subproject, see
Since *0.63.0* all compiler options can be set per subproject, see
[here ](#specifying-options-per-subproject ) for details on how the default value
[here ](#specifying-options-per-subproject ) for details on how the default value
is inherited from main project. This is useful for example when the main project
is inherited from the main project. This is useful, for example, when the main
requires C++11 but a subproject requires C++14. The `cpp_std` value from
project requires C++11, but a subproject requires C++14. The `cpp_std` value
subproject's `default_options` is now respected.
from the subproject's `default_options` is now respected.
## Specifying options per machine
## Specifying options per machine
Since *0.51.0* , some options are specified per machine rather than
Since *0.51.0* , some options are specified per machine rather than
globally for all machine configurations. Prefixing the option with
globally for all machine configurations. Prefixing the option with
`build.` just affects the build machine configuration, while
`build.` only affects the build machine configuration, while leaving it
unprefixed just affects the host machine configuration, respectively .
unprefixed only affects the host machine configuration .
For example:
For example:
- `build.pkg_config_path` controls the paths pkg-config will search
- `build.pkg_config_path` controls the paths pkg-config will search
for just `native: true` dependencies (build machine).
for `native: true` (build machine) dependencies .
- `pkg_config_path` controls the paths pkg-config will search for
- `pkg_config_path` controls the paths pkg-config will search for
just `native: false` dependencies (host machine).
`native: false` (host machine) dependencies .
This is useful for cross builds. In the native builds, build = host,
This is useful for cross builds. In native builds, the build and host
and the unprefixed option alone will suffice.
machines are the same, and the unprefixed option alone will suffice.
Prior to *0.51.0* , these options just e ffected native builds when
Prior to *0.51.0* , these options only a ffected native builds when
specified on the command line, as there was no `build.` prefix.
specified on the command line as there was no `build.` prefix.
Similarly named fields in the `[properties]` section of the cross file
Similarly named fields in the `[properties]` section of the cross file
would e ffect cross compilers, but the code paths were fairly different
would a ffect cross compilers, but the code paths were fairly different,
allowing differences in behavior to crop out.
allowing differences in behavior to crop out.
## Specifying options per subproject
## Specifying options per subproject
Since *0.54.0* `default_library` and `werror` built-in options can be
Since *0.54.0* `default_library` and `werror` built-in options can be
defined per subproject. This is useful for example when building
defined per subproject. This is useful, for example, when building
shared libraries in the main project, but static link a subproject, or
shared libraries in the main project and statically linking a subproject,
when the main project must build with no warnings but some subprojects
or when the main project must build with no warnings but some subprojects
cannot.
cannot.
Most of the time this would be used either by the parent project by
Most of the time, this would be used either in the parent project by
setting subproject's default_options (e.g. `subproject('foo',
setting subproject's default_options (e.g. `subproject('foo',
default_options: 'default_library=static')`), or by the user usin g the
default_options: 'default_library=static')`), or by the user thro ugh the
command line `-Dfoo:default_library=static` .
command line: `-Dfoo:default_library=static` .
The value is overridden in this order:
The value is overridden in this order:
- Value from parent project
- Value from parent project
@ -269,12 +269,13 @@ The value is overridden in this order:
- Value from subproject() default_options if set
- Value from subproject() default_options if set
- Value from command line if set
- Value from command line if set
Since 0.56.0 `warning_level` can also be defined per subproject.
Since * 0.56.0* `warning_level` can also be defined per subproject.
## Module options
## Module options
Some Meson modules have built-in options. They can be set by prefixing the option
Some Meson modules have built-in options. They can be set by prefixing the
name with the module name: `-D<module>.<option>=<value>` (e.g. `-Dpython.platlibdir=/foo` ).
option with the module's name:
`-D<module>.<option>=<value>` (e.g. `-Dpython.platlibdir=/foo` ).
### Pkgconfig module
### Pkgconfig module
@ -283,18 +284,19 @@ name with the module name: `-D<module>.<option>=<value>` (e.g. `-Dpython.platlib
| relocatable | false | true, false | Generate the pkgconfig files as relocatable (Since 0.63.0) |
| relocatable | false | true, false | Generate the pkgconfig files as relocatable (Since 0.63.0) |
*Since 0.63.0* The `pkgconfig.relocatable` option is used by the
*Since 0.63.0* The `pkgconfig.relocatable` option is used by the
pkgconfig module, namely [`pkg.generate()` ](Pkgconfig-module.md ) and affect how the
pkgconfig module–namely [`pkg.generate()` ](Pkgconfig-module.md )–and
`prefix` in the generated pkgconfig file is set (not to be confused
affects how the `prefix` (not to be confused with the
with the [install prefix ](#directories )). When it is `true` the `prefix` will be
[install prefix ](#directories )) in the generated pkgconfig file is set.
relative to the `install_dir` . This allows the pkgconfig file to be
When it is `true` , the `prefix` will be relative to the `install_dir` -this
moved around and still work, as long as the relative path is not
allows the pkgconfig file to be moved around and still work, as long
broken. In general this allows for the whole installed package to be
as the relative path is not broken. In general, this allows for the whole
placed anywhere on the system and still work as a dependency. When it
installed package to be placed anywhere on the system and still work as a
is set to `false` the `prefix` will be the same as the install prefix.
dependency. When it is set to `false` , the `prefix` will be the same as
the install prefix.
An error will be raised if `pkgconfig.relocatable` is `true` and the
An error will be raised if `pkgconfig.relocatable` is `true` and the
`install_dir` for a generated pkgconfig file points outside the
`install_dir` for a generated pkgconfig file points outside the
install prefix. For example if the install prefix is `/usr` and the
install prefix. For example: if the install prefix is `/usr` and the
`install_dir` for a pkgconfig file is `/var/lib/pkgconfig` .
`install_dir` for a pkgconfig file is `/var/lib/pkgconfig` .
### Python module
### Python module
@ -305,13 +307,13 @@ install prefix. For example if the install prefix is `/usr` and the
| platlibdir | | Directory path | Directory for site-specific, platform-specific files (Since 0.60.0) |
| platlibdir | | Directory path | Directory for site-specific, platform-specific files (Since 0.60.0) |
| purelibdir | | Directory path | Directory for site-specific, non-platform-specific files (Since 0.60.0) |
| purelibdir | | Directory path | Directory for site-specific, non-platform-specific files (Since 0.60.0) |
*Since 0.60.0* `python.platlibdir` and `python.purelibdir` options are used by
*Since 0.60.0* The `python.platlibdir` and `python.purelibdir` options are used
python module methods `python.install_sources()` and `python.get_install_dir()` .
by the python module methods `python.install_sources()` and
By default Meson tries to detect the correct installation path, but make them
`python.get_install_dir()` ; Meson tries to detect the correct installation paths
relative to the installation `prefix` , which will often result in installed pytho n
and make them relative to the installation `prefix` by default which will ofte n
modules to not be found by the interpreter unless `prefix` is `/usr` on Linux,
result in the interpreter not finding the installed python modules unless
or for example `C:\Python39` on Windows. These options can be absolute paths
`prefix` is `/usr` on Linux, or, for instance, `C:\Python39` on Windows. These
outside of `prefix` .
options can be absolute paths o utside of `prefix` .
*Since 0.62.0* The `python.install_env` option is used to detect the correct
*Since 0.62.0* The `python.install_env` option is used to detect the correct
installation path. Setting to `system` will avoid making the paths relative to
installation path. Setting to `system` will avoid making the paths relative to