darion-yaphet opened a new pull request, #3377:
URL: https://github.com/apache/brpc/pull/3377
### What problem does this PR solve?
Issue Number: N/A
Problem Summary:
The CMake build files still rely on legacy global include directories,
compile flags, and duplicated per-example configuration. This makes target
behavior harder to
reason about and causes standalone examples/tests to drift from the main
build configuration.
### What is changed and the side effects?
Changed:
- Modernize top-level, `src`, `tools`, and `test` CMake targets with
target-scoped configuration.
- Add shared `brpc_common_config` for common compile definitions, include
paths, options, and features.
- Refactor standalone example CMake files to use
`example/cmake/BrpcExample.cmake`.
- Update the gtest download helper to use CMake `3.16...3.28`.
- Ensure downloaded gtest headers take priority over Homebrew's C++17-only
gtest headers during unit-test builds.
Side effects:
- Standalone examples now consistently require CMake 3.16 or newer,
matching the main project requirement.
- `DOWNLOAD_GTEST=ON` creates a copied gtest include directory in the test
build tree to avoid header conflicts with system-installed gtest.
- Performance effects:
No runtime performance impact expected. This is a build-system-only change.
- Breaking backward compatibility:
No source/API compatibility break expected. Users building standalone
examples with CMake older than 3.16 will need to upgrade CMake.
---
### Check List:
- [x] Please make sure your changes are compilable.
- [ ] When providing us with a new feature, it is best to add related
tests.
- [x] Please follow [Contributor Covenant Code of
Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md).
### Verification
Passed:
- `cmake -S . -B build -DOPENSSL_ROOT_DIR=/opt/homebrew/opt/openssl@3`
- `cmake --build build -j6`
- `cmake -S . -B build-tests
-DOPENSSL_ROOT_DIR=/opt/homebrew/opt/openssl@3 -DBUILD_UNIT_TESTS=ON
-DDOWNLOAD_GTEST=ON`
- `cmake --build build-tests -j6`
- Standalone example smoke builds for `echo_c++`, `http_c++`, and
`memcache_c++`
Known macOS arm64 test issues:
- `test_butil` fails in `StackTraceTest.find_symbol`
- `bthread_fd_unittest` fails in `FDTest.ping_pong`
- `rdma_performance` standalone example was not tested because `ibverbs`
is unavailable on macOS
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]