conan icon indicating copy to clipboard operation
conan copied to clipboard

[feature] MesonToolchain custom binaries

Open theartful opened this issue 3 years ago • 3 comments

Meson can use the binaries section in the meson ini file for finding programs. See https://mesonbuild.com/Machine-files.html#binaries

Currently only a specific list of binaries are added c, cpp, objc, objcpp, c_ld, cpp_ld, ar, strip, as, windres, pkgconfig. It would be great if these were dictionary that allows any binary.

theartful avatar Aug 25 '22 14:08 theartful

Hi @hesham-essam

Sorry, but I don't know what you mean, and how it is related to Conan. Can you please put a full example of what you are suggesting? Starting with the conan hello/0.1 --template=meson_lib can be a good start for this.

memsharded avatar Aug 25 '22 14:08 memsharded

MesonToolchain generates conan_meson_native.ini. This file consists of a number of sections. One of these sections is [binaries], which specifies a number of programs for internal use of meson and for finding programs.

I would like not to edit the PATH environment variable for meson to find a specific executable, and instead provide it in the binaries section. For example, if I have a meson file that contains

glib_compile_resources = find_program('glib-compile-resources')

I would like to be able to do

    def generate(self):
        tc = MesonToolchain(self)
        tc.binaries["glib_compile_resources"] = "path/to/glib-compile-resources"
        tc.generate()

theartful avatar Aug 25 '22 14:08 theartful

Hi @hesham-essam

I recently opened a PR https://github.com/conan-io/conan/pull/12117 to let users define their own Meson files to be appended after the Conan ones. Those user files will override/complement the Conan ones. This feature is based on https://mesonbuild.com/Machine-files.html. I think it's better than adding another dictionary to avoid having many attributes inside the MesonToolchain.

franramirez688 avatar Sep 14 '22 14:09 franramirez688

Closed b yhttps://github.com/conan-io/conan/pull/12117, will be in Conan 1.55

memsharded avatar Nov 28 '22 15:11 memsharded