-
Notifications
You must be signed in to change notification settings - Fork 311
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
enforce cmake-format and cmake-lint #4889
Conversation
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
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 -- just a few small nits and nothing blocking. Need to run pre-commit
to update the copyrights in the formatted files, too
Co-authored-by: Gil Forsyth <[email protected]>
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.
Hmm, looks like cmake-format formatted something extra, though |
OPTIONS | ||
"BUILD_BENCHMARKS OFF" | ||
"BUILD_TESTS OFF" | ||
) |
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 doesn't look right to me, I must have mistake in the config, sorry 😬
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.
sorry @gforsyth , let me take this back into draft and reduce the size of this diff. I should have done that from the beginning.
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.
All good!
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.
Ok I think it's looking better, could you check again?
I:
- told
cmake-format
not to touch comments: enforce cmake-format and cmake-lint #4889 (comment) - described
rapids_cython_create_modules()
to it so it'd stop trying to squish all the keyword arguments onto 1 line: enforce cmake-format and cmake-lint #4889 (comment)
"markup": { | ||
"enable_markup": 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 says "don't modify any comments"
ref: https://cmake-format.readthedocs.io/en/latest/configuration.html
"rapids_cython_create_modules": { | ||
"kwargs": { | ||
"SOURCE_FILES": "?", | ||
"LINKED_LIBRARIES": "?", | ||
"MODULE_PREFIX": "?", | ||
"ASSOCIATED_TARGETS": "?" | ||
} | ||
} | ||
} |
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.
Telling cmake-format
the signature of this function helps it to split keyword arguments out one per line.
/ok to test |
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 hate to expand scope on you too much, so feel free to push back, but since this kind of change is fairly low priority I think it's OK to delay it and take the opportunity to create a new hook in our repo encapsulating the logic we use to wrap the base cmakelang hooks. Presumably we're always going to want the same things: support for rapids-cmake functions (hopefully via some smarter fetching of the format file than the somewhat naive version I wrote for this hook originally in cudf), support for some extra functions like those from CPM or commonly defined functions in RAPIDS like ConfigureTest/ConfigureBench, the same "soft" failure behavior, etc. When I originally filed rapidsai/cudf#9484, and especially after we created https://github.com/rapidsai/pre-commit-hooks/ I had hoped we could generalize the cudf hook rather than copy it wholesale into every RAPIDS repo.
If preferred, we could also merge this PR and then work on the generalized hook afterwards, I just don't want to forget that we should probably do it.
Ok sure. Given that comment and rapidsai/cuspatial#1516 (comment), I'll rip out the CMake formatting part of rapidsai/build-planning#136 completely and put that into a different issue about finding a better long-term pattern that doesn't involve so much copying for files around the repos. I'd only included it here because I'd made similar changes in response to recent reviews on the C++ wheels @gforsyth sorry to close a PR you spent time reviewing, thank you very much for doing that. |
Opened rapidsai/pre-commit-hooks#62 for that separate discussion about a better long-term pattern for CMake formatting. |
Contributes to rapidsai/build-planning#136
Proposes using
cmake-format
andcmake-lint
here to standardize CMake code style, similar to the way that other RAPIDS libraries do.The new files
cpp/scripts/run-cmake-format.sh
andcpp/cmake/config.json
were borrowed and then lightly adapted from cuDF (code link).All changes in
CMakeLists.txt
and.cmake
files here were made automatically bycmake-format
, like this: