-
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
set jobs parameter in cmake build presets(#15419) #15422
set jobs parameter in cmake build presets(#15419) #15422
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.
Looks good and low risk. A small unit/integration test (not really necessary a functional one) could be enough to move this forward (I have checked with the team, good to move it)
conan/tools/cmake/presets.py
Outdated
@@ -6,6 +6,7 @@ | |||
from conan.tools.cmake.layout import get_build_folder_custom_vars | |||
from conan.tools.cmake.toolchain.blocks import GenericSystemBlock | |||
from conan.tools.cmake.utils import is_multi_configuration | |||
import conan.tools.build as build |
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.
Better import directly build_jobs
, we are not using scoping in general.
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.
updated
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.
Great, thanks.
Did you check my comment above?
Looks good and low risk. A small unit/integration test (not really necessary a functional one) could be enough to move this forward (I have checked with the team, good to move it)
Do you think you can add some small test, it seems in https://github.com/conan-io/conan/blob/develop2/conans/test/integration/toolchains/cmake/test_cmaketoolchain.py would be the best, some of the existing ones can help? If not let me know and I'll do it
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.
would be great if you could do it :)
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 contributed the test, and also moved the definition to the "common" preset, so it also applies to the testPresets
. I understand that we also want to do it, in the same way it affects also the CMake.test()
helper?
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.
thanks for the test. very good choice of parallel jobs ;)
this should not be added to the testPresets. I do not have deep enough CMake knowledge to know why, but cmake cannot parse the same jobs parameter in the testPresets.
example invalid presets sections
"buildPresets": [
{
"name": "conan-debug",
"configurePreset": "conan-debug",
"jobs": 16
}
],
"testPresets": [
{
"name": "conan-debug",
"configurePreset": "conan-debug",
"jobs": 16
}
]
produces the following error
$ cmake --build --target all --preset conan-relwithdebinfo
CMake Error: Could not read presets from <path to root directory>:
Error: @36,21: Invalid extra field "jobs" in Preset
"jobs": 16
^
it builds in parallel with "jobs": 16 in only the buildPresets, and more importantly does not fail to read the presets.
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 see, yeah, lets remove it!
I'll leave jobs=42 (the answer to everything ;) only for buildPresets
Merged, it will be in next 2.1, thanks for your contribution! |
Changelog: Feature:
CMakeToolchain
definesjobs
in generatedCMakePresets.json
buildPresets.Docs: Omit
this should be seen as a proof of concept for the feature request to have conan generate CMakePresets.json with jobs parameter set.
closes #15419
develop
branch, documenting this one.