Skip to content

Commit dccad6f

Browse files
committed
2 parents 807207b + b99048f commit dccad6f

40 files changed

+2980
-866
lines changed

.github/workflows/cmake_install.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ jobs:
215215
run: ./ci/do_ci.sh cmake.opentracing_shim.install.test
216216

217217
ubuntu_2404_conan_latest:
218-
name: Ubuntu 24.04 conan latest versions cxx17 (static libs)
218+
name: Ubuntu 24.04 conan latest versions cxx17 (static libs - opentracing shim)
219219
runs-on: ubuntu-24.04
220220
env:
221221
INSTALL_TEST_DIR: '/home/runner/install_test'
@@ -248,6 +248,8 @@ jobs:
248248
run: |
249249
export PKG_CONFIG_PATH=$INSTALL_TEST_DIR/lib/pkgconfig:$PKG_CONFIG_PATH
250250
./ci/verify_packages.sh
251+
- name: Run OpenTracing Shim Test
252+
run: ./ci/do_ci.sh cmake.opentracing_shim.install.test
251253

252254
macos_14_conan_stable:
253255
name: macOS 14 conan stable versions cxx17 (static libs)

.github/workflows/project_management_comment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
egress-policy: audit
2121

2222
- name: Add comment
23-
uses: peter-evans/create-or-update-comment@bb25fe02fa2832725e15138f711e6bde1f6b7538
23+
uses: peter-evans/create-or-update-comment@4feedfc69c7773aff6dac1f1ab6fff8cfa955150
2424
with:
2525
issue-number: ${{ github.event.issue.number }}
2626
body: |

CMakeLists.txt

Lines changed: 33 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ project(opentelemetry-cpp)
3636
# Mark variables as used so cmake doesn't complain about them
3737
mark_as_advanced(CMAKE_TOOLCHAIN_FILE)
3838

39-
# Note: CMAKE_FIND_PACKAGE_PREFER_CONFIG requires cmake 3.15. Prefer cmake
40-
# CONFIG search mode to find dependencies. This is important to properly find
41-
# protobuf versions 3.22.0 and above due to the abseil-cpp dependency.
42-
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
43-
4439
# Don't use customized cmake modules if vcpkg is used to resolve dependence.
4540
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
4641
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")
@@ -79,10 +74,6 @@ if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
7974
CACHE STRING "")
8075
endif()
8176

82-
if(VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
83-
include("${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
84-
endif()
85-
8677
option(WITH_ABI_VERSION_1 "ABI version 1" ON)
8778
option(WITH_ABI_VERSION_2 "EXPERIMENTAL: ABI version 2 preview" OFF)
8879

@@ -284,6 +275,10 @@ if(WITH_EXAMPLES_HTTP AND NOT WITH_EXAMPLES)
284275
message(FATAL_ERROR "WITH_EXAMPLES_HTTP=ON requires WITH_EXAMPLES=ON")
285276
endif()
286277

278+
if(WITH_GSL)
279+
include("${opentelemetry-cpp_SOURCE_DIR}/cmake/ms-gsl.cmake")
280+
endif()
281+
287282
find_package(Threads)
288283

289284
function(set_target_version target_name)
@@ -310,49 +305,7 @@ endif()
310305
include(GNUInstallDirs)
311306

312307
if(WITH_PROMETHEUS)
313-
find_package(prometheus-cpp CONFIG QUIET)
314-
if(NOT prometheus-cpp_FOUND)
315-
message(STATUS "Trying to use local prometheus-cpp from submodule")
316-
if(EXISTS ${PROJECT_SOURCE_DIR}/third_party/prometheus-cpp/.git)
317-
set(SAVED_ENABLE_TESTING ${ENABLE_TESTING})
318-
set(SAVED_CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY})
319-
set(SAVED_CMAKE_CXX_INCLUDE_WHAT_YOU_USE
320-
${CMAKE_CXX_INCLUDE_WHAT_YOU_USE})
321-
set(ENABLE_TESTING OFF)
322-
set(CMAKE_CXX_CLANG_TIDY "")
323-
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "")
324-
add_subdirectory(third_party/prometheus-cpp)
325-
set(ENABLE_TESTING ${SAVED_ENABLE_TESTING})
326-
set(CMAKE_CXX_CLANG_TIDY ${SAVED_CMAKE_CXX_CLANG_TIDY})
327-
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE
328-
${SAVED_CMAKE_CXX_INCLUDE_WHAT_YOU_USE})
329-
330-
# Get the version of the prometheus-cpp submodule
331-
find_package(Git QUIET)
332-
if(Git_FOUND)
333-
execute_process(
334-
COMMAND ${GIT_EXECUTABLE} describe --tags --always
335-
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/third_party/prometheus-cpp
336-
OUTPUT_VARIABLE prometheus-cpp_VERSION
337-
OUTPUT_STRIP_TRAILING_WHITESPACE)
338-
string(REGEX REPLACE "^v" "" prometheus-cpp_VERSION
339-
"${prometheus-cpp_VERSION}")
340-
endif()
341-
342-
message(
343-
STATUS
344-
"Using local prometheus-cpp from submodule. Version = ${prometheus-cpp_VERSION}"
345-
)
346-
else()
347-
message(
348-
FATAL_ERROR
349-
"\nprometheus-cpp package was not found. Please either provide it manually or clone with submodules. "
350-
"To initialize, fetch and checkout any nested submodules, you can use the following command:\n"
351-
"git submodule update --init --recursive")
352-
endif()
353-
else()
354-
message(STATUS "Using external prometheus-cpp")
355-
endif()
308+
include("${opentelemetry-cpp_SOURCE_DIR}/cmake/prometheus-cpp.cmake")
356309
endif()
357310

358311
if(WITH_OTLP_GRPC
@@ -497,6 +450,14 @@ if((NOT WITH_API_ONLY) AND USE_NLOHMANN_JSON)
497450
include("${opentelemetry-cpp_SOURCE_DIR}/cmake/nlohmann-json.cmake")
498451
endif()
499452

453+
#
454+
# Do we need OpenTracing ?
455+
#
456+
457+
if(WITH_OPENTRACING)
458+
include("${opentelemetry-cpp_SOURCE_DIR}/cmake/opentracing-cpp.cmake")
459+
endif()
460+
500461
if(OTELCPP_MAINTAINER_MODE)
501462
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
502463
message(STATUS "Building with gcc in maintainer mode.")
@@ -678,11 +639,19 @@ message(STATUS "CMake: ${CMAKE_VERSION}")
678639
message(STATUS "GTest: ${GTest_VERSION} (${GTest_PROVIDER})")
679640
message(STATUS "benchmark: ${benchmark_VERSION} (${benchmark_PROVIDER})")
680641
if(WITH_GSL)
681-
message(STATUS "GSL: ${GSL_VERSION}")
642+
message(
643+
STATUS "Microsoft.GSL: ${Microsoft.GSL_VERSION} (${Microsoft.GSL_PROVIDER})"
644+
)
682645
endif()
683646
if(absl_FOUND)
684647
message(STATUS "Abseil: ${absl_VERSION}")
685648
endif()
649+
if(opentelemetry-proto_VERSION)
650+
message(
651+
STATUS
652+
"opentelemetry-proto: ${opentelemetry-proto_VERSION} (${opentelemetry-proto_PROVIDER})"
653+
)
654+
endif()
686655
if(Protobuf_FOUND)
687656
message(STATUS "Protobuf: ${Protobuf_VERSION}")
688657
endif()
@@ -696,10 +665,18 @@ if(ZLIB_FOUND)
696665
message(STATUS "ZLIB: ${ZLIB_VERSION}")
697666
endif()
698667
if(USE_NLOHMANN_JSON)
699-
message(STATUS "nlohmann-json: ${nlohmann_json_VERSION}")
668+
message(
669+
STATUS "nlohmann-json: ${nlohmann_json_VERSION} (${nlohmann_json_PROVIDER})"
670+
)
671+
endif()
672+
if(WITH_PROMETHEUS)
673+
message(
674+
STATUS
675+
"prometheus-cpp: ${prometheus-cpp_VERSION} (${prometheus-cpp_PROVIDER})")
700676
endif()
701-
if(prometheus-cpp_FOUND)
702-
message(STATUS "prometheus-cpp: ${prometheus-cpp_VERSION}")
677+
if(WITH_OPENTRACING)
678+
message(
679+
STATUS "opentracing-cpp: ${OpenTracing_VERSION} (${OpenTracing_PROVIDER})")
703680
endif()
704681
message(STATUS "---------------------------------------------")
705682

@@ -729,30 +706,6 @@ include_directories(api/include)
729706
add_subdirectory(api)
730707

731708
if(WITH_OPENTRACING)
732-
find_package(OpenTracing CONFIG QUIET)
733-
if(NOT OpenTracing_FOUND)
734-
set(OPENTRACING_DIR "third_party/opentracing-cpp")
735-
message(STATUS "Trying to use local ${OPENTRACING_DIR} from submodule")
736-
if(EXISTS "${PROJECT_SOURCE_DIR}/${OPENTRACING_DIR}/.git")
737-
set(SAVED_BUILD_TESTING ${BUILD_TESTING})
738-
set(BUILD_TESTING OFF)
739-
set(SAVED_CMAKE_CXX_INCLUDE_WHAT_YOU_USE
740-
${CMAKE_CXX_INCLUDE_WHAT_YOU_USE})
741-
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "")
742-
add_subdirectory(${OPENTRACING_DIR})
743-
set(BUILD_TESTING ${SAVED_BUILD_TESTING})
744-
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE
745-
${SAVED_CMAKE_CXX_INCLUDE_WHAT_YOU_USE})
746-
else()
747-
message(
748-
FATAL_ERROR
749-
"\nopentracing-cpp package was not found. Please either provide it manually or clone with submodules. "
750-
"To initialize, fetch and checkout any nested submodules, you can use the following command:\n"
751-
"git submodule update --init --recursive")
752-
endif()
753-
else()
754-
message(STATUS "Using external opentracing-cpp")
755-
endif()
756709
add_subdirectory(opentracing-shim)
757710
endif()
758711

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ bazel_dep(name = "rules_pkg", version = "1.1.0")
3939
bazel_dep(name = "rules_proto", version = "7.1.0")
4040
bazel_dep(name = "zlib", version = "1.3.1.bcr.6")
4141
bazel_dep(name = "opentracing-cpp", version = "1.6.0")
42-
bazel_dep(name = "rules_multitool", version = "1.5.0")
42+
bazel_dep(name = "rules_multitool", version = "1.6.0")
4343
bazel_dep(name = "protoc-gen-validate", version = "1.2.1.bcr.1")
4444
bazel_dep(name = "c-ares", version = "1.34.5")
4545
archive_override(

api/CMakeLists.txt

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,7 @@ target_include_directories(
99

1010
set_target_properties(opentelemetry_api PROPERTIES EXPORT_NAME api)
1111

12-
otel_add_component(
13-
COMPONENT
14-
api
15-
TARGETS
16-
opentelemetry_api
17-
FILES_DIRECTORY
18-
"include/opentelemetry"
19-
FILES_DESTINATION
20-
"include"
21-
FILES_MATCHING
22-
PATTERN
23-
"*.h")
24-
25-
if(OPENTELEMETRY_INSTALL)
26-
unset(TARGET_DEPS)
27-
endif()
12+
unset(TARGET_DEPS)
2813

2914
if(BUILD_TESTING)
3015
add_subdirectory(test)
@@ -74,18 +59,8 @@ endif()
7459

7560
if(WITH_GSL)
7661
target_compile_definitions(opentelemetry_api INTERFACE HAVE_GSL)
77-
78-
# Guidelines Support Library path. Used if we are not on not get C++20.
79-
#
80-
find_package(Microsoft.GSL QUIET)
81-
if(TARGET Microsoft.GSL::GSL)
82-
target_link_libraries(opentelemetry_api INTERFACE Microsoft.GSL::GSL)
83-
list(APPEND TARGET_DEPS "gsl")
84-
else()
85-
set(GSL_DIR third_party/ms-gsl)
86-
target_include_directories(
87-
opentelemetry_api INTERFACE "$<BUILD_INTERFACE:${GSL_DIR}/include>")
88-
endif()
62+
target_link_libraries(opentelemetry_api INTERFACE Microsoft.GSL::GSL)
63+
list(APPEND TARGET_DEPS "gsl")
8964
endif()
9065

9166
if(WITH_NO_GETENV)
@@ -140,6 +115,19 @@ if(APPLE)
140115
target_link_libraries(opentelemetry_api INTERFACE "-framework CoreFoundation")
141116
endif()
142117

118+
otel_add_component(
119+
COMPONENT
120+
api
121+
TARGETS
122+
opentelemetry_api
123+
FILES_DIRECTORY
124+
"include/opentelemetry"
125+
FILES_DESTINATION
126+
"include"
127+
FILES_MATCHING
128+
PATTERN
129+
"*.h")
130+
143131
include(${PROJECT_SOURCE_DIR}/cmake/pkgconfig.cmake)
144132

145133
if(OPENTELEMETRY_INSTALL)

0 commit comments

Comments
 (0)