Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@glevkovich
Copy link
Collaborator

@glevkovich glevkovich commented Dec 21, 2025

Refactor CMakeLists.txt and cmake/internal.cmake to improve modularity
and logical flow. By centralizing compiler logic and cleaning up the
root file, the configuration is now more robust and easier to extend.

Key changes:

  • Move compiler flags, architecture checks, and definitions (USE_FB2)
    into internal.cmake for separation of concerns.
  • Rename cxx_test to helio_cxx_test and add a compatibility wrapper
    to resolve a shadowing conflict with Google Test.
  • Add guard clause in internal.cmake and implement "fail-fast"
    environment checks (OS, Arch).
  • Standardize sanitizer detection using check_cxx_source_compiles.
  • Reorder option definitions to prioritize smart default discovery.

Fixes & Rationales:

  • Enforce include(internal) BEFORE include(third_party):
    Dependencies must configure using the project's global flags (C++17,
    -DUSE_FB2). Loading third-party logic first causes libraries (like
    Abseil) to build with default standards (e.g., C++11/14), creating ABI
    mismatches with our C++17 code. This leads to undefined behavior and
    ODR violations. packages that were built with default standards:
    abseil_cpp, benchmark, gtest, and glog(conditionally).
  • Fix noreturn violation in base/init.cc:
    The improved flag propagation now correctly applies -Werror to the
    base library, exposing that __assert_fail could technically return.
    Added abort() to satisfy the compiler contract and ensure safety.
  • Suppress -Werror=ignored-attributes on GCC:
    Downgrade this specific warning to non-fatal to prevent CI failures
    caused by harmless internal warnings in Abseil's vector implementation
    (exposed because Abseil now correctly inherits the project's
    -Werror).

Signed-off-by: Gil Levkovich [email protected]

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the Helio CMake build system by upgrading to CMake 3.19, improving modularity through better separation of concerns, and resolving a function naming collision with GoogleTest. The refactoring centralizes compiler logic in internal.cmake, renames the test macro to helio_cxx_test, and implements environment checks and sanitizer detection improvements.

Key changes:

  • Minimum CMake version upgraded from 3.16 to 3.19 to enable Presets support
  • Compiler flags, architecture checks, and USE_FB2 definition moved from root CMakeLists.txt to internal.cmake
  • Test macro renamed from cxx_test to helio_cxx_test with backward compatibility wrapper to resolve GoogleTest naming collision

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
CMakeLists.txt Upgraded minimum CMake to 3.19; restructured options with smart defaults; moved compiler logic to internal.cmake; added compatibility wrapper for deprecated cxx_test macro
cmake/internal.cmake Added include guard; moved compiler detection and flags from root; centralized USE_FB2 definition; improved sanitizer detection with check_cxx_source_compiles; renamed cxx_test to helio_cxx_test with documentation
base/CMakeLists.txt Updated all test declarations to use helio_cxx_test
base/pmr/CMakeLists.txt Updated test declarations to use helio_cxx_test
io/CMakeLists.txt Updated test declarations to use helio_cxx_test
strings/CMakeLists.txt Updated test declaration to use helio_cxx_test
util/CMakeLists.txt Updated test declaration to use helio_cxx_test
util/fibers/CMakeLists.txt Updated test declarations to use helio_cxx_test
util/tls/CMakeLists.txt Updated test declarations to use helio_cxx_test
.github/copilot-instructions.md Updated documentation to reference helio_cxx_test instead of cxx_test

@glevkovich glevkovich force-pushed the glevkovich/build_system1 branch 2 times, most recently from 92568df to 48806a4 Compare December 21, 2025 09:36
@glevkovich glevkovich marked this pull request as ready for review December 21, 2025 09:43
@glevkovich glevkovich marked this pull request as draft December 21, 2025 09:47
@glevkovich glevkovich force-pushed the glevkovich/build_system1 branch from 48806a4 to 483a7a2 Compare December 21, 2025 13:31
@glevkovich glevkovich changed the title refactor(cmake): modernize build system structure refactor(cmake): modernize build system structure,fix strictness issues Dec 21, 2025
@glevkovich glevkovich requested a review from Copilot December 21, 2025 13:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

@codecov-commenter
Copy link

codecov-commenter commented Dec 21, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.05%. Comparing base (dd0b9d2) to head (4fe8b72).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #518      +/-   ##
==========================================
- Coverage   78.13%   78.05%   -0.09%     
==========================================
  Files         116      116              
  Lines       10319    10319              
==========================================
- Hits         8063     8054       -9     
- Misses       2256     2265       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Refactor CMakeLists.txt and cmake/internal.cmake to improve modularity
and logical flow. By centralizing compiler logic and cleaning up the
root file, the configuration is now more robust and easier to extend.

Key changes:
* Move compiler flags, architecture checks, and definitions (USE_FB2)
  into internal.cmake for separation of concerns.
* Rename `cxx_test` to `helio_cxx_test` and add a compatibility wrapper
  to resolve a shadowing conflict with Google Test.
* Add guard clauses to internal.cmake and third_party.cmake to prevent
  duplicate target definitions, and implement "fail-fast" environment
  checks (OS, Arch).
* Standardize sanitizer detection using check_cxx_source_compiles.
* Reorder option definitions to prioritize smart default discovery.

Fixes & Rationales:
* Enforce `include(internal)` BEFORE `include(third_party)`:
  Dependencies must configure using the project's global flags (C++17,
  -DUSE_FB2). Loading third-party logic first causes libraries (like
  Abseil) to build with default standards (e.g., C++11/14), creating ABI
  mismatches with our C++17 code. This leads to undefined behavior and
  ODR violations. packages that were built with default standards:
  abseil_cpp, benchmark, gtest, and glog(conditionally).
* Fix `noreturn` violation in `base/init.cc`:
  The improved flag propagation now correctly applies `-Werror` to the
  base library, exposing that `__assert_fail` could technically return.
  Added `abort()` to satisfy the compiler contract and ensure safety.
* Suppress `-Werror=ignored-attributes` on GCC:
  Downgrade this specific warning to non-fatal to prevent CI failures
  caused by harmless internal warnings in Abseil's vector implementation
  (exposed because Abseil now correctly inherits the project's
  `-Werror`).

Signed-off-by: Gil Levkovich <[email protected]>
@glevkovich glevkovich force-pushed the glevkovich/build_system1 branch from 483a7a2 to 4fe8b72 Compare December 21, 2025 14:18
@romange
Copy link
Owner

romange commented Dec 21, 2025

We use cmake 3.16 because ubuntu 20 runs cmake 3.16. I do not want to change this requirement. I am fine with general improvements but please talk to me first before making the build dependencies more strict.

extern "C" void __assert_fail(const char* assertion, const char* file, unsigned int line,
const char* function) {
LOG(FATAL) << "[" << file << ":" << line << "]: " << "assert(" << assertion << ") failed!";
abort();
Copy link
Owner

Choose a reason for hiding this comment

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

LOG(FATAL) already calls abort.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I know, but the compiler doesn't care. With my new change it gives a warning which fail the build if WError enabled. So I've added that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@romange I think that you read the initial copilot message, I usually upload a draft PR and do multiple changes + address copilot review 1st before transforming into a full PR. The actual changes can be seen here:
#518 (comment)

@glevkovich
Copy link
Collaborator Author

We use cmake 3.16 because ubuntu 20 runs cmake 3.16. I do not want to change this requirement. I am fine with general improvements but please talk to me first before making the build dependencies more strict.

I wanted to change it but removed the change before submitting the PR, my PR does not change CMake version. I understood it requires more work to be able to upgrade the version.
Are we running it in a and Ubuntu container only? If yes, it's relatively easy work to just upgrade CMake, I think that 3.19 is much more beneficial since it introduce CMake presents which allows (for example) to put a unified configuration file for all builds that can be uses by both CI and blaze.

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.

4 participants