Skip to content

Conversation

@choyy
Copy link
Contributor

@choyy choyy commented Oct 21, 2025

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @choyy, 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 refactors the openblas package definition within xmake.lua by migrating its build system to CMake. This change simplifies the build and installation process across various platforms, replacing complex, platform-specific Makefile logic with a unified CMake-driven approach. The update also standardizes source URL management and introduces a richer set of configurable build options for OpenBLAS.

Highlights

  • Build System Migration: The OpenBLAS build process has been migrated from a custom Makefile-based system to CMake, simplifying cross-platform compilation and configuration.
  • Unified Source Management: OpenBLAS source URLs and version definitions have been consolidated, removing platform-specific download logic and adding support for version v0.3.30.
  • Enhanced Configuration Options: A comprehensive set of add_configs has been introduced for OpenBLAS, allowing granular control over features like LAPACK, CBLAS, dynamic architecture support, threading, and OpenMP during the build.
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 is an excellent refactoring of the OpenBLAS package, moving from a complex Makefile-based build to a unified CMake-based approach. This greatly simplifies the package script, improves maintainability, and expands build options for users. My review includes a couple of suggestions to enhance the robustness of the new configuration options by programmatically handling their inter-dependencies. This will help prevent invalid build configurations and improve the overall user experience.

@waruqi
Copy link
Member

waruqi commented Oct 22, 2025

remove old versions, it will break some user projects.

@choyy
Copy link
Contributor Author

choyy commented Oct 22, 2025

remove old versions, it will break some user projects.

Successful at all versions:

Android (Windows) / build (windows-latest, arm64-v8a, r22, 30) (pull_request)
Android / build (ubuntu-latest, arm64-v8a, r22, 30) (pull_request)
Windows / build (windows-2025, shared, x64, MD) (pull_request)
Windows / build (windows-2025, shared, x64, MT) (pull_request)
Windows / build (windows-2025, shared, x86, MD) (pull_request)
Windows / build (windows-2025, shared, x86, MT) (pull_request)
Windows / build (windows-2025, static, x64, MD) (pull_request)
Windows / build (windows-2025, static, x64, MT) (pull_request)
Windows / build (windows-2025, static, x86, MD) (pull_request)
Windows / build (windows-2025, static, x86, MT) (pull_request)

others failed at certain version. Though I suggest keeping it like this for now.


if is_plat("windows") then
if is_arch("x64", "x86_64") then
add_urls("https://github.com/OpenMathLib/OpenBLAS/releases/download/v$(version)/OpenBLAS-$(version)-x64.zip")
Copy link
Member

Choose a reason for hiding this comment

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

If you keep the previous version and just add the new version, it will not trigger all version checks. In addition, why remove the win binary package?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Keep the binary and source-build? How to choose when add package?

Copy link
Member

Choose a reason for hiding this comment

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

use binary for win

end
end
make.build(package, configs)
make.make(package, table.join("install", "PREFIX=" .. package:installdir():gsub("\\", "/"), configs))
Copy link
Member

Choose a reason for hiding this comment

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

Lower versions should not support cmake, so we need to choose the build tool based on the package version.

@waruqi
Copy link
Member

waruqi commented Oct 23, 2025

remove old versions, it will break some user projects.

Successful at all versions:

Android (Windows) / build (windows-latest, arm64-v8a, r22, 30) (pull_request)
Android / build (ubuntu-latest, arm64-v8a, r22, 30) (pull_request)
Windows / build (windows-2025, shared, x64, MD) (pull_request)
Windows / build (windows-2025, shared, x64, MT) (pull_request)
Windows / build (windows-2025, shared, x86, MD) (pull_request)
Windows / build (windows-2025, shared, x86, MT) (pull_request)
Windows / build (windows-2025, static, x64, MD) (pull_request)
Windows / build (windows-2025, static, x64, MT) (pull_request)
Windows / build (windows-2025, static, x86, MD) (pull_request)
Windows / build (windows-2025, static, x86, MT) (pull_request)

others failed at certain version. Though I suggest keeping it like this for now.

Only when all ci passes can it be merged

@star-hengxing
Copy link
Contributor

/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 refactors the OpenBLAS package to use CMake for source builds, particularly for versions 0.3.30 and newer. It introduces a comprehensive set of new configuration options to control the CMake build and adds several pre-build checks to improve the user experience. The changes are generally good, but I've identified a critical issue in an on_install selector that will break all source builds. I've also noted a couple of medium-severity issues regarding future maintenance and a potentially breaking change in default configurations. Please address the critical issue to ensure the package remains buildable.

local fortran = find_tool("gfortran")
if fortran then
table.insert(configs, "FC=" .. fortran.program)
on_install("windows|!x64 and windows|!x86", function (package)
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The selector for this on_install block, "windows|!x64 and windows|!x86", is invalid and will prevent source builds on any platform. It appears the intention is to handle all source builds not covered by the pre-built Windows binary installation.

To fix this, you should use a generic on_install block. This will act as a fallback for any platform/architecture combination that doesn't match the more specific on_install("windows|x64", "windows|x86", ...) block, which is the correct pattern for this scenario.

    on_install(function (package)

Comment on lines +67 to +68
add_configs("openmp", {description = "Compile with OpenMP enabled.", default = false, type = "boolean"})
add_configs("fortran", {description = "Compile with fortran enabled.", default = false, type = "boolean"})
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The default values for the openmp and fortran configurations have been changed from being enabled by default on most platforms (not is_plat("macosx")) to being disabled by default (false). This is a potentially breaking change for users who were relying on the previous behavior for versions older than 0.3.30. While this might be intentional to align with OpenBLAS's own default configuration, it's a significant change that might surprise users.

os.cp(path.join("bin", "libopenblas.dll"), package:installdir("bin"))
os.cp("include", package:installdir())
if package:version():ge("0.3.28") then
if package:version():eq("0.3.28") then
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 package:version():eq("0.3.28") is less future-proof than ge("0.3.28"). If a future version of the pre-built OpenBLAS for Windows (e.g., 0.3.31) follows the same file layout as 0.3.28 (with libopenblas.lib at the root of the archive), this condition will fail, and the installation will break. Using ge would be more robust, assuming this new layout is the standard going forward for pre-built binaries.

        if package:version():ge("0.3.28") then

@waruqi waruqi merged commit 7736f21 into xmake-io:dev Oct 24, 2025
61 checks passed
@choyy choyy deleted the blas branch October 25, 2025 11:43
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.

3 participants