-
Notifications
You must be signed in to change notification settings - Fork 65
refactor(cmake): modernize build system structure,fix strictness issues #518
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
base: master
Are you sure you want to change the base?
Conversation
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.
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_testtohelio_cxx_testwith 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 |
92568df to
48806a4
Compare
48806a4 to
483a7a2
Compare
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.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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]>
483a7a2 to
4fe8b72
Compare
|
We use cmake |
| 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(); |
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.
LOG(FATAL) already calls abort.
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.
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.
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.
@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)
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. |
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:
into internal.cmake for separation of concerns.
to resolve a shadowing conflict with Google Test.
environment checks (OS, Arch).
Fixes & Rationales:
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).
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.
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]