mirror of
https://github.com/mesonbuild/meson.git
synced 2026-11-06 05:16:42 +00:00
move note about macOS deployment target to new platform support page
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
1 parent
9114f095dc
commit
c68fddfb85
2 files changed
+32
-14
No files matched your search
@@ -179,20 +179,8 @@ if [[#compiler.has_function]]('open_memstream', prefix : '#include <stdio.h>')
|
||||
endif
|
||||
```
|
||||
|
||||
Note that, on macOS programs can be compiled targeting older macOS
|
||||
versions than the one that the program is compiled on. It can't be
|
||||
assumed that the OS version that is compiled on matches the OS version
|
||||
that the binary will run on.
|
||||
|
||||
Therefore when detecting function availability with [[compiler.has_function]], it
|
||||
is important to specify the correct header in the prefix argument.
|
||||
|
||||
In the example above, the function `open_memstream` is detected, which
|
||||
was introduced in macOS 10.13. When the user builds on macOS 10.13,
|
||||
but targeting macOS 10.11 (`-mmacosx-version-min=10.11`), this will
|
||||
correctly report the function as missing. Without the header however,
|
||||
it would lack the necessary availability information and incorrectly
|
||||
report the function as available.
|
||||
When targeting macOS, the header in the prefix argument is also what makes the check
|
||||
respect the deployment target. See [Platform notes](Platform-notes.md#macos-deployment-target).
|
||||
|
||||
## Is a macro defined?
|
||||
|
||||
|
||||
@@ -6,6 +6,36 @@ short-description: Notes and known issues for specific platforms
|
||||
|
||||
This page collects information that is specific to a platform or to a toolchain.
|
||||
|
||||
## macOS deployment target
|
||||
|
||||
Programs can be compiled for older macOS versions than the one they are compiled on. The
|
||||
version of the build machine therefore does not tell which functions are available when the
|
||||
program runs.
|
||||
|
||||
The deployment target is chosen by the compiler. Either set the `MACOSX_DEPLOYMENT_TARGET`
|
||||
environment variable before running Meson, or pass `-mmacosx-version-min` in both the compile
|
||||
and the link arguments, for example in a native file:
|
||||
|
||||
```ini
|
||||
[built-in options]
|
||||
c_args = ['-mmacosx-version-min=10.11']
|
||||
c_link_args = ['-mmacosx-version-min=10.11']
|
||||
```
|
||||
|
||||
The checks that Meson runs use the same arguments, so they see the deployment target.
|
||||
|
||||
When detecting a function with `compiler.has_function()`, specify the header that declares it
|
||||
in the `prefix` argument. For example, `open_memstream` was introduced in macOS 10.13. When
|
||||
building on macOS 10.13 for macOS 10.11, the following check correctly reports the function as
|
||||
missing:
|
||||
|
||||
```meson
|
||||
cc.has_function('open_memstream', prefix : '#include <stdio.h>')
|
||||
```
|
||||
|
||||
Without the header, the check lacks the availability information and incorrectly reports the
|
||||
function as available.
|
||||
|
||||
## QNX
|
||||
|
||||
Meson can detect and use `qcc` and `q++`, the C and C++ compiler drivers shipped with the QNX
|
||||
|
||||
Reference in new issue
Block a user