-
Notifications
You must be signed in to change notification settings - Fork 50
[CMake] Enable automatic cmake config discovery #124
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
Conversation
Summary of ChangesHello @Ubospica, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the usability and integration of Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request makes a valuable improvement by relocating the CMake configuration files to a standard directory, which enables automatic discovery by CMake's find_package. This simplifies the integration for downstream projects, as demonstrated by the cleanup in the example files. The addition of editable.rebuild = false is also a nice touch for improving the developer workflow during editable installs.
My review found one issue in python/tvm_ffi/libinfo.py where the path to the new CMake directory is constructed incorrectly for standard installations. I've left a specific comment with a suggested fix. Otherwise, the changes are well-implemented and align with the stated goals.
|
Nice work!! I was about to ask :) |
|
note that this unfortunately does not work for cmake that is outside of scikit build part, so we still need to keep the cmake path for max compact |
Relocate CMake config files from
cmake/toshare/cmake/tvm_ffi/to matchCMake's standard search pattern
<prefix>/<name>*/share/cmake/<name>*/.This enables
find_package(tvm_ffi CONFIG REQUIRED)to work automaticallywithout manually setting
tvm_ffi_ROOT.When
find_package(Python)is called, CMake addssys.prefixto search paths,allowing it to discover tvm-ffi's config files in the standard location.
This also aligns with pybind's behavior. See also https://github.com/pybind/pybind11/blob/a2c59711b20707d64b7ad61d488e002611369780/.github/CONTRIBUTING.md#L325 and https://github.com/pybind/pybind11/blob/a2c59711b20707d64b7ad61d488e002611369780/pybind11/commands.py#L22.
Changes:
share/cmake/tvm_ffi/find_cmake_path()to check standard path firstfind_package()This PR also avoids rebuilding in editable installation mode, and adds a cd command in the readme of examples to ensure user is in the correct directory.