@@ -79,48 +79,56 @@ set(TRACE_SERVICE_PB_CPP_FILE
7979set (TRACE_SERVICE_PB_H_FILE
8080 "${GENERATED_PROTOBUF_PATH} /opentelemetry/proto/collector/trace/v1/trace_service.pb.h"
8181)
82+ if (WITH_OTLP_GRPC)
8283set (TRACE_SERVICE_GRPC_PB_CPP_FILE
8384 "${GENERATED_PROTOBUF_PATH} /opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.cc"
8485)
8586set (TRACE_SERVICE_GRPC_PB_H_FILE
8687 "${GENERATED_PROTOBUF_PATH} /opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.h"
8788)
89+ endif ()
8890set (LOGS_SERVICE_PB_CPP_FILE
8991 "${GENERATED_PROTOBUF_PATH} /opentelemetry/proto/collector/logs/v1/logs_service.pb.cc"
9092)
9193set (LOGS_SERVICE_PB_H_FILE
9294 "${GENERATED_PROTOBUF_PATH} /opentelemetry/proto/collector/logs/v1/logs_service.pb.h"
9395)
96+ if (WITH_OTLP_GRPC)
9497set (LOGS_SERVICE_GRPC_PB_CPP_FILE
9598 "${GENERATED_PROTOBUF_PATH} /opentelemetry/proto/collector/logs/v1/logs_service.grpc.pb.cc"
9699)
97100set (LOGS_SERVICE_GRPC_PB_H_FILE
98101 "${GENERATED_PROTOBUF_PATH} /opentelemetry/proto/collector/logs/v1/logs_service.grpc.pb.h"
99102)
103+ endif ()
100104set (METRICS_SERVICE_PB_CPP_FILE
101105 "${GENERATED_PROTOBUF_PATH} /opentelemetry/proto/collector/metrics/v1/metrics_service.pb.cc"
102106)
103107set (METRICS_SERVICE_PB_H_FILE
104108 "${GENERATED_PROTOBUF_PATH} /opentelemetry/proto/collector/metrics/v1/metrics_service.pb.h"
105109)
110+ if (WITH_OTLP_GRPC)
106111set (METRICS_SERVICE_GRPC_PB_CPP_FILE
107112 "${GENERATED_PROTOBUF_PATH} /opentelemetry/proto/collector/metrics/v1/metrics_service.grpc.pb.cc"
108113)
109114set (METRICS_SERVICE_GRPC_PB_H_FILE
110115 "${GENERATED_PROTOBUF_PATH} /opentelemetry/proto/collector/metrics/v1/metrics_service.grpc.pb.h"
111116)
117+ endif ()
112118
113119foreach (IMPORT_DIR ${PROTOBUF_IMPORT_DIRS} )
114120 list (APPEND PROTOBUF_INCLUDE_FLAGS "-I${IMPORT_DIR} " )
115121endforeach ()
116122
117-
123+ if (WITH_OTLP_GRPC)
118124if (CMAKE_CROSSCOMPILING )
119125 find_program (gRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
120126else ()
121127 set (gRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
122128endif ()
129+ endif ()
123130
131+ if (WITH_OTLP_GRPC)
124132add_custom_command (
125133 OUTPUT ${COMMON_PB_H_FILE}
126134 ${COMMON_PB_CPP_FILE}
@@ -151,9 +159,34 @@ add_custom_command(
151159 --plugin=protoc-gen-grpc="${gRPC_CPP_PLUGIN_EXECUTABLE} " ${COMMON_PROTO}
152160 ${RESOURCE_PROTO} ${TRACE_PROTO} ${LOGS_PROTO} ${METRICS_PROTO}
153161 ${TRACE_SERVICE_PROTO} ${LOGS_SERVICE_PROTO} ${METRICS_SERVICE_PROTO} )
162+ else ()
163+ add_custom_command (
164+ OUTPUT ${COMMON_PB_H_FILE}
165+ ${COMMON_PB_CPP_FILE}
166+ ${RESOURCE_PB_H_FILE}
167+ ${RESOURCE_PB_CPP_FILE}
168+ ${TRACE_PB_H_FILE}
169+ ${TRACE_PB_CPP_FILE}
170+ ${LOGS_PB_H_FILE}
171+ ${LOGS_PB_CPP_FILE}
172+ ${METRICS_PB_H_FILE}
173+ ${METRICS_PB_CPP_FILE}
174+ ${TRACE_SERVICE_PB_H_FILE}
175+ ${TRACE_SERVICE_PB_CPP_FILE}
176+ ${LOGS_SERVICE_PB_H_FILE}
177+ ${LOGS_SERVICE_PB_CPP_FILE}
178+ ${METRICS_SERVICE_PB_H_FILE}
179+ ${METRICS_SERVICE_PB_CPP_FILE}
180+ COMMAND
181+ ${PROTOBUF_PROTOC_EXECUTABLE} ARGS "--proto_path=${PROTO_PATH} "
182+ ${PROTOBUF_INCLUDE_FLAGS} "--cpp_out=${GENERATED_PROTOBUF_PATH} "
183+ ${COMMON_PROTO} ${RESOURCE_PROTO} ${TRACE_PROTO} ${LOGS_PROTO} ${METRICS_PROTO}
184+ ${TRACE_SERVICE_PROTO} ${LOGS_SERVICE_PROTO} ${METRICS_SERVICE_PROTO} )
185+ endif ()
154186
155187include_directories ("${GENERATED_PROTOBUF_PATH} " )
156188
189+ if (WITH_OTLP_GRPC)
157190add_library (
158191 opentelemetry_proto STATIC
159192 ${COMMON_PB_CPP_FILE}
@@ -167,6 +200,18 @@ add_library(
167200 ${LOGS_SERVICE_GRPC_PB_CPP_FILE}
168201 ${METRICS_SERVICE_PB_CPP_FILE}
169202 ${METRICS_SERVICE_GRPC_PB_CPP_FILE} )
203+ else ()
204+ add_library (
205+ opentelemetry_proto STATIC
206+ ${COMMON_PB_CPP_FILE}
207+ ${RESOURCE_PB_CPP_FILE}
208+ ${TRACE_PB_CPP_FILE}
209+ ${LOGS_PB_CPP_FILE}
210+ ${METRICS_PB_CPP_FILE}
211+ ${TRACE_SERVICE_PB_CPP_FILE}
212+ ${LOGS_SERVICE_PB_CPP_FILE}
213+ ${METRICS_SERVICE_PB_CPP_FILE} )
214+ endif ()
170215
171216if (needs_proto_download)
172217 add_dependencies (opentelemetry_proto opentelemetry-proto)
0 commit comments