-
Notifications
You must be signed in to change notification settings - Fork 483
[INSTALL] add cmake components to the package #3220
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
[INSTALL] add cmake components to the package #3220
Conversation
✅ Deploy Preview for opentelemetry-cpp-api-docs canceled.
|
Posting this as draft and seeking feedback. Interested in thoughts/concerns on the general approach and the proposed component to target mapping. If the proposed changes look reasonable, I'd be happy to add the ci tests to verify the changes. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3220 +/- ##
=======================================
Coverage 89.56% 89.56%
=======================================
Files 210 210
Lines 6502 6502
=======================================
Hits 5823 5823
Misses 679 679 🚀 New features to boost your workflow:
|
Hi @owent , could you take a look at this change ? Thanks. |
@owent This is still a draft but I'm interested in your feedback before I go too much further. Here is a brief summary of work remaining and some open questions. Work remaining:
Some open questions:
|
…ks up the ext component into three (dll, http_curl, and common) so there are no optional targets in components. Adds a suite of install tests, run them with do_ci.sh cmake.install.test command. Updates the github ci cmake_install_test to run the new suite
…the install directory. Update ci scripts to set environment variables properly
… the latest nlohmann-json package for the es exporter
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.
Impressive work.
Before going into the details, I have a comment on the general file structure for new code.
For example, for file cmake/install/test/src/test_api.cc
.
This is a unit test in C++, which should build and pass if it is compiled with the proper installed headers and linked with the proper libraries (none in this case).
These is nothing CMake-ish about it, the same code with opentelemetry-cpp installed by a plain Makefile or an rpm package should work just the same.
Can all the C++ code under cmake/install/xxx be moved to install/xxx instead ?
To clarify:
File cmake/install/test/projects/component_tests/api/CMakeLists.txt
stays where it is,
the only change is where INSTALL_TEST_SRC_DIR
points to.
…s and cmake messages. Run the ci install test on the more modern grpc version and with abseil
Thanks for the feedback @marcalff. I've moved the install tests to opentelemetry-cpp/install/test/. The install/test directory has the build system independent smoke test .cc files in the src directory and cmake specific tests in the test/cmake directory. Let me know if this is better. |
…nan files. update versions in conan files
Thanks for the invite Marc! Happy to accept. I'll submit the PRs this week. |
The opentelemetry-cpp project has community provided package manager support based on cmake with vcpkg, conan, and homebew. In addition it is possible to build against packages installed by brew (macos 14) and apt (Ubuntu 24.04). I've added examples of building against thirdparty dependencies from each package manager to a new cmake install github workflow. I don't think these jobs should all be merged to main with this PR, but added them to help in review. These new jobs don't test the community portfile, conanfile, or recipe - just building against the dependencies installed by those managers. Some notes on the community supported package managers:
Generally building with vckpg and conan seem to be great options going forward to standardize packaging for users, development, and ci. I'd advocate we move towards replacing the bespoke package build scripts in ./ci with one or both of these. The conan build helped catch several issues that were hidden by the ci install scripts (the zipkin test curl link issue and grpc client header issue were caught with conan builds). |
Do not merge (now) tag: To merge after opentelemetry-cpp 1.20 is released |
…install abseil, protobuf, and grpc so the transitive abseil depenedency is found implicitly
Did an extra review pass for:
All LGTM, now merging. |
Fixes #3218
Overview
This PR introduces CMake COMPONENTS to the
opentelemetry-cpp
package. Components are essentially named groups of CMake targets and can be passed to thefind_package
function to more selectively include targets and dependencies.For example, with this PR the following will only include the
opentelemetry-cpp::api
header only target and search for no other dependencies that may be needed by other targets of the package.Using components like this provides developers more control over what targets and dependencies CMake includes and should help reduce the scope of dependency issues a developer may encounter when building their instrumented CMake projects against different versions/configurations of the installed
opentelemetry-cpp
package.Please see the updated
INSTALL.md
file of this PR for the proposed components to targets mapping.Backwards compatibility is covered by including all components and finding all dependencies when the developer does not pass any components to find_package as in the case below.
Changes
opentelemetry-cpp-target.cmake
file into target files per component by updating the CMakeinstall
commands that create export sets in the CMakeLists.txt files for each of the targets.opentelemetry-cpp-config.cmake
to include a complete list of all components and all targets. This file now reacts to theopentelemetry-cpp_FIND_COMPONENTS
list set byfind_package
when a developer adds theCOMPONENTS
arguments.For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes