-
Notifications
You must be signed in to change notification settings - Fork 76
Any plan for cmake supporting? #86
Comments
Yes, we would like to support CMake! Unfortunately, we don't (yet) have a lot of CMake experience; so we would very much appreciate some advice from existing CMake users with regard to how opencensus-cpp's CMakeLists should be laid out. Especially with an eye to how users of opencensus-cpp can consume it via CMake, not just build libopencensus with it. |
Use a CMake config. CMake has a few ways to find libraries, but a config makes it easy for the dependencies to get the compiler flags, macro definitions, header files, etc. I've done a bunch of CMake ports and might have some time to help out. Assuming you aren't testing for compiler features etc. it should be fairly straightforward to port. |
@isaachier that would be awesome! What I would like to see is the directory https://github.com/census-instrumentation/opencensus-cpp/tree/master/examples/grpc split out into its own repo, with a CMake setup that pulls in opencensus-cpp and gRPC as dependencies and builds everything together. |
OK that seems straightforward enough. Just to clarify, do you want opencensus-cpp to have its own CMake build as well (not just the example project)? I have dealt with the gRPC build generator, so I know it is highly configurable in terms of how it locates dependencies (sometimes uses installed libraries, sometimes uses git submodules). Does opencensus-cpp have a preference for where the dependencies are found? |
Yes, absolutely. I'm sorry I wasn't clear on this point.
I don't know enough about CMake to be able to answer this. What are the best practices around CMake and deps? We have a similar problem to solve for bazel builds, where the best practice seems to be providing a |
Assuming the |
Right so that is the ultimate question I have dealt with as well. Do you want to maintain compatibility and search for a range of versions already installed on a user's machine? Or do you want to install the dependencies when configuration occurs? |
For the time being, what I'd like is a bazel-like approach where OpenCensus C++ (and also Abseil!) are built into the final RPC server binary, and NOT installed like I'm not sure what "installing" dependencies means in the CMake world, but I'd definitely like to avoid installing any system-wide shared libraries at this point. That's a separate and much more complicated discussion around ABIs and releasing and packaging that's outside of the scope of issue 86. |
Oh definitely not system-wide. Hunter is a tool built on top of an existing CMake feature called |
That sounds good. |
The absl & cctz suggest user use them as add_subdirectory https://github.com/abseil/abseil-cpp/blob/master/CMake/README.md. Although the other dependencies in our project managed by add_external_project, I think opencensus-cpp maybe should keep same with absl & cctz. |
Don't worry I'm working on abseil first abseil/abseil-cpp#38 (comment) |
Does gRPC use |
Abseil wants everyone to wait on their cmake decision this week. See post I linked above. |
IMO |
gRPC's CMakeLists use install. But it's heavier than just using its Makefile (for building boringssl). We use a modified version of its Makefile on production with |
Hi @g-easy, any update on this? |
No update, sorry. :( I'm still watching abseil/abseil-cpp#38 to see how abseil resolves this. The only library required for core OpenCensus functionality (stats and trace) should be abseil. For e.g. Stackdriver exporter, you need gRPC. |
Same |
Opencensus not supporting CMake is a showstopper for us. |
I've made some progress on a prototype of this. Give me a couple of days and I'll roll a PR. |
seems like abseil/abseil-cpp#38 will be tracked under abseil/abseil-cpp#111 now. |
I have a prototype of a CMake build system. If you're interested in this, please take a look. A good place to start is this out-of-tree example: git clone -b cmake https://github.com/g-easy/opencensus-cpp-example.git
cd opencensus-cpp-example
cmake -H. -Bbuild
cmake --build build
./build/helloworld/helloworld The library side of it currently lives on a branch in my repo, which you can browse here: https://github.com/g-easy/opencensus-cpp/tree/cmake -- please leave comments on #238 though. :) |
Abseil-cpp or other Google project has support on cmake (using add_subdirectory). Is there any plan for opencensus-cpp?
The text was updated successfully, but these errors were encountered: