conan-package-tools
conan-package-tools copied to clipboard
Utility to verify if build configuration is OK
Please add a utility that will verify if build configuration is OK. For example, if the user will specify cppstd=20 for gcc-7 the builder will run and then conan will complain with the following message:
conans.errors.ConanException: The specified 'cppstd=20' is not available for 'gcc 7'. Possible values are ['11', '14', '17', '98', 'gnu11', 'gnu14', 'gnu17', 'gnu98']'
It would be nice to have the possibility to manually check and filter invalid configurations.
Hi @mpusz !
Actually, CPT only generates a matrix with all default settings and options. Conan is who checks if settings and options are supported.
To check if some the configuration is correct, we need to run Conan API, which means we will need to add conan info
What is your idea with this feature? I've used CPT for a long time, but I never thought about verifying before to build.
Hi,
Let's imagine that we want to multiplex the current build matrix containing common builds with all valid values of cppstd
:
builder.add_common_builds(pure_c=False)
new_builds = []
for settings, options, env_vars, build_requires, reference in builder.items:
for std in ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20"]:
new_settings = copy.copy(settings)
new_settings["cppstd"] = std
if not is_valid_configuration(new settings): # check if current compiler and its version supports that cppstd
continue
new_builds.append([new_settings, options, env_vars, build_requires])
builder.builds = new_builds
builder.run()
Doing is_valid_configuration()
manually in every build.py all over again would be counterproductive and error-prone. That is why I suggest having such a tool in a library, especially that such logic is implemented already.