mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-26 17:41:09 +08:00
b6162358cd
Co-authored-by: Mengna-Li <v-limengna@microsoft.com>
95 lines
3.7 KiB
CMake
95 lines
3.7 KiB
CMake
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 67c7644d95d1aa3c217a414148ed90d19ce03bc5ed5b9e700866d66b9eda411d8261355e56a5e3888a993a9a2c15aab77edb8b0a45fc28fde923169ad4d41852
|
|
HEAD_REF main
|
|
PATCHES
|
|
cmake-quirks.diff
|
|
)
|
|
|
|
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
|
FEATURES
|
|
etw WITH_ETW
|
|
zipkin WITH_ZIPKIN
|
|
prometheus WITH_PROMETHEUS
|
|
elasticsearch WITH_ELASTICSEARCH
|
|
otlp-http WITH_OTLP_HTTP
|
|
otlp-grpc WITH_OTLP_GRPC
|
|
geneva WITH_GENEVA
|
|
user-events WITH_USER_EVENTS
|
|
INVERTED_FEATURES
|
|
user-events BUILD_TRACEPOINTS
|
|
)
|
|
|
|
# opentelemetry-proto is a third party submodule and opentelemetry-cpp release did not pack it.
|
|
if(WITH_OTLP_GRPC OR WITH_OTLP_HTTP)
|
|
set(OTEL_PROTO_VERSION "1.4.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 9837485d7b9f7b95330a9a48f133b2a36ed5b670a6f0fe1e3bd23def46210a681525d47c7633b3c8bec2cc7ece4dfc373c859539a2729812ce7ceafc6d4c6896
|
|
)
|
|
|
|
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 -DCMAKE_CXX_STANDARD=14)
|
|
list(APPEND FEATURE_OPTIONS "-DgRPC_CPP_PLUGIN_EXECUTABLE=${CURRENT_HOST_INSTALLED_DIR}/tools/grpc/grpc_cpp_plugin${VCPKG_HOST_EXECUTABLE_SUFFIX}")
|
|
endif()
|
|
|
|
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_ABSEIL=ON
|
|
-DWITH_BENCHMARK=OFF
|
|
-DOPENTELEMETRY_EXTERNAL_COMPONENT_PATH=${OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS}
|
|
${FEATURE_OPTIONS}
|
|
MAYBE_UNUSED_VARIABLES
|
|
WITH_GENEVA
|
|
WITH_USER_EVENTS
|
|
BUILD_TRACEPOINTS
|
|
)
|
|
|
|
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")
|