-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
define QT_DEBUG or QT_NO_DEBUG depending on build type #15060
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
base: master
Are you sure you want to change the base?
Conversation
mesonbuild/dependencies/qt.py
Outdated
|
||
def _get_common_defines(self) -> T.List[str]: | ||
is_debug = self.env.coredata.optstore.get_value_for("debug") | ||
return ["-DQT_DEBUG" if is_debug else "-DQT_NO_DEBUG"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single quotes, as that is most commonly used in the meson codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed thanks
unfortunately I will need help for macos support. |
I think this happens because the qmake finder checks for macOS, and runs |
], | ||
"debug": [ | ||
{ "val": "true" }, | ||
{ "val": "false" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will result in running the entire Qt tests six times instead of three, which is pretty heavyweight..I suggest instead defining the executable twice with override_options: ['debug=true']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I passed override_options as arguement to executable, but it looks like it is too late, and the qt dependency was already found, and the define is already computed. So that does not work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should just make a separate test project that just builds this single executable?
I moved the call to get_common_defines before framework_detect, we'll see what CI says. Unfortunately it cannot be in the init of _QtBase because the other constructor of the mixin overwrites self.compile_args later. |
to mimick what qmake does. Fixes: mesonbuild#15059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation here looks good, I know Eli has some questions about testing that need to be resolved, but the actual code looks good. Thanks for writing the patches!
unfortunately I don't know how to fix that. The suggestion does not work. Unless you have a better idea, either we can leave it this way or remove the test. |
That feels somewhat awkward and inconsistent then. If debug can be overridden per target but it only affects -g and not flags set by the dependency, then it feels like a slightly sticky situation. I agree that I'm not actually sure how to solve this... |
That almost feels like a design issue in the I wonder if this is a place to just put a warning and punt? |
tbh with the current structure of the code, debug = true + method = pkg-config follows a different code path than debug = true + method = qmake so the six runs of the qt test actually add value. On my 16 cores machine with only qt5, removing the test I added saves only 3 seconds. So maybe this code is acceptable? what do you think? |
I see two issues with this change. The less severe one is that this is a backward incompatible change. The most important one is that the defines are not added accordingly to the executable('foo', 'foo.cc', cpp_args: [get_option('debug') ? '-DQT_DEBUG' : '-DQT_NO_DEBUG']) does not seem so bad to me. |
the main issue with |
Please also note that the current code of the qt dependency already makes decisions depending on the global debug option here meson/mesonbuild/dependencies/qt.py Line 300 in 9ca2764
|
I suspect we have other dependencies that are broken in similar ways. I don't see how you would solve this except by having some kind of dynamic getters, but there we run up against the potential issue of ending up with both debug and !debug in the same dependency graph. |
to mimick what qmake does.
Fixes: #15059
cc @dcbaker