-
Notifications
You must be signed in to change notification settings - Fork 76
CMake stackdriver enhancements #447
base: master
Are you sure you want to change the base?
CMake stackdriver enhancements #447
Conversation
- support for package export and instal - opencensus_lib() now has a HDRS section just like Bazel. - opencensus_lib() allows declaration of headers in subdirectories, and installs them in proper directory - still issues with segregating public and private headers ( HDRS of non PUBLIC opencenus_lib ) ( it looks like customer can write code that includes internal files ) - still issues linking private static libraries together into bigger public ones. ( as Bazel does ) - attempt at allowing build as shared libraries - added helper code to request no undefined symbols in shared libraries. - attempt failed due to circular dependencies ( opencensus_trace and opencensus_context ). Until those are fixed, only static libs will work. - outlined many missing dependencies declarations, only fixed in CMake for now. ideally similar changes would be done to Bazel build, and Bazel would allow to build shared libs as well... - stackdriver / googleapis / google-cloud-cpp changed recently, does not export monitoring/logging and cloud trace/tracing libs. - attempt at building with FetchContent if and only if no existing package has been found. same ideas as using shared libraries : - reuse and to link ability into programs that may already use some of the same deps. - third party ( opencensus-cpp ) should not require significant alterations in consuming client build system ( hence CMake ) and strategy ( - linux-specifc example : using stackdriver exporter on Google Cloud Engine - parse /proc/meminfo and /proc/vmstat to stackdriver - rely via FetchContent on third party software - cpr ( to implement succintly access go GCE instance metadata server ) - re2 ( to brace against variable level of support/correctness in implementation of <regex> with old GCC versions ) - not yet verified on anything but CentOS 7 - in particular no effort has been yet made so that CI via travis or appveyor actually works. As such, not ready to merge
…package() on gRPC and googleapis. No FetchContent yet
…TACKDRIVER_EXPORTER CMake option
… change, fix newest example
… it to pass its own unit tests when used with FetchContent ...
…mat and cmake-format manually as docker-format Dockerfile is obsolete. format check should match travis one
endif() | ||
# clearly there are problems with cyclical deps in this code ( context, trace ) | ||
if(BUILD_SHARED_LIBS) | ||
add_link_options("LINKER:--no-undefined") |
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.
this requires a version of cmake that's more recent than the one in the CI containers... consider a platform-aware version of this:
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
include(OpenCensusDeps) | ||
|
||
include(OpenCensusHelpers) | ||
|
||
if(BUILD_SHARED_LIBS) |
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.
redundant
circular depdendency between
adding context as a direct depdendency to
As a result, as of today, the only way to assemble this code is with a static library. |
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.
Sorry, I'm not working on OpenCensus anymore, but can't remove myself as a reviewer from this PR. Dismissing this review using "request changes" might remove it from my PR queue though.
do not merge yet, it is still work in progress.
I probably also left quite a few comments that need removing.
many enhancements to CMake support ( see #244 )
support for exporting package and install ( related to Support find_package and install #256 )
opencensus_lib()
now has aHDRS
section just like Bazel.opencensus_lib()
allows declaration of headers in subdirectories, and installs them in proper directorygRPC
andgoogleapis
CMake packages are installed already, and built with -DBUILD_STACKDRIVER_EXPORTER=ON flag.(failed) attempt at allowing build as shared libraries ( more on that later )
CMakeLists.txt
notBUILD
files ). Mostly around missing the context library as a dependency.attempt at
find_package()
before usingFetchContent()
two more examples that builds in repository
parses
/proc/meminfo
and eventually/proc/vmstat
and shoves its contents into stackdriver stats exporter.uses cpr as
FetchContent()
dependency./proc/meminfo
and eventually/proc/vmstat
and shoves its contents to stdout stats exporter.Ongoing issues / unresolved:
HDRS
of nonPUBLIC
opencenus_lib()
)( it looks like customer can write code that includes internal files, so I install them )
( as Bazel does. I deploy the internal libraries as static libs unless marked as
PRIVATE
inopencensus_lib
)I can think of a way involving linking manually all internal libs only for build with:
opencensus_trace
andopencensus_context
.until those are fixed, no hope for producing shared libraries.
google-cloud-cpp
has deprecated use ofcpp-makefiles
project ...I have a branch for that somewhere, but this work assumes there is a googleapis cmake package that contains
Unfortunately I did not read many of the outstanding PRs when I started this work, so it may be very redundant with ongoing efforts.