Skip to content

Commit

Permalink
Building otlp exporter from the release tarball (#1056)
Browse files Browse the repository at this point in the history
  • Loading branch information
esigo authored Nov 10, 2021
1 parent 55aa7ea commit 435e377
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")
endif()

if(EXISTS "${CMAKE_SOURCE_DIR}/third_party_release")
file(STRINGS "${CMAKE_SOURCE_DIR}/third_party_release" third_party_tags)
foreach(third_party ${third_party_tags})
string(REGEX REPLACE "^[ ]+" "" third_party ${third_party})
string(REGEX MATCH "^[^=]+" third_party_name ${third_party})
string(REPLACE "${third_party_name}=" "" third_party_tag ${third_party})
set(${third_party_name} "${third_party_tag}")
endforeach()
endif()

if(DEFINED ENV{ARCH})
# Architecture may be specified via ARCH environment variable
set(ARCH $ENV{ARCH})
Expand Down
37 changes: 35 additions & 2 deletions cmake/opentelemetry-proto.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
include(${PROJECT_SOURCE_DIR}/cmake/proto-options-patch.cmake)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto/.git)
set(PROTO_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto")
set(needs_proto_download FALSE)
else()
if("${opentelemetry-proto}" STREQUAL "")
set(opentelemetry-proto "main")
endif()
include(ExternalProject)
ExternalProject_Add(opentelemetry-proto
GIT_REPOSITORY https://github.com/open-telemetry/opentelemetry-proto.git
GIT_TAG
"${opentelemetry-proto}"
UPDATE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
CONFIGURE_COMMAND ""
TEST_AFTER_INSTALL
0
DOWNLOAD_NO_PROGRESS
1
LOG_CONFIGURE
1
LOG_BUILD
1
LOG_INSTALL
1
)
ExternalProject_Get_Property(opentelemetry-proto INSTALL_DIR)
set(PROTO_PATH "${INSTALL_DIR}/src/opentelemetry-proto")
set(needs_proto_download TRUE)
endif()

set(PROTO_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto")
include(${PROJECT_SOURCE_DIR}/cmake/proto-options-patch.cmake)

set(COMMON_PROTO "${PROTO_PATH}/opentelemetry/proto/common/v1/common.proto")
set(RESOURCE_PROTO
Expand Down Expand Up @@ -138,6 +168,9 @@ add_library(
${METRICS_SERVICE_PB_CPP_FILE}
${METRICS_SERVICE_GRPC_PB_CPP_FILE})

if(needs_proto_download)
add_dependencies(opentelemetry_proto opentelemetry-proto)
endif()
set_target_properties(opentelemetry_proto PROPERTIES EXPORT_NAME proto)
patch_protobuf_targets(opentelemetry_proto)

Expand Down

0 comments on commit 435e377

Please sign in to comment.