-
-
Notifications
You must be signed in to change notification settings - Fork 12
Fix: 1. typo 2. wrong usage of string(REPLACE) 3. Fix CI errors 4. Bump builtin xmake to 3.0.3 #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes incorrect usage of string(REPLACE) in _detect_toolchain, ensuring compiler name normalization works as intended for C++ compilers.
Summary of ChangesHello @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 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.
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.
| 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}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
|
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.
|
@waruqi Hello, I've fixed all the ci issues: https://github.com/yingmanwumen/xrepo-cmake/actions |
|
merged, thanks! |
Since I cannot find "dev" branch here, I would merge changes directly into the main branch.
Mainly modifications:
string(REPLACE)in cmake when detecting toolchains.actions/checkout@v1has updated, ci was invalid. I fix the ci either, so that I can pass the tests.