Skip to content

Commit a2bfaab

Browse files
authored
Update current dependencies to latest (#687)
* Update dependencies to latest packets * revert tap include change
1 parent 0a280c1 commit a2bfaab

File tree

14 files changed

+189
-766
lines changed

14 files changed

+189
-766
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ configure_file(golang/pkg/client/version.go.in ${PROJECT_SOURCE_DIR}/golang/pkg/
4747

4848
if(NOT DEFINED ENV{VERSION_ONLY})
4949

50-
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
50+
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_BINARY_DIR})
51+
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
5152

5253
set(CMAKE_CXX_STANDARD 17)
5354
set(CMAKE_CXX_STANDARD_REQUIRED ON)

cmake/FindCorrade.cmake

Lines changed: 0 additions & 633 deletions
This file was deleted.

cmake/opentelemetry-proto.cmake

Lines changed: 155 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,48 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
#
5-
# The dependency on opentelemetry-proto can be provided different ways.
6-
# By order of decreasing priority, options are:
5+
# The dependency on opentelemetry-proto can be provided different ways. By order
6+
# of decreasing priority, options are:
77
#
88
# 1 - Use a provided package
99
#
1010
# This is useful to build opentelemetry-cpp as part of a super project.
1111
#
12-
# The super project provides the path to the opentelemetry-proto
13-
# source code using variable ${OTELCPP_PROTO_PATH}
12+
# The super project provides the path to the opentelemetry-proto source code
13+
# using variable ${OTELCPP_PROTO_PATH}
1414
#
1515
# 2 - Search for a opentelemetry-proto git submodule
1616
#
17-
# When git submodule is used,
18-
# the opentelemetry-proto code is located in:
17+
# When git submodule is used, the opentelemetry-proto code is located in:
1918
# third_party/opentelemetry-proto
2019
#
2120
# 3 - Download opentelemetry-proto from github
2221
#
23-
# Code from the required version is used,
24-
# unless a specific release tag is provided
25-
# in variable ${opentelemetry-proto}
22+
# Code from the required version is used, unless a specific release tag is
23+
# provided in variable ${opentelemetry-proto}
2624
#
2725

2826
if(OTELCPP_PROTO_PATH)
29-
if(NOT EXISTS "${OTELCPP_PROTO_PATH}/opentelemetry/proto/common/v1/common.proto")
30-
message(FATAL_ERROR "OTELCPP_PROTO_PATH does not point to a opentelemetry-proto repository")
27+
if(NOT EXISTS
28+
"${OTELCPP_PROTO_PATH}/opentelemetry/proto/common/v1/common.proto")
29+
message(
30+
FATAL_ERROR
31+
"OTELCPP_PROTO_PATH does not point to a opentelemetry-proto repository")
3132
endif()
3233
message(STATUS "opentelemetry-proto dependency satisfied by: external path")
3334
set(PROTO_PATH ${OTELCPP_PROTO_PATH})
3435
set(needs_proto_download FALSE)
3536
else()
3637
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto/.git)
3738
message(STATUS "opentelemetry-proto dependency satisfied by: git submodule")
38-
set(PROTO_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto")
39+
set(PROTO_PATH
40+
"${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto")
3941
set(needs_proto_download FALSE)
4042
else()
41-
message(STATUS "opentelemetry-proto dependency satisfied by: github download")
43+
message(
44+
STATUS "opentelemetry-proto dependency satisfied by: github download")
4245
if("${opentelemetry-proto}" STREQUAL "")
43-
set(opentelemetry-proto "v0.19.0")
46+
set(opentelemetry-proto "v1.0.0")
4447
endif()
4548
include(ExternalProject)
4649
ExternalProject_Add(
@@ -62,8 +65,6 @@ else()
6265
endif()
6366
endif()
6467

65-
include(${PROJECT_SOURCE_DIR}/cmake/proto-options-patch.cmake)
66-
6768
set(COMMON_PROTO "${PROTO_PATH}/opentelemetry/proto/common/v1/common.proto")
6869
set(RESOURCE_PROTO
6970
"${PROTO_PATH}/opentelemetry/proto/resource/v1/resource.proto")
@@ -166,91 +167,129 @@ if(WITH_OTLP_GRPC)
166167
message(STATUS "gRPC_CPP_PLUGIN_EXECUTABLE=${gRPC_CPP_PLUGIN_EXECUTABLE}")
167168
endif()
168169

169-
if(WITH_OTLP_GRPC)
170-
add_custom_command(
171-
OUTPUT ${COMMON_PB_H_FILE}
172-
${COMMON_PB_CPP_FILE}
173-
${RESOURCE_PB_H_FILE}
174-
${RESOURCE_PB_CPP_FILE}
175-
${TRACE_PB_H_FILE}
176-
${TRACE_PB_CPP_FILE}
177-
${LOGS_PB_H_FILE}
178-
${LOGS_PB_CPP_FILE}
179-
${METRICS_PB_H_FILE}
180-
${METRICS_PB_CPP_FILE}
181-
${TRACE_SERVICE_PB_H_FILE}
182-
${TRACE_SERVICE_PB_CPP_FILE}
183-
${TRACE_SERVICE_GRPC_PB_H_FILE}
184-
${TRACE_SERVICE_GRPC_PB_CPP_FILE}
185-
${LOGS_SERVICE_PB_H_FILE}
186-
${LOGS_SERVICE_PB_CPP_FILE}
187-
${LOGS_SERVICE_GRPC_PB_H_FILE}
188-
${LOGS_SERVICE_GRPC_PB_CPP_FILE}
189-
${METRICS_SERVICE_PB_H_FILE}
190-
${METRICS_SERVICE_PB_CPP_FILE}
191-
${METRICS_SERVICE_GRPC_PB_H_FILE}
192-
${METRICS_SERVICE_GRPC_PB_CPP_FILE}
193-
COMMAND
194-
${PROTOBUF_PROTOC_EXECUTABLE} ARGS "--experimental_allow_proto3_optional"
195-
"--proto_path=${PROTO_PATH}" ${PROTOBUF_INCLUDE_FLAGS}
196-
"--cpp_out=${GENERATED_PROTOBUF_PATH}"
197-
"--grpc_out=generate_mock_code=true:${GENERATED_PROTOBUF_PATH}"
198-
--plugin=protoc-gen-grpc="${gRPC_CPP_PLUGIN_EXECUTABLE}" ${COMMON_PROTO}
199-
${RESOURCE_PROTO} ${TRACE_PROTO} ${LOGS_PROTO} ${METRICS_PROTO}
200-
${TRACE_SERVICE_PROTO} ${LOGS_SERVICE_PROTO} ${METRICS_SERVICE_PROTO})
201-
else()
202-
add_custom_command(
203-
OUTPUT ${COMMON_PB_H_FILE}
204-
${COMMON_PB_CPP_FILE}
205-
${RESOURCE_PB_H_FILE}
206-
${RESOURCE_PB_CPP_FILE}
207-
${TRACE_PB_H_FILE}
208-
${TRACE_PB_CPP_FILE}
209-
${LOGS_PB_H_FILE}
210-
${LOGS_PB_CPP_FILE}
211-
${METRICS_PB_H_FILE}
212-
${METRICS_PB_CPP_FILE}
213-
${TRACE_SERVICE_PB_H_FILE}
214-
${TRACE_SERVICE_PB_CPP_FILE}
215-
${LOGS_SERVICE_PB_H_FILE}
216-
${LOGS_SERVICE_PB_CPP_FILE}
217-
${METRICS_SERVICE_PB_H_FILE}
218-
${METRICS_SERVICE_PB_CPP_FILE}
219-
COMMAND
220-
${PROTOBUF_PROTOC_EXECUTABLE} ARGS "--experimental_allow_proto3_optional"
221-
"--proto_path=${PROTO_PATH}" ${PROTOBUF_INCLUDE_FLAGS}
222-
"--cpp_out=${GENERATED_PROTOBUF_PATH}" ${COMMON_PROTO} ${RESOURCE_PROTO}
223-
${TRACE_PROTO} ${LOGS_PROTO} ${METRICS_PROTO} ${TRACE_SERVICE_PROTO}
224-
${LOGS_SERVICE_PROTO} ${METRICS_SERVICE_PROTO})
170+
set(PROTOBUF_COMMON_FLAGS "--proto_path=${PROTO_PATH}"
171+
"--cpp_out=${GENERATED_PROTOBUF_PATH}")
172+
# --experimental_allow_proto3_optional is available from 3.13 and be stable and
173+
# enabled by default from 3.16
174+
if(Protobuf_VERSION AND Protobuf_VERSION VERSION_LESS "3.16")
175+
list(APPEND PROTOBUF_COMMON_FLAGS "--experimental_allow_proto3_optional")
176+
elseif(PROTOBUF_VERSION AND PROTOBUF_VERSION VERSION_LESS "3.16")
177+
list(APPEND PROTOBUF_COMMON_FLAGS "--experimental_allow_proto3_optional")
225178
endif()
226179

227-
include_directories("${GENERATED_PROTOBUF_PATH}")
228-
229-
if(WITH_OTLP_GRPC)
230-
add_library(
231-
opentelemetry_proto STATIC
180+
set(PROTOBUF_GENERATED_FILES
181+
${COMMON_PB_H_FILE}
232182
${COMMON_PB_CPP_FILE}
183+
${RESOURCE_PB_H_FILE}
233184
${RESOURCE_PB_CPP_FILE}
185+
${TRACE_PB_H_FILE}
234186
${TRACE_PB_CPP_FILE}
187+
${LOGS_PB_H_FILE}
235188
${LOGS_PB_CPP_FILE}
189+
${METRICS_PB_H_FILE}
236190
${METRICS_PB_CPP_FILE}
191+
${TRACE_SERVICE_PB_H_FILE}
237192
${TRACE_SERVICE_PB_CPP_FILE}
238-
${TRACE_SERVICE_GRPC_PB_CPP_FILE}
193+
${LOGS_SERVICE_PB_H_FILE}
239194
${LOGS_SERVICE_PB_CPP_FILE}
195+
${METRICS_SERVICE_PB_H_FILE}
196+
${METRICS_SERVICE_PB_CPP_FILE})
197+
198+
if(WITH_OTLP_GRPC)
199+
list(APPEND PROTOBUF_COMMON_FLAGS
200+
"--grpc_out=generate_mock_code=true:${GENERATED_PROTOBUF_PATH}"
201+
--plugin=protoc-gen-grpc="${gRPC_CPP_PLUGIN_EXECUTABLE}")
202+
203+
list(
204+
APPEND
205+
PROTOBUF_GENERATED_FILES
206+
${TRACE_SERVICE_GRPC_PB_H_FILE}
207+
${TRACE_SERVICE_GRPC_PB_CPP_FILE}
208+
${LOGS_SERVICE_GRPC_PB_H_FILE}
240209
${LOGS_SERVICE_GRPC_PB_CPP_FILE}
241-
${METRICS_SERVICE_PB_CPP_FILE}
210+
${METRICS_SERVICE_GRPC_PB_H_FILE}
242211
${METRICS_SERVICE_GRPC_PB_CPP_FILE})
212+
endif()
213+
214+
set(PROTOBUF_RUN_PROTOC_COMMAND "\"${PROTOBUF_PROTOC_EXECUTABLE}\"")
215+
foreach(
216+
PROTOBUF_RUN_PROTOC_ARG
217+
${PROTOBUF_COMMON_FLAGS}
218+
${PROTOBUF_INCLUDE_FLAGS}
219+
${COMMON_PROTO}
220+
${RESOURCE_PROTO}
221+
${TRACE_PROTO}
222+
${LOGS_PROTO}
223+
${METRICS_PROTO}
224+
${TRACE_SERVICE_PROTO}
225+
${LOGS_SERVICE_PROTO}
226+
${METRICS_SERVICE_PROTO})
227+
set(PROTOBUF_RUN_PROTOC_COMMAND
228+
"${PROTOBUF_RUN_PROTOC_COMMAND} \"${PROTOBUF_RUN_PROTOC_ARG}\"")
229+
endforeach()
230+
231+
add_custom_command(
232+
OUTPUT ${PROTOBUF_GENERATED_FILES}
233+
COMMAND
234+
${PROTOBUF_PROTOC_EXECUTABLE} ${PROTOBUF_COMMON_FLAGS}
235+
${PROTOBUF_INCLUDE_FLAGS} ${COMMON_PROTO} ${RESOURCE_PROTO} ${TRACE_PROTO}
236+
${LOGS_PROTO} ${METRICS_PROTO} ${TRACE_SERVICE_PROTO} ${LOGS_SERVICE_PROTO}
237+
${METRICS_SERVICE_PROTO}
238+
COMMENT "[Run]: ${PROTOBUF_RUN_PROTOC_COMMAND}")
239+
240+
include_directories("${GENERATED_PROTOBUF_PATH}")
241+
242+
unset(OTELCPP_PROTO_TARGET_OPTIONS)
243+
if(CMAKE_SYSTEM_NAME MATCHES "Windows|MinGW|WindowsStore")
244+
list(APPEND OTELCPP_PROTO_TARGET_OPTIONS STATIC)
245+
elseif(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
246+
list(APPEND OTELCPP_PROTO_TARGET_OPTIONS SHARED)
243247
else()
248+
list(APPEND OTELCPP_PROTO_TARGET_OPTIONS STATIC)
249+
endif()
250+
251+
set(OPENTELEMETRY_PROTO_TARGETS opentelemetry_proto)
252+
add_library(
253+
opentelemetry_proto
254+
${OTELCPP_PROTO_TARGET_OPTIONS}
255+
${COMMON_PB_CPP_FILE}
256+
${RESOURCE_PB_CPP_FILE}
257+
${TRACE_PB_CPP_FILE}
258+
${LOGS_PB_CPP_FILE}
259+
${METRICS_PB_CPP_FILE}
260+
${TRACE_SERVICE_PB_CPP_FILE}
261+
${LOGS_SERVICE_PB_CPP_FILE}
262+
${METRICS_SERVICE_PB_CPP_FILE})
263+
264+
if(WITH_ABSEIL)
265+
target_link_libraries(opentelemetry_proto PUBLIC absl::bad_variant_access)
266+
endif()
267+
268+
if(WITH_OTLP_GRPC)
244269
add_library(
245-
opentelemetry_proto STATIC
246-
${COMMON_PB_CPP_FILE}
247-
${RESOURCE_PB_CPP_FILE}
248-
${TRACE_PB_CPP_FILE}
249-
${LOGS_PB_CPP_FILE}
250-
${METRICS_PB_CPP_FILE}
251-
${TRACE_SERVICE_PB_CPP_FILE}
252-
${LOGS_SERVICE_PB_CPP_FILE}
253-
${METRICS_SERVICE_PB_CPP_FILE})
270+
opentelemetry_proto_grpc
271+
${OTELCPP_PROTO_TARGET_OPTIONS} ${TRACE_SERVICE_GRPC_PB_CPP_FILE}
272+
${LOGS_SERVICE_GRPC_PB_CPP_FILE} ${METRICS_SERVICE_GRPC_PB_CPP_FILE})
273+
274+
list(APPEND OPENTELEMETRY_PROTO_TARGETS opentelemetry_proto_grpc)
275+
target_link_libraries(opentelemetry_proto_grpc
276+
PUBLIC opentelemetry_proto)
277+
278+
get_target_property(grpc_lib_type gRPC::grpc++ TYPE)
279+
if (grpc_lib_type STREQUAL "SHARED_LIBRARY")
280+
target_link_libraries(opentelemetry_proto_grpc
281+
PUBLIC gRPC::grpc++)
282+
endif()
283+
set_target_properties(opentelemetry_proto_grpc PROPERTIES EXPORT_NAME
284+
proto_grpc)
285+
patch_protobuf_targets(opentelemetry_proto_grpc)
286+
get_target_property(GRPC_INCLUDE_DIRECTORY gRPC::grpc++
287+
INTERFACE_INCLUDE_DIRECTORIES)
288+
if(GRPC_INCLUDE_DIRECTORY)
289+
target_include_directories(
290+
opentelemetry_proto_grpc
291+
PUBLIC "$<BUILD_INTERFACE:${GRPC_INCLUDE_DIRECTORY}>")
292+
endif()
254293
endif()
255294

256295
if(needs_proto_download)
@@ -259,27 +298,41 @@ endif()
259298
set_target_properties(opentelemetry_proto PROPERTIES EXPORT_NAME proto)
260299
patch_protobuf_targets(opentelemetry_proto)
261300

262-
install(
263-
TARGETS opentelemetry_proto
264-
EXPORT "${PROJECT_NAME}-target"
265-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
266-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
267-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
301+
if(OPENTELEMETRY_INSTALL)
302+
install(
303+
TARGETS ${OPENTELEMETRY_PROTO_TARGETS}
304+
EXPORT "${PROJECT_NAME}-target"
305+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
306+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
307+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
268308

269-
install(
270-
DIRECTORY ${GENERATED_PROTOBUF_PATH}/opentelemetry
271-
DESTINATION include
272-
FILES_MATCHING
273-
PATTERN "*.h")
309+
install(
310+
DIRECTORY ${GENERATED_PROTOBUF_PATH}/opentelemetry
311+
DESTINATION include
312+
FILES_MATCHING
313+
PATTERN "*.h")
314+
endif()
274315

275316
if(TARGET protobuf::libprotobuf)
276317
target_link_libraries(opentelemetry_proto PUBLIC ${CONAN_LIBS_PROTOBUF})
277318
else() # cmake 3.8 or lower
278319
target_include_directories(opentelemetry_proto
279320
PUBLIC ${Protobuf_INCLUDE_DIRS})
280-
target_link_libraries(opentelemetry_proto INTERFACE ${Protobuf_LIBRARIES})
321+
target_link_libraries(opentelemetry_proto PUBLIC ${Protobuf_LIBRARIES})
281322
endif()
282323

283-
if(BUILD_SHARED_LIBS)
284-
set_property(TARGET opentelemetry_proto PROPERTY POSITION_INDEPENDENT_CODE ON)
324+
if(WITH_OTLP_GRPC)
325+
if(WITH_ABSEIL)
326+
find_package(absl CONFIG)
327+
if(TARGET absl::synchronization)
328+
target_link_libraries(opentelemetry_proto_grpc
329+
PRIVATE absl::synchronization)
330+
endif()
331+
endif()
285332
endif()
333+
334+
if(BUILD_SHARED_LIBS)
335+
foreach(proto_target ${OPENTELEMETRY_PROTO_TARGETS})
336+
set_property(TARGET ${proto_target} PROPERTY POSITION_INDEPENDENT_CODE ON)
337+
endforeach()
338+
endif()
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ endmacro()
1111
if(NOT PATCH_PROTOBUF_SOURCES_OPTIONS_SET)
1212
if(MSVC)
1313
unset(PATCH_PROTOBUF_SOURCES_OPTIONS CACHE)
14-
set(PATCH_PROTOBUF_SOURCES_OPTIONS /wd4244 /wd4251 /wd4267 /wd4309)
14+
set(PATCH_PROTOBUF_SOURCES_OPTIONS /wd4244 /wd4251 /wd4267 /wd4309 /wd4668 /wd4946 /wd6001 /wd6244 /wd6246)
1515

1616
if(MSVC_VERSION GREATER_EQUAL 1922)
1717
# see
@@ -31,7 +31,7 @@ if(NOT PATCH_PROTOBUF_SOURCES_OPTIONS_SET)
3131
unset(PATCH_PROTOBUF_SOURCES_OPTIONS CACHE)
3232
include(CheckCXXCompilerFlag)
3333
check_append_cxx_compiler_flag(
34-
PATCH_PROTOBUF_SOURCES_OPTIONS -Wno-type-limits
34+
PATCH_PROTOBUF_SOURCES_OPTIONS -Wno-type-limits -Wno-missing-declarations
3535
-Wno-deprecated-declarations -Wno-unused-parameter)
3636
endif()
3737
set(PATCH_PROTOBUF_SOURCES_OPTIONS_SET TRUE)

0 commit comments

Comments
 (0)