Mesonο
The Meson() build helper is intended to be used in the build() and package() methods, to call Meson commands automatically.
from conan import ConanFile
from conan.tools.meson import Meson
class PkgConan(ConanFile):
def build(self):
meson = Meson(self)
meson.configure()
meson.build()
def package(self):
meson = Meson(self)
meson.install()
Referenceο
- class Meson(conanfile)ο
This class calls Meson commands when a package is being built. Notice that this one should be used together with the
MesonToolchaingenerator.- Parameters:
conanfile β
< ConanFile object >The current recipe object. Always useself.
- configure(reconfigure=False)ο
Runs
meson setup [FILE] "BUILD_FOLDER" "SOURCE_FOLDER" [-Dprefix=/]command, whereFILEcould be--native-file conan_meson_native.ini(if native builds) or--cross-file conan_meson_cross.ini(if cross builds).- Parameters:
reconfigure β
boolvalue that adds--reconfigureparam to the final command.
- build(target=None)ο
Runs
meson compile -C . -j[N_JOBS] [TARGET]in the build folder. You can specifyN_JOBSthrough the configuration linetools.build:jobs=N_JOBSin your profile[conf]section.- Parameters:
target β
strSpecifies the target to be executed.
- install(cli_args=None)ο
Runs
meson install -C "." --destdir ..in the build folder.- Parameters:
cli_args β List of arguments to be added to the command:
meson install -C "." --destdir ... arg1 arg2
- test()ο
Runs
meson test -v -C "."in the build folder.
confο
The Meson build helper is affected by these [conf] variables:
tools.meson.mesontoolchain:extra_machine_files=[<FILENAME>]configuration to add your machine files at the end of the command using the correct parameter depending on native or cross builds. See this Meson reference for more information.tools.compilation:verbositywhich accepts one ofquietorverboseand sets the--verboseflag inMeson.build()tools.build:verbositywhich accepts one ofquietorverboseand sets the--quietflag inMeson.install()tools.build:install_strip(Since Conan 2.18.0; list values since Conan 2.28.0): when enabled for Meson, passes--striptomeson install. UseTrueso every integration that reads this configuration may strip; use a list such as["meson"]so only the Meson helper strips.Falseor an unset value disables stripping in this helper.