mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.54k stars 1.61k forks source link

Qt5 preprocessed files missing in mesonintrospect --target-files #1686

Open hasselmm opened 7 years ago

hasselmm commented 7 years ago

I love how Meson straightly considers IDEs and provides mesonintrospect!

Still, shouldn't "mesonintrospect --target-files" also list preprocessed files? I definitely want resource files, forms and headers to show up in my IDE.

jpakkane commented 7 years ago

We should probably get source files transitively from generators, yes. It might take some work, thouh, in the mean time you can work around the issue by by also adding them to extra_files in the target.

Thinking a bit more I'm not sure we actually test for that. If it does not work then it is a bug.

hasselmm commented 7 years ago

Actually wondering if it wouldn't make everyone's life easier if Meson would follow the lead of modern CMake. There simply all files are added to each target's source list and the generators then implicitly rewrite this list to their needs:

add_executable(myapp SOURCES main.cpp mainwindow.cpp mainwindow.ui translations.qrc)

Might be much easier to implement in Meson and makes the life of tools like mesonrewrite much easier.

jpakkane commented 7 years ago

Our goal is to have as little "magic" as possible and prefer being explicit to implicit. The problem with these kinds of things is that you'd need to scan the contents of all headers in order to know whether they need to be preprocessed with moc or not (preprocessing all headers all the time is slow and wasteful). It also does not work well if you have two different header preprocessors and you need to pass some subsection of headers to one and some to another.

hasselmm commented 7 years ago

Tried the extra_files approach, fails because list_target_files() of mesonintrospect doesn't expect plain strings in t.sources + t.extra_files:

$ mesonintrospect --target-files testclient@exe
Traceback (most recent call last):
  File "/usr/bin/mesonintrospect", line 20, in <module>
    sys.exit(mintro.run(sys.argv[1:]))
  File "/usr/share/meson/mesonbuild/mintro.py", line 235, in run
    list_target_files(options.target_files, coredata, builddata)
  File "/usr/share/meson/mesonbuild/mintro.py", line 113, in list_target_files
    sources = [os.path.join(i.subdir, i.fname) for i in sources]
  File "/usr/share/meson/mesonbuild/mintro.py", line 113, in <listcomp>
    sources = [os.path.join(i.subdir, i.fname) for i in sources]
AttributeError: 'str' object has no attribute 'subdir'