-
Notifications
You must be signed in to change notification settings - Fork 991
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
[MesonToolchain] Showing a warning message if raw options are used #14692
[MesonToolchain] Showing a warning message if raw options are used #14692
Conversation
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.
If this hasn't been released yet, just remove the Changelog
in both PRs
Keeping only the feature about showing the warning message |
Is it expected that boolean options display this warning? In dav1d recipe, there is this warning now:
Though, in recipe, there is: options = {
"shared": [True, False],
"fPIC": [True, False],
"bit_depth": ["all", 8, 16],
"with_tools": [True, False],
"assembly": [True, False],
"with_avx512": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"bit_depth": "all",
"with_tools": True,
"assembly": True,
"with_avx512": False,
}
(...)
def generate(self):
env = VirtualBuildEnv(self)
env.generate()
tc = MesonToolchain(self)
tc.project_options["enable_tests"] = False
tc.project_options["enable_asm"] = self.options.assembly
if Version(self.version) < "1.0.0":
tc.project_options["enable_avx512"] = self.options.get_safe("with_avx512", False)
tc.project_options["enable_tools"] = self.options.with_tools
if self.options.bit_depth == "all":
tc.project_options["bitdepths"] = "8,16"
else:
tc.project_options["bitdepths"] = str(self.options.bit_depth)
tc.generate() So why this warning? I though that boolean values were properly converted, unlike string. I don't understand why there can't be an automated conversion of PackageOption like in CMakeToolchain which has: elif isinstance(value, _PackageOption):
if str(value).lower() in ["true", "false", "none"]:
cache_variables[name] = "ON" if bool(value) else "OFF"
elif str(value).isdigit():
cache_variables[name] = int(value)
else:
cache_variables[name] = str(value) I would have expected such fix for #14453, to get consistent behavior of toolchains. |
Yes, it is expected. The options have to be explicitly converted to |
But why this inconsistency between CMakeToolchain and MesonToolchain? CMakeToolchain converts PackageOption evaluated as boolean or digits or string to their CMake format, but not MesonToolchain. It's weird. |
I see that @RubenRBS had the same concern #14633 (review) |
Indeed, I agree with both of you @SpaceIm and @RubenRBS. The thing is that I don't see the point of converting anything like CMakeToolchain is doing under the hood. Actually, it's doing that only for cache_variables and not for the rest of the variables so that's the weirdest thing. IMHO, we should not convert anything at all, and we should manage those conversions through the internal |
Related issue: #14590 |
Changelog: Feature: MesonToolchain shows a warning message if any options are used directly.
Docs: conan-io/docs#3381
Closes: #14453