diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/opentelemetry-cpp | |
Diffstat (limited to 'vcpkg/ports/opentelemetry-cpp')
| -rw-r--r-- | vcpkg/ports/opentelemetry-cpp/fix-target_link.patch | 17 | ||||
| -rw-r--r-- | vcpkg/ports/opentelemetry-cpp/portfile.cmake | 96 | ||||
| -rw-r--r-- | vcpkg/ports/opentelemetry-cpp/vcpkg.json | 108 |
3 files changed, 221 insertions, 0 deletions
diff --git a/vcpkg/ports/opentelemetry-cpp/fix-target_link.patch b/vcpkg/ports/opentelemetry-cpp/fix-target_link.patch new file mode 100644 index 0000000..f4709e8 --- /dev/null +++ b/vcpkg/ports/opentelemetry-cpp/fix-target_link.patch @@ -0,0 +1,17 @@ +diff --git a/cmake/opentracing-cpp.cmake b/cmake/opentracing-cpp.cmake +index f014ecd..fd8898a 100644 +--- a/cmake/opentracing-cpp.cmake ++++ b/cmake/opentracing-cpp.cmake +@@ -1,7 +1,11 @@ + # Copyright The OpenTelemetry Authors + # SPDX-License-Identifier: Apache-2.0 + +-find_package(OpenTracing CONFIG QUIET) ++find_package(OpenTracing CONFIG REQUIRED) ++if(NOT TARGET OpenTracing::opentracing AND TARGET OpenTracing::opentracing-static) ++ add_library(OpenTracing::opentracing ALIAS OpenTracing::opentracing-static) ++endif() ++ + set(OpenTracing_PROVIDER "find_package") + + if(NOT OpenTracing_FOUND) diff --git a/vcpkg/ports/opentelemetry-cpp/portfile.cmake b/vcpkg/ports/opentelemetry-cpp/portfile.cmake new file mode 100644 index 0000000..53c7578 --- /dev/null +++ b/vcpkg/ports/opentelemetry-cpp/portfile.cmake @@ -0,0 +1,96 @@ +if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO open-telemetry/opentelemetry-cpp + REF "v${VERSION}" + SHA512 6dc0357d8b3410852d3f970f72b8bec59dba9d6c533ca600432102e65de161903bd9170d98cef7ff0af5191309577ffd2a69ccd004b840914a910a6a282204e4 + HEAD_REF main + PATCHES + fix-target_link.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + etw WITH_ETW + zipkin WITH_ZIPKIN + prometheus WITH_PROMETHEUS + elasticsearch WITH_ELASTICSEARCH + otlp-file WITH_OTLP_FILE + otlp-http WITH_OTLP_HTTP + otlp-grpc WITH_OTLP_GRPC + geneva WITH_GENEVA + user-events WITH_USER_EVENTS + opentracing WITH_OPENTRACING + INVERTED_FEATURES + user-events BUILD_TRACEPOINTS +) + +# opentelemetry-proto is a third party submodule and opentelemetry-cpp release did not pack it. +if(WITH_OTLP_FILE OR WITH_OTLP_GRPC OR WITH_OTLP_HTTP) + set(OTEL_PROTO_VERSION "1.6.0") + vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/open-telemetry/opentelemetry-proto/archive/v${OTEL_PROTO_VERSION}.tar.gz" + FILENAME "opentelemetry-proto-${OTEL_PROTO_VERSION}.tar.gz" + SHA512 0e72e0c32d2d699d7a832a4c57a9dbe60e844d4c4e8d7b39eb45e4282cde89fccfeef893eae70b9d018643782090a7228c3ef60863b00747498e80f0cf1db8ae + ) + + vcpkg_extract_source_archive(src ARCHIVE "${ARCHIVE}") + file(REMOVE_RECURSE "${SOURCE_PATH}/third_party/opentelemetry-proto") + file(COPY "${src}/." DESTINATION "${SOURCE_PATH}/third_party/opentelemetry-proto") + # Create empty .git directory to prevent opentelemetry from cloning it during build time + file(MAKE_DIRECTORY "${SOURCE_PATH}/third_party/opentelemetry-proto/.git") + list(APPEND FEATURE_OPTIONS "-DgRPC_CPP_PLUGIN_EXECUTABLE=${CURRENT_HOST_INSTALLED_DIR}/tools/grpc/grpc_cpp_plugin${VCPKG_HOST_EXECUTABLE_SUFFIX}") +endif() +list(APPEND FEATURE_OPTIONS -DCMAKE_CXX_STANDARD=14) + +set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS "OFF") + +if(WITH_GENEVA OR WITH_USER_EVENTS) + # Geneva and user events exporters from opentelemetry-cpp-contrib are tightly coupled with opentelemetry-cpp repo, + # so they should be ported as a feature under opentelemetry-cpp. + clone_opentelemetry_cpp_contrib(CONTRIB_SOURCE_PATH) + + if(WITH_GENEVA) + set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS "${CONTRIB_SOURCE_PATH}/exporters/geneva") + if(VCPKG_TARGET_IS_WINDOWS) + set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS "${OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS}\;${CONTRIB_SOURCE_PATH}/exporters/geneva-trace") + else() + set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS "${OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS}\;${CONTRIB_SOURCE_PATH}/exporters/fluentd") + endif() + endif() + + if(WITH_USER_EVENTS) + if(WITH_GENEVA) + set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS "${OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS}\;${CONTRIB_SOURCE_PATH}/exporters/user_events") + else() + set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS "${CONTRIB_SOURCE_PATH}/exporters/user_events") + endif() + endif() +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DBUILD_TESTING=OFF + -DWITH_EXAMPLES=OFF + -DOPENTELEMETRY_INSTALL=ON + -DWITH_BENCHMARK=OFF + -DOPENTELEMETRY_EXTERNAL_COMPONENT_PATH=${OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS} + ${FEATURE_OPTIONS} + MAYBE_UNUSED_VARIABLES + WITH_GENEVA + WITH_USER_EVENTS + BUILD_TRACEPOINTS + gRPC_CPP_PLUGIN_EXECUTABLE +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}") +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/vcpkg/ports/opentelemetry-cpp/vcpkg.json b/vcpkg/ports/opentelemetry-cpp/vcpkg.json new file mode 100644 index 0000000..0570a7b --- /dev/null +++ b/vcpkg/ports/opentelemetry-cpp/vcpkg.json @@ -0,0 +1,108 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "name": "opentelemetry-cpp", + "version-semver": "1.23.0", + "description": [ + "OpenTelemetry is a collection of tools, APIs, and SDKs.", + "You use it to instrument, generate, collect, and export telemetry data (metrics, logs, and traces) for analysis in order to understand your software's performance and behavior." + ], + "homepage": "https://github.com/open-telemetry/opentelemetry-cpp", + "license": "Apache-2.0", + "dependencies": [ + "abseil", + "nlohmann-json", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "elasticsearch": { + "description": "Whether to include the Elasticsearch Client in the SDK", + "dependencies": [ + { + "name": "curl", + "default-features": false + } + ] + }, + "etw": { + "description": "Whether to include the ETW Exporter in the SDK", + "supports": "windows" + }, + "geneva": { + "description": "Whether to include the Geneva Exporter from the opentelemetry-cpp-contrib repository", + "dependencies": [ + { + "name": "opentelemetry-cpp", + "features": [ + "etw" + ], + "platform": "windows" + }, + "opentelemetry-cpp-contrib-version" + ] + }, + "opentracing": { + "description": "Whether to include the Opentracing shim", + "dependencies": [ + "opentracing" + ] + }, + "otlp-file": { + "description": "Whether to include the OpenTelemetry Protocol to File exporter in the SDK", + "supports": "!uwp", + "dependencies": [ + "protobuf" + ] + }, + "otlp-grpc": { + "description": "Whether to include the OTLP gRPC exporter in the SDK", + "dependencies": [ + "grpc", + { + "name": "grpc", + "host": true + } + ] + }, + "otlp-http": { + "description": "Whether to include the OpenTelemetry Protocol over HTTP in the SDK", + "dependencies": [ + "curl", + "protobuf" + ] + }, + "prometheus": { + "description": "Whether to include the Prometheus Client in the SDK", + "dependencies": [ + "prometheus-cpp" + ] + }, + "user-events": { + "description": "Whether to include the User Events Exporter from the opentelemetry-cpp-contrib repository", + "supports": "linux", + "dependencies": [ + "libeventheader-tracepoint", + "libtracepoint", + { + "name": "opentelemetry-cpp", + "features": [ + "otlp-http" + ] + }, + "opentelemetry-cpp-contrib-version" + ] + }, + "zipkin": { + "description": "Whether to include the Zipkin exporter in the SDK", + "dependencies": [ + "curl" + ] + } + } +} |