Skip to content

Update cmake_importfiles.lua#6880

Merged
waruqi merged 3 commits intoxmake-io:devfrom
luadebug:fix-sizeof-cross
Oct 2, 2025
Merged

Update cmake_importfiles.lua#6880
waruqi merged 3 commits intoxmake-io:devfrom
luadebug:fix-sizeof-cross

Conversation

@luadebug
Copy link
Member

@luadebug luadebug commented Oct 1, 2025

xmake-io/xmake-repo#8277 (comment)

XMake has issues during auto-generation of CMakeConfigs for cross 32 bit builds it keeps claiming that is 64 bit one CMakeConfig.
xmake-io/xmake-repo#8280 (minizip)
xmake-io/xmake-repo#8277 (imgui)

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @luadebug, 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 refines the cmake_importfiles.lua module by modernizing the logic for calculating pointer sizes. By replacing a hardcoded architecture check with a more dynamic and robust function call, the change ensures that generated CMake configuration files accurately reflect the pointer size for various target platforms without requiring manual updates for new architectures. This improves the flexibility and future-proofing of the build system.

Highlights

  • Improved Pointer Size Detection: The method for determining the TARGET_PTRBYTES variable in CMake import files has been updated from a static list of architectures to a dynamic target:check_sizeof("void*") call, enhancing accuracy and maintainability.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 improves the generation of CMake import files by replacing a hardcoded list of 32-bit architectures with a dynamic check using target:check_sizeof("void*"). This makes the determination of the target pointer size much more robust and correct. I've added one medium-severity comment regarding the potential for this check to be run during the install phase, which could be a performance concern. However, this is a minor design point, and the overall change is a significant improvement in correctness and maintainability.

TARGETKIND = target:is_headeronly() and "INTERFACE" or (target:is_shared() and "SHARED" or "STATIC"),
PACKAGE_VERSION = target:get("version") or "1.0.0",
TARGET_PTRBYTES = target:is_arch("armeabi", "armeabi-v7a", "x86", "mips", "i386", "armv7", "armv7s", "mipsel", "wasm32") and "4" or "8"}
TARGET_PTRBYTES = target:check_sizeof("void*")}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using target:check_sizeof is a great improvement for correctness over the previous hardcoded list. However, since this is a detection function, it may trigger a compilation during the install phase if its result is not already cached. This can be slow and might be surprising to users. For future improvement, consider if this value can be reliably determined and cached during the configuration phase, so that it can be retrieved here without performing a check.

luadebug added a commit to luadebug/xmake-repo that referenced this pull request Oct 1, 2025
luadebug added a commit to xmake-io/xmake-repo that referenced this pull request Oct 1, 2025
* gettext: add mirror for xmake-io/xmake#6880

* fixup

* fixup

* Update xmake.lua
luadebug added a commit to HuiYuanXin13/xmake-repo that referenced this pull request Oct 1, 2025
@waruqi waruqi merged commit 553ecea into xmake-io:dev Oct 2, 2025
22 checks passed
@waruqi waruqi added this to the v3.0.4 milestone Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants