Skip to content
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

Fixes #804 #805

Merged
merged 2 commits into from
May 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions exporters/elasticsearch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
include_directories(include)
include_directories(${CMAKE_SOURCE_DIR}/ext/include)

add_library(opentelemetry_exporter_elasticsearch_logs src/es_log_exporter.cc)

set_target_properties(opentelemetry_exporter_elasticsearch_logs
PROPERTIES EXPORT_NAME elasticsearch_log_exporter)

target_include_directories(
opentelemetry_exporter_elasticsearch_logs
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
"$<INSTALL_INTERFACE:include>")
owent marked this conversation as resolved.
Show resolved Hide resolved

target_link_libraries(opentelemetry_exporter_elasticsearch_logs
PUBLIC opentelemetry_trace http_client_curl)

install(
TARGETS opentelemetry_exporter_elasticsearch_logs
EXPORT "${PROJECT_NAME}-target"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

install(
DIRECTORY include/opentelemetry/exporters/elasticsearch
DESTINATION include/opentelemetry/exporters/
FILES_MATCHING
PATTERN "*.h")

if(BUILD_TESTING)
add_executable(es_log_exporter_test test/es_log_exporter_test.cc)

target_link_libraries(
es_log_exporter_test ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
opentelemetry_exporter_elasticsearch_logs)

install(
TARGETS opentelemetry_exporter_elasticsearch_logs
EXPORT "${PROJECT_NAME}-target"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

install(
DIRECTORY include/opentelemetry/exporters/elasticsearch
DESTINATION include/opentelemetry/exporters/
FILES_MATCHING
PATTERN "*.h")

gtest_add_tests(
TARGET es_log_exporter_test
TEST_PREFIX exporter.
Expand Down
38 changes: 32 additions & 6 deletions exporters/etw/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,45 @@
include_directories(include
${CMAKE_SOURCE_DIR}/third_party/nlohmann-json/include)
find_package(nlohmann_json REQUIRED)

add_library(opentelemetry_exporter_etw INTERFACE)

target_include_directories(
opentelemetry_exporter_etw
INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
"$<INSTALL_INTERFACE:include>")

set_target_properties(opentelemetry_exporter_etw PROPERTIES EXPORT_NAME
etw_exporter)

target_link_libraries(opentelemetry_exporter_etw
INTERFACE nlohmann_json::nlohmann_json)

install(
TARGETS opentelemetry_exporter_etw
EXPORT "${PROJECT_NAME}-target"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

install(
DIRECTORY include/opentelemetry/exporters/etw
DESTINATION include/opentelemetry/exporters/
FILES_MATCHING
PATTERN "*.h")

if(BUILD_TESTING)
add_executable(etw_provider_test test/etw_provider_test.cc)
add_executable(etw_tracer_test test/etw_tracer_test.cc)
add_executable(etw_perf_test test/etw_perf_test.cc)

target_link_libraries(etw_provider_test ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT})
opentelemetry_exporter_etw ${CMAKE_THREAD_LIBS_INIT})

target_link_libraries(etw_tracer_test ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT})
opentelemetry_exporter_etw ${CMAKE_THREAD_LIBS_INIT})

target_link_libraries(etw_perf_test benchmark::benchmark
${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(
etw_perf_test benchmark::benchmark ${GTEST_BOTH_LIBRARIES}
opentelemetry_exporter_etw ${CMAKE_THREAD_LIBS_INIT})

gtest_add_tests(
TARGET etw_provider_test
Expand Down
23 changes: 22 additions & 1 deletion exporters/jaeger/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
include_directories(include)
include_directories(thrift-gen)

find_package(Thrift REQUIRED)
Expand All @@ -13,6 +12,15 @@ set(JAEGER_EXPORTER_SOURCES

add_library(jaeger_trace_exporter ${JAEGER_EXPORTER_SOURCES}
${JAEGER_THRIFT_GENCPP_SOURCES})

set_target_properties(jaeger_trace_exporter PROPERTIES EXPORT_NAME
jaeger_trace_exporter)

target_include_directories(
jaeger_trace_exporter
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
"$<INSTALL_INTERFACE:include>")

target_link_libraries(
jaeger_trace_exporter
PUBLIC opentelemetry_resources
Expand All @@ -26,6 +34,19 @@ if(MSVC)
endif()
endif()

install(
owent marked this conversation as resolved.
Show resolved Hide resolved
TARGETS jaeger_trace_exporter
EXPORT "${PROJECT_NAME}-target"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

install(
DIRECTORY include/opentelemetry/exporters/jaeger
DESTINATION include/opentelemetry/exporters/
FILES_MATCHING
PATTERN "*.h")

if(BUILD_TESTING)
add_executable(jaeger_recordable_test test/jaeger_recordable_test.cc)
target_link_libraries(jaeger_recordable_test ${GTEST_BOTH_LIBRARIES}
Expand Down
2 changes: 0 additions & 2 deletions exporters/memory/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include_directories(include)

add_library(opentelemetry_exporter_in_memory INTERFACE)

target_include_directories(
Expand Down
3 changes: 2 additions & 1 deletion exporters/ostream/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ install(
DIRECTORY include/opentelemetry/exporters/ostream
DESTINATION include/opentelemetry/exporters/
FILES_MATCHING
PATTERN "metrics_exporter.h" EXCLUDE)
PATTERN "metrics_exporter.h" EXCLUDE
PATTERN "*.h")

if(BUILD_TESTING)
add_executable(ostream_span_test test/ostream_span_test.cc)
Expand Down
2 changes: 0 additions & 2 deletions ext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
include_directories(sdk)
add_library(opentelemetry_ext INTERFACE)
target_include_directories(
opentelemetry_ext
Expand All @@ -20,7 +19,6 @@ install(
FILES_MATCHING
PATTERN "*.h")

include_directories(include)
add_subdirectory(src)

if(BUILD_TESTING)
Expand Down
9 changes: 6 additions & 3 deletions ext/src/http/client/curl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ if(CURL_FOUND)
http_client_curl)

if(TARGET CURL::libcurl)
target_link_libraries(http_client_curl PUBLIC CURL::libcurl)
target_link_libraries(http_client_curl PUBLIC opentelemetry_ext
CURL::libcurl)
else()
include_directories(${CURL_INCLUDE_DIRS})
target_link_libraries(http_client_curl PUBLIC ${CURL_LIBRARIES})
target_include_directories(http_client_curl
INTERFACE "${CURL_INCLUDE_DIRS}")
target_link_libraries(http_client_curl PUBLIC opentelemetry_ext
${CURL_LIBRARIES})
endif()

install(
Expand Down
11 changes: 10 additions & 1 deletion opentelemetry-cpp-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
# opentelemetry-cpp::ostream_metrics_exporter - Imported target of opentelemetry-cpp::ostream_metrics_exporter
# opentelemetry-cpp::ostream_span_exporter - Imported target of opentelemetry-cpp::ostream_span_exporter
# opentelemetry-cpp::prometheus_exporter - Imported target of opentelemetry-cpp::prometheus_exporter
# opentelemetry-cpp::elasticsearch_log_exporter - Imported target of opentelemetry-cpp::elasticsearch_log_exporter
# opentelemetry-cpp::etw_exporter - Imported target of opentelemetry-cpp::etw_exporter
# opentelemetry-cpp::jaeger_trace_exporter - Imported target of opentelemetry-cpp::jaeger_trace_exporter
# opentelemetry-cpp::zpages - Imported target of opentelemetry-cpp::zpages
# opentelemetry-cpp::http_client_curl - Imported target of opentelemetry-cpp::http_client_curl
#
Expand Down Expand Up @@ -73,11 +76,17 @@ set(_OPENTELEMETRY_CPP_LIBRARIES_TEST_TARGETS
trace
metrics
logs
in_memory_span_exporter
otlp_exporter
ostream_log_exporter
ostream_metrics_exporter
ostream_span_exporter
zpages)
prometheus_exporter
elasticsearch_log_exporter
etw_exporter
jaeger_trace_exporter
zpages
http_client_curl)
foreach(_TEST_TARGET IN LISTS _OPENTELEMETRY_CPP_LIBRARIES_TEST_TARGETS)
if(TARGET opentelemetry-cpp::${_TEST_TARGET})
list(APPEND OPENTELEMETRY_CPP_LIBRARIES opentelemetry-cpp::${_TEST_TARGET})
Expand Down