Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does meson has a general function to print out any type variables's value?

Tags:

meson-build

I've encountered some projects which uses meson to organize their building system. But when I want to debug their building system, I found it's difficult. The most important task is observing the building system's variable during its running. I could use message() function to show the variables of types, e.g.

integer
string
lists (of string/integer/lists)

But if the variable is dictionary type, the message() will refuse to display any information in the variable.

Does meson have a general function to display any type's variable just like python's print() function? If not, do we have any solution to do this?

Thanks in advance.

like image 979
Clock ZHONG Avatar asked Jan 29 '26 15:01

Clock ZHONG


2 Answers

It is probably hard for the maintainers of meson to print out every object that is available in the meson.build script.

deps = []

# add some dependencies to the deps list or obtain the deps elsewhere

message('the depencies are: ')
foreach dep : deps
    message(' - ', dep.name())
endforeach

For me this results in:

Message: the depencies are: 
Message:  -  glib-2.0
Message:  -  gobject-2.0
Message:  -  gtk4
Message:  -  epoxy

You can't print/message a dependency, but you can print the name of the dependency :-)

like image 65
hetepeperfan Avatar answered Feb 01 '26 02:02

hetepeperfan


You can print any object with:

message('@0@'.format(f))

Source: https://github.com/mesonbuild/meson/issues/9575#issuecomment-969053569

like image 21
Steve Chavez Avatar answered Feb 01 '26 02:02

Steve Chavez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!