Skip to content

Commit

Permalink
CMakeFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff committed Feb 20, 2024
1 parent 5351d20 commit fde1025
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 58 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,13 @@ endif()
if((NOT WITH_API_ONLY) AND WITH_CONFIGURATION)
# No specific version required.
find_package(ryml REQUIRED)
message(STATUS "Found ryml: include ${RYML_INCLUDE_DIR}, lib ${RYML_LIB_DIR}, version ${ryml_VERSION}")
message(
STATUS
"Found ryml: include ${RYML_INCLUDE_DIR}, lib ${RYML_LIB_DIR}, version ${ryml_VERSION}"
)
endif()

# DEAD
# find_package(yaml-cpp REQUIRED)
# DEAD find_package(yaml-cpp REQUIRED)

if(OTELCPP_MAINTAINER_MODE)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
Expand Down
25 changes: 14 additions & 11 deletions examples/yaml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ endif()

include_directories(${CMAKE_SOURCE_DIR}/sdk/include)

add_executable(example_yaml main.cc
custom_sampler.cc custom_sampler_builder.cc
custom_span_exporter.cc custom_span_exporter_builder.cc
custom_span_processor.cc custom_span_processor_builder.cc)

target_link_libraries(example_yaml ${CMAKE_THREAD_LIBS_INIT}
common_foo_library
add_executable(
example_yaml
main.cc
custom_sampler.cc
custom_sampler_builder.cc
custom_span_exporter.cc
custom_span_exporter_builder.cc
custom_span_processor.cc
custom_span_processor_builder.cc)

target_link_libraries(example_yaml ${CMAKE_THREAD_LIBS_INIT} common_foo_library
opentelemetry_exporter_ostream_span)

if(WITH_OTLP_HTTP)
Expand All @@ -28,11 +32,10 @@ if(WITH_ZIPKIN)
target_link_libraries(example_yaml opentelemetry_exporter_zipkin_trace)
endif()


if(DEFINED OPENTELEMETRY_BUILD_DLL)
target_link_libraries(example_yaml opentelemetry_cpp)
else()
target_link_libraries(example_yaml opentelemetry_configuration
opentelemetry_init
opentelemetry_common opentelemetry_trace)
target_link_libraries(
example_yaml opentelemetry_configuration opentelemetry_init
opentelemetry_common opentelemetry_trace)
endif()
6 changes: 3 additions & 3 deletions exporters/ostream/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

add_library(opentelemetry_exporter_ostream_span src/span_exporter.cc
src/span_exporter_factory.cc
src/console_builder.cc)
add_library(
opentelemetry_exporter_ostream_span
src/span_exporter.cc src/span_exporter_factory.cc src/console_builder.cc)

set_target_properties(opentelemetry_exporter_ostream_span
PROPERTIES EXPORT_NAME ostream_span_exporter)
Expand Down
19 changes: 7 additions & 12 deletions exporters/otlp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,9 @@ target_link_libraries(
opentelemetry_otlp_recordable
PUBLIC opentelemetry_trace opentelemetry_resources opentelemetry_proto)

add_library(
opentelemetry_otlp_builder src/otlp_builder.cc)
add_library(opentelemetry_otlp_builder src/otlp_builder.cc)
set_target_properties(opentelemetry_otlp_builder PROPERTIES EXPORT_NAME
otlp_builder)
otlp_builder)
set_target_version(opentelemetry_otlp_builder)

target_include_directories(
Expand All @@ -201,20 +200,16 @@ target_include_directories(
"$<INSTALL_INTERFACE:include>")

# Make sure to build with the proper ABI
target_link_libraries(
opentelemetry_otlp_builder
PUBLIC opentelemetry_api)
target_link_libraries(opentelemetry_otlp_builder PUBLIC opentelemetry_api)

if(WITH_OTLP_HTTP)
target_link_libraries(
opentelemetry_otlp_builder
PUBLIC opentelemetry_exporter_otlp_http)
target_link_libraries(opentelemetry_otlp_builder
PUBLIC opentelemetry_exporter_otlp_http)
endif()

if(WITH_OTLP_GRPC)
target_link_libraries(
opentelemetry_otlp_builder
PUBLIC opentelemetry_exporter_otlp_grpc)
target_link_libraries(opentelemetry_otlp_builder
PUBLIC opentelemetry_exporter_otlp_grpc)
endif()

if(OPENTELEMETRY_INSTALL)
Expand Down
24 changes: 9 additions & 15 deletions sdk/src/configuration/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

# DEAD
# yaml_document.cc yaml_document_node.cc
# DEAD yaml_document.cc yaml_document_node.cc

add_library(
opentelemetry_configuration
configuration_factory.cc
yaml_configuration_factory.cc
ryml_document.cc ryml_document_node.cc)
configuration_factory.cc yaml_configuration_factory.cc ryml_document.cc
ryml_document_node.cc)

set_target_properties(opentelemetry_configuration PROPERTIES EXPORT_NAME configuration)
set_target_properties(opentelemetry_configuration PROPERTIES EXPORT_NAME
configuration)
set_target_version(opentelemetry_configuration)

target_include_directories(
opentelemetry_configuration
PUBLIC "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/sdk/include>")

target_link_libraries(
opentelemetry_configuration
PUBLIC opentelemetry_api opentelemetry_common)
target_link_libraries(opentelemetry_configuration PUBLIC opentelemetry_api
opentelemetry_common)

# target_link_libraries(
# opentelemetry_configuration
# PUBLIC yaml-cpp::yaml-cpp)
# target_link_libraries( opentelemetry_configuration PUBLIC yaml-cpp::yaml-cpp)

target_link_libraries(
opentelemetry_configuration
PUBLIC ryml::ryml)
target_link_libraries(opentelemetry_configuration PUBLIC ryml::ryml)

if(OPENTELEMETRY_INSTALL)
install(
Expand Down
9 changes: 3 additions & 6 deletions sdk/src/init/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

add_library(
opentelemetry_init
configured_sdk.cc sdk_builder.cc registry.cc)
add_library(opentelemetry_init configured_sdk.cc sdk_builder.cc registry.cc)

set_target_properties(opentelemetry_init PROPERTIES EXPORT_NAME init)
set_target_version(opentelemetry_init)
Expand All @@ -12,9 +10,8 @@ target_include_directories(
opentelemetry_init
PUBLIC "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/sdk/include>")

target_link_libraries(
opentelemetry_init
PUBLIC opentelemetry_configuration opentelemetry_trace)
target_link_libraries(opentelemetry_init PUBLIC opentelemetry_configuration
opentelemetry_trace)

if(OPENTELEMETRY_INSTALL)
install(
Expand Down
11 changes: 3 additions & 8 deletions sdk/test/configuration/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

foreach(
testname
yaml_test)
foreach(testname yaml_test)
add_executable(${testname} "${testname}.cc")
target_link_libraries(
${testname}
${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
opentelemetry_configuration)
target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_configuration)
gtest_add_tests(
TARGET ${testname}
TEST_PREFIX trace.
Expand Down

0 comments on commit fde1025

Please sign in to comment.