Skip to content

Conversation

luadebug
Copy link
Contributor

@luadebug luadebug commented Sep 30, 2025

Drop old version. Keep only latest version for now.

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 primarily focuses on upgrading the omath library to version 3.8.1 and integrating it seamlessly into the existing build system. It introduces specific build patches to resolve compatibility issues, particularly concerning imgui dependency resolution and compiler flags for different platforms like WebAssembly. The changes also refine the xmake.lua configuration to manage these updates and ensure a more robust and adaptable build process.

Highlights

  • omath Version Update: The omath library has been updated to version 3.8.1.
  • New Build Patches Introduced: Two new patch files, fix-build.patch for v3.0.3 and v3.8.1, have been added to address specific build issues within the omath CMake configuration.
  • CMakeLists.txt Modifications (via patches): The imgui linking in CMakeLists.txt now utilizes PkgConfig for improved dependency resolution, and Clang compile options are conditionally applied for EMSCRIPTEN builds (adding -msimd128) and general builds (using -mavx2 -mfma). Additionally, add_subdirectory(extlibs) is removed for v3.8.1.
  • xmake.lua Configuration Refinements: The xmake.lua file has been updated to explicitly apply the new build patches, conditionally enable AVX2 based on the target architecture (disabling for ARM), and remove redundant direct CMakeLists.txt modifications.
  • Test Suite Enhancement: The on_test function in xmake.lua now uses conditional includes for omath headers, making the test more robust across different omath configurations.
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 updates the omath package to version 3.8.1. The changes include adding the new version and its build patch, refactoring the package script to use add_patches instead of io.replace for cleaner modifications, and making the build configuration more robust by conditionally enabling AVX2 support only on compatible architectures. Overall, these are good improvements. I have one major concern regarding a potentially missing patch for the new v3.8.1 which could cause build failures. Please see my detailed comment.

@luadebug luadebug changed the title omath:update to 3.8.1 omath: update to 3.8.1 Sep 30, 2025
@luadebug
Copy link
Contributor Author

/gemini review

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 updates the omath package to version 3.8.1. The changes to xmake.lua are well-executed, correctly updating the version, adding a necessary build patch, and simplifying the installation logic. The new build patch improves the build process by dynamically detecting AVX2 support. However, I've identified a critical logic error in the patch concerning the application of AVX2 compiler flags, which would cause AVX2 to be disabled on MSVC builds. I have provided a detailed comment with a suggested fix for this issue.

@luadebug
Copy link
Contributor Author

/gemini review

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 updates the omath package to version 3.8.1. The changes involve adding a patch to fix the build process for the new version and updating the xmake.lua file accordingly. The patch correctly detects AVX2 support and sets compiler flags, though there are some redundant flags that could be removed for clarity. The xmake.lua file is simplified, but contains an incorrect architecture check for enabling the AVX2 option, which should be restricted to x86/x86_64 architectures. Overall, a good update with a few areas for improvement.

@luadebug
Copy link
Contributor Author

/gemini review

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 updates the omath package to version 3.8.1, removing the older version and simplifying the build script. The update includes a patch to improve the CMake build process, particularly for AVX2 detection and compiler flag handling. Additionally, a fix is introduced for the imgui package to correctly handle 32-bit cross-compilation by patching its generated CMake configuration file. My review includes a suggestion to refactor a small part of the imgui fix to improve code readability and maintainability.

@luadebug
Copy link
Contributor Author

/gemini review

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 updates the omath package to version 3.8.1 and removes the previous version. The changes include adding a patch to fix the build for the new version and simplifying the xmake.lua script for omath. Additionally, a fix for 32-bit cross-compilation has been added to the imgui package. The changes for omath are well-implemented and improve the package definition. However, I've found a high-severity issue in the imgui package change where a string replacement is incorrect and has no effect, which I've detailed in a specific comment.

@luadebug luadebug requested a review from waruqi September 30, 2025 20:49
@luadebug
Copy link
Contributor Author

luadebug commented Sep 30, 2025

BTW #8280 has similiar issue but not for imgui but for minizip.
I am pretty sure workaround for that case similiar to imgui for this PR:

error: @programdir/core/sandbox/modules/os.lua:273: CMake Error at CMakeLists.txt:316 (find_package):
  Could not find a configuration file for package "minizip" that is
  compatible with requested version "".

  The following configuration files were considered but not accepted:

    /home/runner/.xmake/packages/m/minizip/v1.2.13/f067aec52be74dbca44545ce4382d6ca/lib/cmake/minizip/minizipConfig.cmake, version: 1.0.0 (64bit)



ompiler identification is GNU 13.3.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/runner/work/xmake-repo/xmake-repo/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /home/runner/.xmake/packages/z/zlib/v1.3.1/f19d02983c2441c481b4cbe5802d62c1/lib/libz.a (found suitable version "1.3.1", minimum required is "1.2.8")
-- Configuring incomplete, errors occurred!

stack traceback:
    [C]: in function 'error'
    [@programdir/core/base/os.lua:1085]:
    [@programdir/core/sandbox/modules/os.lua:273]:
    [@programdir/core/sandbox/modules/os.lua:291]: in function 'vrunv'
    [@programdir/modules/package/tools/cmake.lua:1310]: in function 'configure'
    [@programdir/modules/package/tools/cmake.lua:1352]: in function 'install'
    [...xmake-repo/xmake-repo/packages/l/libxlsxwriter/xmake.lua:84]: in function 'script'
    [...dir/modules/private/action/require/impl/utils/filter.lua:114]: in function 'call'
    [.../modules/private/action/require/impl/actions/install.lua:472]:

  => install libxlsxwriter v1.2.3 .. failed

@luadebug
Copy link
Contributor Author

luadebug commented Oct 1, 2025

/gemini review

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 updates the omath package to version 3.8.1, removing the previous version. The changes include adding a patch to improve the CMake build process, particularly for AVX2 detection and compiler flag handling, which enhances portability. The package's xmake script is also cleaned up, removing old workarounds and improving the test snippet.

Additionally, a fix for 32-bit cross-compilation has been added to the imgui package. My review includes a minor suggestion to simplify this fix by removing a redundant line.

Overall, the changes are well-structured and improve the robustness and maintainability of the omath package.


os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
import("package.tools.xmake").install(package, configs)
local config_version_file = path.join(package:installdir("lib"), "cmake", "imgui", "imguiConfigVersion.cmake")
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think modifying the cmake config file in the package description is the right choice. If modifications are needed, then a PR should be submitted to xmake. If the cmake config is unstable, pkgconfig should be prioritized instead.

Copy link
Contributor Author

@luadebug luadebug Oct 1, 2025

Choose a reason for hiding this comment

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

imgui cmake config was supposed to be stable, the problem is that XMake repository itself need fix for auto-generated CMakeConfigs during cross build as I show that so expected fix here is to improve auto-generation mechanism itself, we would just keep getting similiar issue over and over as #8280 minizip auto-generate cmake config for cross?

add_rules("utils.install.cmake_importfiles") is what generate 64 bit instead of 32 bit for cross builds.

Copy link
Contributor

Choose a reason for hiding this comment

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

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