6.1.2.13. MesonIntegration

Use Meson for analysis compilation

This rule calls Meson with the specified options.

Alternatively, you can use the CompileCommandsIntegration rule as a subsequent build step when using the generated compile_commands.json and disabling execute_build.

At least one of execute_setup or execute_build have to be set to true.

Options

The following places define options that affect this rule: BuildSystemIntegration, Project-GlobalOptions

abort_on_error

abort_on_error : bool = True

If set to true and the build step returns a non-zero exit-code, the build is aborted. Otherwise a non-zero exit-code is logged but the build continues.
 

backend

backend : Backend | str = 'ninja'

Meson build system backend to use (Meson option --backend).

When selecting predefined backend ninja, then set building with execute_build set to true is supported.

For Visual Studio backends you need to disable execute_build and use a subsequent MSBuildIntegration build step with the main .vcxproj and/or .sln file configured.

 

build_directory

build_directory : bauhaus.analysis.config.ProjectRelativePath = 'build'

Path to directory which Meson will use as the root of build directory.
 

build_environment

build_environment

Type: dict[str, str]

Default:

{
   'COMPILE_ONLYIR': '1'
}

Environment for the call to Meson for building the project. These entries will be added to the ones in environment and take priority if the same keys are set.

Only relevant at all, if execute_build is set to true.

 

build_options

build_options : str | None = None

Additional command-line parameters for the call to Meson for building the project. These options will be added to the ones in options later on the command-line.

Only relevant at all, if execute_build is set to true.

 

capture_output

capture_output : bool = False

Sets whether the shell output of the step should be captured. Note that only the output of the build step will be captured and not the output of possible clean steps.

The output will be parsed according to the format configured with the options output_format, stdout_format, stderr_format.

 

environment

environment : dict[str, str] = {}

Environment for all calls to Meson. These entries are added to the environment and existing ones will be overwritten.

E.g.:

  • CCACHE_DISABLE=1 (to disable CCache)

 

execute_build

execute_build : bool = True

If set, also start the build using meson compile (which may or may not work that way). Otherwise you need to add another build step to call a correctly configured build tool after Meson setup.

 

execute_setup

execute_setup : bool = True

If set, runs the setup phase with the configured options.

This option should be left enabled for almost all cases, except if you only want to execute the build in an already configured build_directory.

 

options

options : str | None = None

Additional command-line parameters for all calls to Meson.
 

output_format

output_format : list[str] = ['generic']

Name of the format(s) describing the output pattern to capture from stdout/stderr.

The format names available here correspond to the provider options in /Analysis/AnalysisControl/ExternalAnalysisFormats.

This option only has an effect if capture_output is true.

 

setup_environment

setup_environment

Type: dict[str, str]

Default:

{
   'AR': 'irAR',
   'AS': 'irCC',
   'BAUHAUS_IR_COMPRESSION': 'none',
   'CC': 'irCC',
   'COMPILE_ONLY': '1',
   'CXX': 'irCXX',
   'OBJCOPY': 'irOBJCOPY',
   'OBJDUMP': 'irOBJDUMP',
   'SIZE': 'irSIZE',
   'STRIP': 'irSTRIP'
}

Environment for the call to Meson for setup of the project build system. These entries will be added to the ones in environment and take priority if the same keys are set.

 

setup_options

setup_options : str | None = None

Additional command-line parameters for the call to Meson for setup of the project build system. These options will be added to the ones in options later on the command-line.

 

setup_variables

setup_variables : dict[str, str] = {}

Meson variables to configure.

Those variables will be converted to -DKEY=VALUE switches and precede options on the command-line.

 

source_directory

source_directory : bauhaus.analysis.config.ProjectRelativePath | None = None

Path to root directory of the Meson project to build. If unset, defaults to /Project/directory.
 

stderr_format

stderr_format : list[str] = []

Name of the format(s) describing the output pattern to capture from stderr. This takes precedence over output_format if set.

The format names available here correspond to the provider options in /Analysis/AnalysisControl/ExternalAnalysisFormats.

This option only has an effect if capture_output is true.

 

stdout_format

stdout_format : list[str] = []

Name of the format(s) describing the output pattern to capture from stdout. This takes precedence over output_format if set.

The format names available here correspond to the provider options in /Analysis/AnalysisControl/ExternalAnalysisFormats.

This option only has an effect if capture_output is true.

 

toolname

toolname : bauhaus.analysis.config.PlainPath = 'meson'

Meson command-line tool to call.
 

Option Types

These types are used by options listed above:

Backend

An enumeration.
 

ninja

Generates build.ninja files.

vs2015

Generates Visual Studio 2015 project files.

vs2017

Generates Visual Studio 2017 project files.

vs2019

Generates Visual Studio 2019 project files.

vs2022

Generates Visual Studio 2022 project files.