2017-09-17 00:16:00 +08:00
# Reference tables
## Compiler ids
2018-10-17 01:03:13 +08:00
These are return values of the `get_id` (Compiler family) and
`get_argument_syntax` (Argument syntax) method in a compiler object.
2019-05-11 04:56:04 +08:00
| Value | Compiler family | Argument syntax |
| ----- | --------------- | --------------- |
| arm | ARM compiler | |
| armclang | ARMCLANG compiler | |
2020-03-21 04:13:42 +08:00
| c2000 | Texas Instruments C2000 compiler | |
Add support for the CompCert C Compiler
* Add preliminary support for the CompCert C Compiler
The intention is to use this with the picolibc, so some GCC flags are
automatically filtered. Since CompCert uses GCC is for linking, those
GCC-linker flags which are used by picolibc, are automatically prefixed
with '-WUl', so that they're passed to GCC.
Squashed commit of the following:
commit 4e0ad66dca9de301d2e41e74aea4142afbd1da7d
Author: Sebastian Meyer <meyer@absint.com>
Date: Mon Aug 31 14:20:39 2020 +0200
remove '-fall' from default arguments, also filter -ftls-model=.*
commit 41afa3ccc62ae72824eb319cb8b34b7e6693cb67
Author: Sebastian Meyer <meyer@absint.com>
Date: Mon Aug 31 14:13:55 2020 +0200
use regex for filtering ccomp args
commit d68d242d0ad22f8bf53923ce849da9b86b696a75
Author: Sebastian Meyer <meyer@absint.com>
Date: Mon Aug 31 13:54:36 2020 +0200
filter some gcc arguments
commit 982a01756266bddbbd211c54e8dbfa2f43dec38f
Author: Sebastian Meyer <meyer@absint.com>
Date: Fri Aug 28 15:03:14 2020 +0200
fix ccomp meson configuration
commit dce0bea00b1caa094b1ed0c6c77cf6c12f0f58d9
Author: Sebastian Meyer <meyer@absint.com>
Date: Thu Aug 27 13:02:19 2020 +0200
add CompCert to meson (does not fully work, yet)
* remove unused import and s/cls/self/
fixes the two obvious LGTM warnings
* CompCert: Do not ignore unsupported GCC flags
Some are safe to ignore, however, as per
https://github.com/mesonbuild/meson/pull/7674, they should not be
ignored by meson itself. Instead the meson.build should take care to
select only those which are actually supported by the compiler.
* remove unused variable
* Only add arguments once.
* Apply suggestions from code review
Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
* Remove erroneous ' ' from '-o {}'.format()
As noticed by @dcbaker
* added release note snippet for compcert
* properly split parameters
As suggested by @dcbaker, these parameters should be properly split into multiple strings.
Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
* Update add_compcert_compiler.md
Added a sentence about the state of the implementation (experimental); use proper markdown
* properly separate arguments
Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
2020-09-16 02:51:21 +08:00
| ccomp | The CompCert formally-verified C compiler | |
2019-05-11 04:56:04 +08:00
| ccrx | Renesas RX Family C/C++ compiler | |
| clang | The Clang compiler | gcc |
| clang-cl | The Clang compiler (MSVC compatible driver) | msvc |
| dmd | D lang reference compiler | |
2019-06-20 02:56:00 +08:00
| emscripten| Emscripten WASM compiler | |
2019-05-11 04:56:04 +08:00
| flang | Flang Fortran compiler | |
| g95 | The G95 Fortran compiler | |
| gcc | The GNU Compiler Collection | gcc |
| intel | Intel compiler (Linux and Mac) | gcc |
| intel-cl | Intel compiler (Windows) | msvc |
| lcc | Elbrus C/C++/Fortran Compiler | |
| llvm | LLVM-based compiler (Swift, D) | |
| mono | Xamarin C# compiler | |
| msvc | Microsoft Visual Studio | msvc |
| nagfor | The NAG Fortran compiler | |
2020-07-13 12:20:33 +08:00
| nvidia_hpc| NVidia HPC SDK compilers | |
2019-05-11 04:56:04 +08:00
| open64 | The Open64 Fortran Compiler | |
| pathscale | The Pathscale Fortran compiler | |
2020-03-21 04:13:42 +08:00
| pgi | Portland PGI C/C++/Fortran compilers | |
2019-05-11 04:56:04 +08:00
| rustc | Rust compiler | |
| sun | Sun Fortran compiler | |
| valac | Vala compiler | |
2020-03-21 04:13:42 +08:00
| xc16 | Microchip XC16 C compiler | |
2017-09-17 00:16:00 +08:00
2019-12-15 20:40:43 +08:00
## Linker ids
2020-02-19 06:22:13 +08:00
These are return values of the `get_linker_id` method in a compiler object.
2020-02-20 03:02:12 +08:00
| Value | Linker family |
| ----- | --------------- |
2020-02-26 03:36:31 +08:00
| ld.bfd | The GNU linker |
2020-02-20 03:02:12 +08:00
| ld.gold | The GNU gold linker |
| ld.lld | The LLVM linker, with the GNU interface |
| ld.solaris | Solaris and illumos |
2020-02-26 03:36:31 +08:00
| ld.wasm | emscripten's wasm-ld linker |
2020-02-20 03:02:12 +08:00
| ld64 | Apple ld64 |
| link | MSVC linker |
| lld-link | The LLVM linker, with the MSVC interface |
| xilink | Used with Intel-cl only, MSVC like |
| optlink | optlink (used with DMD) |
| rlink | The Renesas linker, used with CCrx only |
2020-03-21 04:13:42 +08:00
| xc16-ar | The Microchip linker, used with XC16 only |
| ar2000 | The Texas Instruments linker, used with C2000 only |
2020-02-20 03:02:12 +08:00
| armlink | The ARM linker (arm and armclang compilers) |
| pgi | Portland/Nvidia PGI |
| nvlink | Nvidia Linker used with cuda |
Add support for the CompCert C Compiler
* Add preliminary support for the CompCert C Compiler
The intention is to use this with the picolibc, so some GCC flags are
automatically filtered. Since CompCert uses GCC is for linking, those
GCC-linker flags which are used by picolibc, are automatically prefixed
with '-WUl', so that they're passed to GCC.
Squashed commit of the following:
commit 4e0ad66dca9de301d2e41e74aea4142afbd1da7d
Author: Sebastian Meyer <meyer@absint.com>
Date: Mon Aug 31 14:20:39 2020 +0200
remove '-fall' from default arguments, also filter -ftls-model=.*
commit 41afa3ccc62ae72824eb319cb8b34b7e6693cb67
Author: Sebastian Meyer <meyer@absint.com>
Date: Mon Aug 31 14:13:55 2020 +0200
use regex for filtering ccomp args
commit d68d242d0ad22f8bf53923ce849da9b86b696a75
Author: Sebastian Meyer <meyer@absint.com>
Date: Mon Aug 31 13:54:36 2020 +0200
filter some gcc arguments
commit 982a01756266bddbbd211c54e8dbfa2f43dec38f
Author: Sebastian Meyer <meyer@absint.com>
Date: Fri Aug 28 15:03:14 2020 +0200
fix ccomp meson configuration
commit dce0bea00b1caa094b1ed0c6c77cf6c12f0f58d9
Author: Sebastian Meyer <meyer@absint.com>
Date: Thu Aug 27 13:02:19 2020 +0200
add CompCert to meson (does not fully work, yet)
* remove unused import and s/cls/self/
fixes the two obvious LGTM warnings
* CompCert: Do not ignore unsupported GCC flags
Some are safe to ignore, however, as per
https://github.com/mesonbuild/meson/pull/7674, they should not be
ignored by meson itself. Instead the meson.build should take care to
select only those which are actually supported by the compiler.
* remove unused variable
* Only add arguments once.
* Apply suggestions from code review
Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
* Remove erroneous ' ' from '-o {}'.format()
As noticed by @dcbaker
* added release note snippet for compcert
* properly split parameters
As suggested by @dcbaker, these parameters should be properly split into multiple strings.
Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
* Update add_compcert_compiler.md
Added a sentence about the state of the implementation (experimental); use proper markdown
* properly separate arguments
Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
2020-09-16 02:51:21 +08:00
| ccomp | CompCert used as the linker driver |
2020-02-19 06:22:13 +08:00
For languages that don't have separate dynamic linkers such as C# and Java, the
`get_linker_id` will return the compiler name.
2017-09-17 00:16:00 +08:00
## Script environment variables
| Value | Comment |
| ----- | ------- |
| MESONINTROSPECT | Command to run to run the introspection command, may be of the form `python /path/to/meson introspect` , user is responsible for splitting the path if necessary. |
2018-11-22 19:49:45 +08:00
| MESON_BUILD_ROOT | Absolute path to the build dir |
2018-07-18 22:11:57 +08:00
| MESON_DIST_ROOT | Points to the root of the staging directory, only set when running `dist` scripts |
2018-11-22 19:49:45 +08:00
| MESON_SOURCE_ROOT | Absolute path to the source dir |
| MESON_SUBDIR | Current subdirectory, only set for `run_command` |
2018-07-18 22:11:57 +08:00
2017-09-17 00:16:00 +08:00
## CPU families
These are returned by the `cpu_family` method of `build_machine` ,
`host_machine` and `target_machine` . For cross compilation they are
set in the cross file.
2020-01-22 03:01:12 +08:00
| Value | Comment |
| ----- | ------- |
| aarch64 | 64 bit ARM processor |
| alpha | DEC Alpha processor |
| arc | 32 bit ARC processor |
| arm | 32 bit ARM processor |
2020-05-10 23:16:23 +08:00
| avr | Atmel AVR processor |
2020-03-21 04:13:42 +08:00
| c2000 | 32 bit C2000 processor |
2020-06-20 01:54:18 +08:00
| dspic | 16 bit Microchip dsPIC |
| e2k | MCST Elbrus processor |
2020-01-22 03:01:12 +08:00
| ia64 | Itanium processor |
2020-10-06 22:42:43 +08:00
| loongarch64 | 64 bit Loongson processor|
2020-01-22 03:01:12 +08:00
| m68k | Motorola 68000 processor |
| microblaze | MicroBlaze processor |
| mips | 32 bit MIPS processor |
| mips64 | 64 bit MIPS processor |
| parisc | HP PA-RISC processor |
2020-06-20 01:54:18 +08:00
| pic24 | 16 bit Microchip PIC24 |
2020-01-22 03:01:12 +08:00
| ppc | 32 bit PPC processors |
| ppc64 | 64 bit PPC processors |
| riscv32 | 32 bit RISC-V Open ISA |
| riscv64 | 64 bit RISC-V Open ISA |
| rl78 | Renesas RL78 |
| rx | Renesas RX 32 bit MCU |
| s390 | IBM zSystem s390 |
| s390x | IBM zSystem s390x |
2020-06-20 01:56:09 +08:00
| sh4 | SuperH SH-4 |
2020-01-22 03:01:12 +08:00
| sparc | 32 bit SPARC |
| sparc64 | SPARC v9 processor |
| wasm32 | 32 bit Webassembly |
| wasm64 | 64 bit Webassembly |
| x86 | 32 bit x86 processor |
| x86_64 | 64 bit x86 processor |
2017-09-17 00:16:00 +08:00
Any cpu family not listed in the above list is not guaranteed to
remain stable in future releases.
2021-02-01 00:00:24 +08:00
Those porting from autotools should note that Meson does not add
2018-10-03 01:14:21 +08:00
endianness to the name of the cpu_family. For example, autotools
2021-02-01 00:00:24 +08:00
will call little endian PPC64 "ppc64le", Meson will not, you must
2018-10-03 01:14:21 +08:00
also check the `.endian()` value of the machine for this information.
2017-09-17 00:16:00 +08:00
## Operating system names
These are provided by the `.system()` method call.
| Value | Comment |
| ----- | ------- |
2020-06-03 03:08:00 +08:00
| android | By convention only, subject to change |
2017-11-17 20:58:05 +08:00
| cygwin | The Cygwin environment for Windows |
2018-11-22 19:49:45 +08:00
| darwin | Either OSX or iOS |
2017-12-19 08:25:40 +08:00
| dragonfly | DragonFly BSD |
2019-06-20 02:56:00 +08:00
| emscripten | Emscripten's Javascript environment |
2018-11-22 19:49:45 +08:00
| freebsd | FreeBSD and its derivatives |
2018-10-09 05:24:59 +08:00
| gnu | GNU Hurd |
2018-11-22 19:49:45 +08:00
| haiku | |
| linux | |
| netbsd | |
2019-11-12 04:41:09 +08:00
| openbsd | |
2018-11-22 19:49:45 +08:00
| windows | Any version of Windows |
2019-08-21 04:42:41 +08:00
| sunos | illumos and Solaris |
2017-09-17 00:16:00 +08:00
Any string not listed above is not guaranteed to remain stable in
2017-11-21 08:59:21 +08:00
future releases.
2018-02-25 20:02:34 +08:00
## Language arguments parameter names
These are the parameter names for passing language specific arguments to your build target.
2019-01-09 03:35:34 +08:00
| Language | compiler name | linker name |
| ------------- | ------------- | ----------------- |
| C | c_args | c_link_args |
| C++ | cpp_args | cpp_link_args |
| C# | cs_args | cs_link_args |
| D | d_args | d_link_args |
| Fortran | fortran_args | fortran_link_args |
| Java | java_args | java_link_args |
| Objective C | objc_args | objc_link_args |
| Objective C++ | objcpp_args | objcpp_link_args |
| Rust | rust_args | rust_link_args |
| Vala | vala_args | vala_link_args |
2017-09-30 02:52:06 +08:00
2021-01-30 19:20:59 +08:00
All these `<lang>_*` options are specified per machine. See in
[specifying options per
machine](Builtin-options.md#Specifying-options-per-machine) for on how
to do this in cross builds.
2020-06-10 08:38:46 +08:00
2018-11-18 22:35:25 +08:00
## Compiler and linker flag environment variables
These environment variables will be used to modify the compiler and
linker flags.
2021-01-30 19:20:59 +08:00
It is recommended that you **do not use these** . They are provided
purely to for backwards compatibility with other build systems. There
are many caveats to their use, especially when rebuilding the project.
It is **highly** recommended that you use [the command line
arguments](#language-arguments-parameter-names) instead.
2019-01-09 03:31:58 +08:00
2018-12-13 16:11:53 +08:00
| Name | Comment |
| ----- | ------- |
2018-11-18 22:35:25 +08:00
| CFLAGS | Flags for the C compiler |
| CXXFLAGS | Flags for the C++ compiler |
| OBJCFLAGS | Flags for the Objective C compiler |
| FFLAGS | Flags for the Fortran compiler |
| DFLAGS | Flags for the D compiler |
| VALAFLAGS | Flags for the Vala compiler |
| RUSTFLAGS | Flags for the Rust compiler |
| LDFLAGS | The linker flags, used for all languages |
2017-09-30 02:52:06 +08:00
2021-01-30 19:20:59 +08:00
N.B. these settings are specified per machine, and so the environment
varibles actually come in pairs. See the [environment variables per
2020-06-10 08:38:46 +08:00
machine](#Environment-variables-per-machine) section for details.
2017-09-30 02:52:06 +08:00
## Function Attributes
These are the parameters names that are supported using
`compiler.has_function_attribute()` or
`compiler.get_supported_function_attributes()`
2018-10-28 06:11:44 +08:00
### GCC `__attribute__`
2017-09-30 02:52:06 +08:00
These values are supported using the GCC style `__attribute__` annotations,
which are supported by GCC, Clang, and other compilers.
2020-06-22 00:31:59 +08:00
| Name |
|--------------------------|
| alias |
| aligned |
| alloc_size |
| always_inline |
| artificial |
| cold |
| const |
| constructor |
| constructor_priority |
| deprecated |
| destructor |
| error |
| externally_visible |
| fallthrough |
| flatten |
| format |
| format_arg |
| force_align_arg_pointer³ |
| gnu_inline |
| hot |
| ifunc |
| malloc |
| noclone |
| noinline |
| nonnull |
| noreturn |
| nothrow |
| optimize |
| packed |
| pure |
| returns_nonnull |
| unused |
| used |
| visibility* |
| visibility:default† |
| visibility:hidden† |
| visibility:internal† |
| visibility:protected† |
| warning |
| warn_unused_result |
| weak |
| weakreaf |
2017-09-30 02:52:06 +08:00
2019-06-25 05:02:26 +08:00
\* *Changed in 0.52.0* the "visibility" target no longer includes
"protected", which is not present in Apple's clang.
† *New in 0.52.0* These split visibility attributes are preferred to the plain
"visibility" as they provide narrower checks.
2020-06-22 00:31:59 +08:00
³ *New in 0.55.0*
2017-09-30 02:52:06 +08:00
### MSVC __declspec
These values are supported using the MSVC style `__declspec` annotation,
which are supported by MSVC, GCC, Clang, and other compilers.
| Name |
|----------------------|
| dllexport |
| dllimport |
2019-03-03 00:17:16 +08:00
## Dependency lookup methods
These are the values that can be passed to `dependency` function's
`method` keyword argument.
| Name | Comment |
| ----- | ------- |
| auto | Automatic method selection |
| pkg-config | Use Pkg-Config |
| cmake | Look up as a CMake module |
| config-tool | Use a custom dep tool such as `cups-config` |
| system | System provided (e.g. OpenGL) |
| extraframework | A macOS/iOS framework |
2020-03-13 02:13:17 +08:00
## Compiler and Linker selection variables
2021-01-30 19:20:59 +08:00
N.B. these settings are specified per machine, and so the environment
varibles actually come in pairs. See the [environment variables per
2020-06-10 08:38:46 +08:00
machine](#Environment-variables-per-machine) section for details.
2020-03-13 02:13:17 +08:00
| Language | Compiler | Linker | Note |
2020-04-12 00:41:06 +08:00
|---------------|----------|-----------|---------------------------------------------|
2020-03-13 02:13:17 +08:00
| C | CC | CC_LD | |
| C++ | CXX | CXX_LD | |
| D | DC | DC_LD | Before 0.54 D_LD* |
| Fortran | FC | FC_LD | Before 0.54 F_LD* |
| Objective-C | OBJC | OBJC_LD | |
| Objective-C++ | OBJCXX | OBJCXX_LD | Before 0.54 OBJCPP_LD* |
| Rust | RUSTC | RUSTC_LD | Before 0.54 RUST_LD* |
| Vala | VALAC | | Use CC_LD. Vala transpiles to C |
| C# | CSC | CSC | The linker is the compiler |
2021-01-30 19:20:59 +08:00
*The old environment variales are still supported, but are deprecated
2021-02-01 00:00:24 +08:00
and will be removed in a future version of Meson.*
2020-06-10 08:38:46 +08:00
## Environment variables per machine
2021-01-30 19:20:59 +08:00
Since *0.54.0* , Following Autotool and other legacy build systems,
environment variables that affect machine-specific settings come in
pairs: for every bare environment variable `FOO` , there is a suffixed
`FOO_FOR_BUILD` , where `FOO` just affects the host machine
configuration, while `FOO_FOR_BUILD` just affects the build machine
configuration. For example:
2020-06-10 08:38:46 +08:00
- `PKG_CONFIG_PATH_FOR_BUILD` controls the paths pkg-config will search for
just `native: true` dependencies (build machine).
- `PKG_CONFIG_PATH` controls the paths pkg-config will search for just
`native: false` dependencies (host machine).
2021-02-01 00:00:24 +08:00
This mirrors the `build.` prefix used for (built-in) Meson options,
2021-01-30 19:20:59 +08:00
which has the same meaning.
2020-06-10 08:38:46 +08:00
2021-01-30 19:20:59 +08:00
This is useful for cross builds. In the native builds, build = host,
and the unsuffixed environment variables alone will suffice.
2020-03-13 02:13:17 +08:00
2021-01-30 19:20:59 +08:00
Prior to *0.54.0* , there was no `_FOR_BUILD` -suffixed variables, and
most environment variables only effected native machine
configurations, though this wasn't consistent (e.g. `PKG_CONFIG_PATH`
still affected cross builds).