Environment variables¶
Environment variables can be used to influence meson-python’s behavior, as
well as the behavior of Meson and other tools that may be used during the
build. This page lists all the environment variables directly used by
meson-python.
Meson recommends using command line arguments instead of environment variables, but does support a number of environment variables for compatibility with other build systems:
Other environment variables may influence how other tools used during the setup
or build steps operate. For example, pkg-config supports
PKG_CONFIG_PATH which influences the search path for .pc files
describing the available dependencies.
Warning
Conda sets a number of environment variables during environment activation
for compiler/linker selection (CC, CXX, FC, LD) and
compile/link flags (CFLAGS, CXXFLAGS, FFLAGS, LDFLAGS) when
compilers are installed in a conda environment. This may have unexpected
side effects (see for example the note in
Using debug builds).
Environment variables used by meson-python¶
- ARCHFLAGS¶
This environmental variable is used for supporting architecture cross compilation on macOS in a way compatible with setuptools. It is ignored on all other platforms. It can be set to
-arch arm64or to-arch x86_64for compiling for the arm64 and the x86_64 architectures respectively. Setting this environment variable to any other value is not supported.The macOS toolchain allows architecture cross compilation passing the
-archflat to the compilers.meson-pythoninspects the content of this environment variable and synthesizes a Meson cross build definition file with the appropriate content, and passes it tomeson setupvia the--cross-fileoption.Support for this environment variable is maintained only for compatibility with existing tools, cibuildwheel in particular, and is not the recommended solution for cross compilation.
- FORCE_COLOR¶
Setting this environment variable to any value forces the use of ANSI escape sequences to colorize the
meson-python’s console output. Setting bothNO_COLORandFORCE_COLORenvironment variables is an error.
- MACOSX_DEPLOYMENT_TARGET¶
This environment variables is used of specifying the target macOS platform major version to the Xcode development tools. If this environment variable is set,
meson-pythonwill use the specified macOS version for the Python wheel platform tag instead than the macOS version of the build machine.This variable must be set to macOS major versions only:
10.9to10.15,11,12,13, …Please note that the macOS versioning changed from macOS 11 onward. For macOS 10, the versioning scheme is
10.$major.$minor. From macOS 11 onward, it is$major.$minor.$bugfix. Wheel tags and deployment targets are currently designed to specify compatibility only with major version number granularity.Another way of specifying the target macOS platform is to use the
-mmacosx-version-mincompile and link flags. However, it is not possible formeson-pythonto detect this, and it will not set the Python wheel platform tag accordingly.
- MESON¶
Specifies the
mesonexecutable or script to use. It overridestool.meson-python.meson. See Project settings for more details.
- MESONPY_EDITABLE_VERBOSE¶
Setting this environment variable to any value enables directing to the console the messages emitted during project rebuild triggered by imports of editable wheels generated by
meson-python. Refer to the Editable installs guide for more information.
- NINJA¶
Specifies the ninja executable to use. It can also be used to select ninja alternatives like samurai.
- NO_COLOR¶
Setting this environment variable to any value disables the use of ANSI terminal escape sequences to colorize
meson-python’s console output. Setting bothNO_COLORandFORCE_COLORenvironment variables is an error.