-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use precompiled headers with non-standard locations of includes? #1415
Comments
It is similar (possibly even a duplicate) of #999 . But it doesn't make it solved. Can anyone tell me, is there any walkaround to this issue? My build use a lot of custom meta programming compile-time libraries, that take over 3s just to parse. |
Bump?... I understand you might be busy; Can you at least give me an idea, whether such a thing as pch of non-standard includes are on the roadmap and eventually will be supported? |
The fact that paths are not set up is a bug and we should fix that at some point. Unfortunately this ties into a different issue with PCH, that including non-system dependencies (i.e. ones that are part of the project and you edit) is a bit tricky due to potential staleness issues. The workaround currently is that you put the includes you want to precompile in the header file explicitly. This has the added bonus that it gives you one unambiguous location for what to put in each pch. But yes, eventually we should support your use case as well. |
Thank you very much for your answer. Do you mean replacing
It works in this test case, but fails if Do you have any workaround in my case? Maybe a custom compiler parameter that will manually point the right include directory? Or, theoretically I should be able to compile with a "custom compiler" that is a simple wrapper around the |
What I meant is that you put the following in your
Meson will then precompile those external headers. This works with external dependencies (Boost, Qt, others) just fine, just not with header files that you write yourself. So if you are doing heavy template metaprogramming development yourself, you can't (currently) precompile those headers (but since they change all the time, you probably don't even want to). The downside is that you need to write all headers you want to precompile into that header which might be duplicating information if you already have it in some other header. |
Thank you very much for the answer. Do you have any form of estimate when pre-compiling of custom headers will be implemented? Just order of magnitude will be fine, i.e. days, weeks, months or years. Thanks |
Why does this not work with headers in the project? It seems to be setting up DEPFILE correctly, such that modifying the custom header will recompile the pch. What's the case where this breaks? |
Fixed by #4860, please close. |
Consider the following example:
meson.build
:prog.cc
is the same as the example in the meson code:In header in subdirectory
include/myheader.h
single line, but in real life it would be much more complex:And the precompiled header
pch/prog.hh
The building fails with the following message:
It looks as if the compiler is ignoring my include directories. What did I do wrong?
The text was updated successfully, but these errors were encountered: