Skip to content

Conversation

@yingmanwumen
Copy link
Contributor

@yingmanwumen yingmanwumen commented Sep 28, 2025

  • Before adding new features and new modules, please go to issues to submit the relevant feature description first.
  • Write good commit messages and use the same coding conventions as the rest of the project.
  • Please commit code to dev branch and we will merge into master branch in feature
  • Ensure your edited codes with four spaces instead of TAB.

  • 增加新特性和新模块之前,请先到issues提交相关特性说明,经过讨论评估确认后,再进行相应的代码提交,避免做无用工作。
  • 编写友好可读的提交信息,并使用与工程代码相同的代码规范,代码请用4个空格字符代替tab缩进。
  • 请提交代码到dev分支,如果通过,我们会在特定时间合并到master分支上。
  • 为了规范化提交日志的格式,commit消息,不要用中文,请用英文描述。

Since I cannot find "dev" branch here, I would merge changes directly into the main branch.

Mainly modifications:

  1. Fix typos
  2. Fix string(REPLACE) in cmake when detecting toolchains.
  3. Since the actions/checkout@v1 has updated, ci was invalid. I fix the ci either, so that I can pass the tests.
  4. Bump the version of xmake to 3.0.3 when installing xmake program:
    if (NOT XMAKE_RELEASE_LATEST)
        set(XMAKE_RELEASE_LATEST 3.0.3)
    endif()

Fixes incorrect usage of string(REPLACE) in _detect_toolchain, ensuring
compiler name normalization works as intended for C++ compilers.
@gemini-code-assist
Copy link

Summary of Changes

Hello @yingmanwumen, 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 minor yet important refinements within the xrepo.cmake configuration file. The primary focus is on enhancing the clarity and correctness of the codebase by resolving several spelling mistakes in comments and documentation. Additionally, it rectifies a functional issue where the string(REPLACE) command was used with an incorrect parameter order, which is crucial for accurate compiler name manipulation during the toolchain detection process.

Highlights

  • Typo Corrections: Several typographical errors in comments and documentation within the xrepo.cmake file have been corrected, improving readability and accuracy.
  • CMake string(REPLACE) Fix: The incorrect usage of the string(REPLACE) command in xrepo.cmake has been rectified. This fix ensures that compiler names are correctly processed during toolchain detection by providing the correct parameter order to the command.
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

@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 primarily fixes a bug in the usage of string(REPLACE) within the _detect_toolchain function and corrects several typos in comments. The fix for string(REPLACE) is correct and addresses the issue. I've added one comment suggesting a more robust way to detect the toolchain to improve maintainability and reliability in different build environments.

Comment on lines 218 to +221
elseif(DEFINED CMAKE_CXX_COMPILER)
get_filename_component(_compiler_name "${CMAKE_CXX_COMPILER}" NAME_WLE)
string(REPLACE "g++" "gcc" "${_compiler_name}" _compiler_name)
string(REPLACE "clang++" "clang" "${_compiler_name}" _compiler_name)
string(REPLACE "g++" "gcc" _compiler_name "${_compiler_name}")
string(REPLACE "clang++" "clang" _compiler_name "${_compiler_name}")

Choose a reason for hiding this comment

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

medium

While this change correctly fixes the string(REPLACE) syntax, the overall approach of parsing the compiler executable name to determine the toolchain is fragile. This method can easily break when compiler wrappers like ccache are used (e.g., CMAKE_CXX_COMPILER="ccache g++") or with unusually named compiler executables.

A more robust approach would be to leverage CMake's built-in compiler identification variables. For example:

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
    set(_compiler_name "gcc")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
    set(_compiler_name "clang")
endif()

If preserving the version from the compiler name (e.g., gcc-11) is important for xrepo, CMAKE_CXX_COMPILER_VERSION could be appended, or a more careful regex could be used to extract it from the executable name. Relying on CMAKE_<LANG>_COMPILER_ID is generally safer than string manipulation on file paths.

Installs CMake 3.5.2 to support gflags 2.2.2, which requires CMake <= 3.5.
Updates GCC/G++ alternative commands for newer Ubuntu versions in Linux workflow.
Corrects various spelling mistakes in README.md and example/CMakeLists.txt
for improved clarity and accuracy.
@yingmanwumen
Copy link
Contributor Author

yingmanwumen commented Sep 28, 2025

Wait me for fixing the CI issues, please :)

This enables manual triggering of the Linux, macOS, and Windows CI workflows
directly from the GitHub Actions UI. This provides flexibility for
re-running workflows on demand for specific branches or commits.
Update CMake from 3.5.2 to 3.13.0 in both Linux and macOS CI
workflows. Also, upgrade GCC/G++ to version 13 in the Linux CI
workflow, as newer Ubuntu runners no longer include GCC 9 by
default. This ensures compatibility with modern build tools and
environments.
The default GCC version on GitHub Actions Ubuntu runners is now sufficient,
making the explicit installation and  configuration
for  unnecessary. This simplifies the workflow.
The CI workflows for Linux and macOS are updated to use CMake 3.22.0
instead of 3.13.0. This ensures compatibility with newer build systems
and potentially resolves issues with older CMake versions.
Correct CMake archive filename capitalization for Linux workflow.
Update macOS workflow to use universal CMake archive for broader compatibility.
This patch addresses potential build issues for zlib on macOS by
simplifying the macOS detection logic in  and removing
unnecessary  related code.
The  has been moved to  for better organization.
The  configuration has been updated to apply this patch specifically to zlib
versions  and . This ensures the macOS compatibility fix is applied only
to the relevant versions, improving build system clarity and maintainability. The patch
itself simplifies macOS detection in  by removing  and deprecated
 related code.
Updated add_patches to use absolute path for zlib_macos.patch using
path.join(package:scriptdir(), ...) to ensure the patch is found
during xmake package installation.
Replaced the deprecated  with the recommended
 in the example package definition. This aligns with
modern Xmake practices and improves script consistency.
Ensure the required MSVC v144 build tools are available in Windows CI
by installing them via Chocolatey before running tests.
Update the default xmake version to 3.0.3.
Remove redundant Visual Studio 2022 v144 toolset installation
from Windows CI workflow, improving build efficiency. The toolset
is now pre-installed on GitHub Actions runners.
@yingmanwumen yingmanwumen changed the title Fix: 1. typo 2. wrong usage of string(REPLACE) Fix: 1. typo 2. wrong usage of string(REPLACE) 3. Fix CI errors 4. Bump builtin xmake to 3.0.3 Sep 28, 2025
@yingmanwumen
Copy link
Contributor Author

@waruqi Hello, I've fixed all the ci issues: https://github.com/yingmanwumen/xrepo-cmake/actions
Could you have a look at this patch, please? I'm looking forward for your reply :)

@waruqi waruqi merged commit e957777 into xmake-io:main Sep 28, 2025
6 checks passed
@waruqi
Copy link
Member

waruqi commented Sep 28, 2025

merged, thanks!

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