Make sure generic options are always inserted.#6867
Conversation
Summary of ChangesHello @Redbeanw44602, 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 addresses a bug and significantly improves code maintainability within the CMake package tool module. It ensures that essential generic CMake configuration options are always correctly applied across various build environments, specifically fixing an oversight for Apple OS and MinGW. The changes also refactor the configuration retrieval logic, centralizing the application of these generic options and eliminating duplicate code, leading to a more robust and cleaner codebase. 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.
Code Review
This pull request aims to refactor CMake configuration generation by centralizing generic options, which is a good goal. However, the current implementation introduces a critical bug across several platform-specific configuration functions (_get_configs_for_appleos, _get_configs_for_mingw, _get_configs_for_wasm, _get_configs_for_cross, _get_configs_for_host_toolchain). In each case, the refactoring causes the platform-specific CMake environment variables to be discarded, which will likely break compilation for those platforms.
The root cause is that _get_configs_for_generic creates its own envs table and doesn't use the one from its caller. My review comments provide a consistent fix: refactor _get_configs_for_generic to accept an envs table, populate it with generic options, and then use it to generate the CMake arguments. This will correctly merge platform-specific and generic options.
|
当初这个接口里,还有对 flags 的处理,所以不同平台,有的调了,cross 里没用。 不过 dev 中 flags 的处理已经剥离掉了,只剩一些通用配置,那这个接口,你可以在 _get_configs 里面统一调用,不用每个平台里去加 xmake/xmake/modules/package/tools/cmake.lua Lines 402 to 436 in 0db4fe6 |
In the original interface, there was also the processing of flags, so some of them were adjusted on different platforms, but they were useless in cross. However, the processing of flags in dev has been stripped and adjusted. You can call this interface in _get_configs without adding it to each platform. xmake/xmake/modules/package/tools/cmake.lua Lines 402 to 436 in 0db4fe6 |
OK了 |
OK |
Currently, the package.tools.cmake has not yet inserted generic options for appleos/mingw (such as
CMAKE_BUILD_TYPE,BUILD_SHARED_LIBS, etc). I think this may be a bug.This patch also makes
_get_configs_for_crosscall_get_configs_for_genericand removes the duplicate logic.