cmake: create jaeger_base target for consuming tracing libraries

Signed-off-by: Deepika Upadhyay <dupadhya@redhat.com>
This commit is contained in:
Deepika Upadhyay 2022-02-04 15:53:48 -05:00 committed by Omri Zeneva
parent e63f1ba027
commit bbaafcd32c
7 changed files with 28 additions and 17 deletions

View File

@ -6,14 +6,14 @@ function(target_create _target _lib)
endfunction()
function(build_opentelemetry)
set(opentelemetry_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/opentelemetry-cpp")
set(opentelemetry_SOURCE_DIR "${PROJECT_SOURCE_DIR}/src/opentelemetry-cpp")
set(opentelemetry_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/opentelemetry-cpp")
set(opentelemetry_cpp_targets opentelemetry_trace opentelemetry_exporter_jaeger_trace)
set(opentelemetry_CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DWITH_JAEGER=ON
-DBUILD_TESTING=OFF
-DWITH_EXAMPLES=OFF
-DBoost_INCLUDE_DIR=${CMAKE_BINARY_DIR}/boost/include)
-DBoost_INCLUDE_DIR=${CMAKE_BINARY_DIR}/boost/include)
set(opentelemetry_libs
${opentelemetry_BINARY_DIR}/sdk/src/trace/libopentelemetry_trace.a

View File

@ -406,9 +406,11 @@ if(WITH_JAEGER)
find_package(thrift 0.13.0 REQUIRED)
include(BuildOpentelemetry)
build_opentelemetry()
set(jaeger_base opentelemetry::libopentelemetry thrift::libthrift)
add_dependencies(common-objs ${jaeger_base})
target_link_libraries(common-objs ${jaeger_base})
add_library(jaeger_base INTERFACE)
target_link_libraries(jaeger_base INTERFACE opentelemetry::libopentelemetry
thrift::libthrift)
add_dependencies(common-objs jaeger_base)
target_link_libraries(common-objs jaeger_base)
endif()
CHECK_C_COMPILER_FLAG("-fvar-tracking-assignments" HAS_VTA)
@ -472,7 +474,7 @@ if(WITH_DPDK)
endif()
if(WITH_JAEGER)
list(APPEND ceph_common_deps ${jaeger_base})
list(APPEND ceph_common_deps jaeger_base)
endif()
if(WIN32)
@ -498,7 +500,10 @@ endif()
add_library(common STATIC ${ceph_common_objs})
target_link_libraries(common ${ceph_common_deps})
add_dependencies(common legacy-option-headers ${jaeger_base})
add_dependencies(common legacy-option-headers)
if(WITH_JAEGER)
add_dependencies(common jaeger_base)
endif()
if (WIN32)
# Statically building ceph-common on Windows fails. We're temporarily
@ -512,7 +517,13 @@ target_link_libraries(ceph-common ${ceph_common_deps})
if(ENABLE_COVERAGE)
target_link_libraries(ceph-common gcov)
endif(ENABLE_COVERAGE)
add_dependencies(ceph-common legacy-option-headers ${jaeger_base})
add_dependencies(ceph-common legacy-option-headers)
if(WITH_JAEGER)
add_dependencies(ceph-common jaeger_base)
endif()
# appease dpkg-shlibdeps
set_target_properties(ceph-common PROPERTIES
SOVERSION 2

View File

@ -134,9 +134,9 @@ set(crimson_common_deps
Boost::random
json_spirit)
set(crimson_common_public_deps crimson::cflags)
if(WITH_JAEGER)
include_directories(SYSTEM ${CMAKE_BINARY_DIR}/external/include)
list(APPEND crimson_common_deps ${jaeger_base})
list(APPEND crimson_common_public_deps jaeger_base)
endif()
if(NOT WITH_SYSTEM_BOOST)
@ -145,7 +145,7 @@ endif()
target_link_libraries(crimson-common
PUBLIC
crimson::cflags
${crimson_common_public_deps}
PRIVATE
crc32
${crimson_common_deps}

View File

@ -42,5 +42,5 @@ target_link_libraries(mon
heap_profiler
fmt::fmt)
if(WITH_JAEGER)
target_link_libraries(mon ${jaeger_base})
target_link_libraries(mon jaeger_base)
endif()

View File

@ -93,8 +93,8 @@ if(WITH_LTTNG)
endif()
if(WITH_JAEGER)
add_dependencies(os ${jaeger_base})
target_link_libraries(os ${jaeger_base})
add_dependencies(os jaeger_base)
target_link_libraries(os jaeger_base)
endif()
target_link_libraries(os kv)

View File

@ -251,8 +251,8 @@ if(WITH_LTTNG)
endif()
if(WITH_JAEGER)
add_dependencies(rgw_common ${jaeger_base})
target_link_libraries(rgw_common PUBLIC ${jaeger_base})
add_dependencies(rgw_common jaeger_base)
target_link_libraries(rgw_common PUBLIC jaeger_base)
endif()
if(WITH_RADOSGW_DBSTORE)

View File

@ -21,7 +21,7 @@ target_include_directories(dbstore_lib PUBLIC "${CMAKE_SOURCE_DIR}/src/fmt/inclu
target_include_directories(dbstore_lib PUBLIC "${CMAKE_SOURCE_DIR}/src/rgw")
set(link_targets spawn)
if(WITH_JAEGER)
list(APPEND link_targets ${jaeger_base})
list(APPEND link_targets jaeger_base)
endif()
target_link_libraries(dbstore_lib PUBLIC ${link_targets})