Skip to content

Commit f98d198

Browse files
authored
Merge branch 'main' into expo-histo-aggregation-4
2 parents 8cf15c4 + 34375d7 commit f98d198

File tree

38 files changed

+285
-140
lines changed

38 files changed

+285
-140
lines changed

.github/workflows/cmake_install.yml

+63-31
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ on:
88
branches: [ main ]
99

1010
jobs:
11-
windows_2022_vcpkg:
12-
name: Windows 2022 vcpkg cxx17 (static libs - dll)
11+
windows_2022_vcpkg_submodule:
12+
name: Windows 2022 vcpkg submodule versions cxx17 (static libs - dll)
1313
runs-on: windows-2022
1414
env:
15+
# Set to the latest version of cmake 3.x
16+
CMAKE_VERSION: '3.31.6'
17+
# cxx17 is the default for windows-2022
1518
CXX_STANDARD: '17'
1619
steps:
1720
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -26,10 +29,13 @@ jobs:
2629
- name: Run DLL Tests
2730
run: ./ci/do_ci.ps1 cmake.dll.install.test
2831

29-
windows_2019_vcpkg:
30-
name: Windows 2019 vcpkg cxx14 (static libs)
32+
windows_2019_vcpkg_submodule_min_cmake:
33+
name: Windows 2019 vcpkg submodule versions minimum cmake cxx14 (static libs)
3134
runs-on: windows-2019
3235
env:
36+
# cmake 3.15 is the minimum for windows builds (See https://github.com/open-telemetry/opentelemetry-cpp/pull/3349#discussion_r2030319430)
37+
CMAKE_VERSION: '3.15.0'
38+
# cxx14 is the default for windows-2019
3339
CXX_STANDARD: '14'
3440
steps:
3541
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -47,6 +53,9 @@ jobs:
4753
runs-on: ubuntu-24.04
4854
env:
4955
INSTALL_TEST_DIR: '/home/runner/install_test'
56+
# CMake 3.28 is apt package version for Ubuntu 24.04
57+
CMAKE_VERSION: '3.28.3'
58+
# cxx17 is the default for Ubuntu 24.04
5059
CXX_STANDARD: '17'
5160
BUILD_TYPE: 'Debug'
5261
steps:
@@ -71,12 +80,22 @@ jobs:
7180
BUILD_SHARED_LIBS: 'ON'
7281
run: ./ci/do_ci.sh cmake.install.test
7382

74-
ubuntu_2404_script_build_grpc_1_71_0:
75-
name: Ubuntu 24.04 script grpc 1.71.0 cxx17 (static libs)
83+
ubuntu_2404_latest:
84+
name: Ubuntu 24.04 latest versions cxx20 (static libs)
7685
runs-on: ubuntu-24.04
7786
env:
7887
INSTALL_TEST_DIR: '/home/runner/install_test'
88+
# Set to the latest version of cmake 3.x
89+
CMAKE_VERSION: '3.31.6'
90+
# Set to the latest cxx standard supported by opentelemetry-cpp
7991
CXX_STANDARD: '20'
92+
# Versions below set to the latest version available
93+
# The abseil and protobuf versions are taken from
94+
# the grpc submodules at the GRPC_VERSION tag
95+
GOOGLETEST_VERSION: '1.16.0'
96+
ABSEIL_CPP_VERSION: '20240722.1'
97+
PROTOBUF_VERSION: '29.0'
98+
GRPC_VERSION: 'v1.71.0'
8099
BUILD_TYPE: 'Debug'
81100
steps:
82101
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -88,10 +107,6 @@ jobs:
88107
sudo -E ./ci/setup_cmake.sh
89108
sudo -E ./ci/setup_googletest.sh
90109
- name: Build abseil, protobuf, and grpc with ci scripts
91-
env:
92-
ABSEIL_CPP_VERSION: '20240722.1'
93-
PROTOBUF_VERSION: '29.0'
94-
GRPC_VERSION: 'v1.71.0'
95110
run: |
96111
sudo -E ./ci/install_abseil.sh
97112
sudo -E ./ci/install_protobuf.sh
@@ -101,12 +116,20 @@ jobs:
101116
BUILD_SHARED_LIBS: 'OFF'
102117
run: ./ci/do_ci.sh cmake.install.test
103118

104-
ubuntu_2204_script_build_grpc_1_55_0:
105-
name: Ubuntu 22.04 script grpc 1.55.0 cxx17 (static libs - shared libs)
119+
ubuntu_2204_stable:
120+
name: Ubuntu 22.04 stable versions cxx17 (static libs - shared libs)
106121
runs-on: ubuntu-22.04
107122
env:
108123
INSTALL_TEST_DIR: '/home/runner/install_test'
124+
# CMake 3.22 is the apt package version for Ubuntu 22.04
125+
CMAKE_VERSION: '3.22.0'
109126
CXX_STANDARD: '17'
127+
# These are stable versions tested in the main ci workflow
128+
# and defaults in the devcontainer
129+
GOOGLETEST_VERSION: '1.14.0'
130+
ABSEIL_CPP_VERSION: '20230125.3'
131+
PROTOBUF_VERSION: '23.3'
132+
GRPC_VERSION: 'v1.55.0'
110133
BUILD_TYPE: 'Debug'
111134
steps:
112135
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -118,10 +141,6 @@ jobs:
118141
sudo -E ./ci/setup_cmake.sh
119142
sudo -E ./ci/setup_googletest.sh
120143
- name: Build abseil, protobuf, and grpc with ci scripts
121-
env:
122-
ABSEIL_CPP_VERSION: '20230125.3'
123-
PROTOBUF_VERSION: '23.3'
124-
GRPC_VERSION: 'v1.55.0'
125144
run: |
126145
sudo -E ./ci/install_abseil.sh
127146
sudo -E ./ci/install_protobuf.sh
@@ -135,12 +154,21 @@ jobs:
135154
BUILD_SHARED_LIBS: 'ON'
136155
run: ./ci/do_ci.sh cmake.install.test
137156

138-
ubuntu_2204_script_build_grpc_1_49_2:
139-
name: Ubuntu 22.04 script grpc 1.49.2 cxx14 (static libs - shared libs)
157+
ubuntu_2204_minimum:
158+
name: Ubuntu 22.04 minimum versions cxx14 (static libs - shared libs)
140159
runs-on: ubuntu-22.04
141160
env:
142161
INSTALL_TEST_DIR: '/home/runner/install_test'
162+
# Set to the current minimum version of cmake
163+
CMAKE_VERSION: '3.14.0'
164+
# cxx14 is the default for Ubuntu 22.04
143165
CXX_STANDARD: '14'
166+
# This is the apt package version of googletest for Ubuntu 22.04
167+
GOOGLETEST_VERSION: '1.11.0'
168+
# These are minimum versions tested in the main ci workflow
169+
ABSEIL_CPP_VERSION: '20220623.2'
170+
PROTOBUF_VERSION: '21.12'
171+
GRPC_VERSION: 'v1.49.2'
144172
BUILD_TYPE: 'Debug'
145173
steps:
146174
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -152,10 +180,6 @@ jobs:
152180
sudo -E ./ci/setup_cmake.sh
153181
sudo -E ./ci/setup_googletest.sh
154182
- name: Build abseil, protobuf, and grpc with ci scripts
155-
env:
156-
ABSEIL_CPP_VERSION: '20220623.2'
157-
PROTOBUF_VERSION: '21.12'
158-
GRPC_VERSION: 'v1.49.2'
159183
run: |
160184
sudo -E ./ci/install_abseil.sh
161185
sudo -E ./ci/install_protobuf.sh
@@ -170,10 +194,12 @@ jobs:
170194
run: ./ci/do_ci.sh cmake.install.test
171195

172196
ubuntu_2404_conan_stable:
173-
name: Ubuntu 24.04 conan stable cxx17 (static libs - shared libs - opentracing shim)
197+
name: Ubuntu 24.04 conan stable versions cxx17 (static libs - shared libs - opentracing shim)
174198
runs-on: ubuntu-24.04
175199
env:
176200
INSTALL_TEST_DIR: '/home/runner/install_test'
201+
# CMake 3.28 is apt package version for Ubuntu 24.04
202+
CMAKE_VERSION: '3.28.3'
177203
CXX_STANDARD: '17'
178204
CMAKE_TOOLCHAIN_FILE: /home/runner/conan/build/Debug/generators/conan_toolchain.cmake
179205
BUILD_TYPE: 'Debug'
@@ -189,7 +215,7 @@ jobs:
189215
- name: Install or build all dependencies with Conan
190216
run: |
191217
sudo -E ./ci/setup_cmake.sh
192-
conan install install/conan/conanfile_stable.txt --build=missing -of /home/runner/conan -s build_type=Debug
218+
conan install install/conan/conanfile_stable.txt --build=missing -of /home/runner/conan -s build_type=${BUILD_TYPE} -s compiler.cppstd=${CXX_STANDARD}
193219
- name: Run Tests (static libs)
194220
env:
195221
BUILD_SHARED_LIBS: 'OFF'
@@ -206,10 +232,12 @@ jobs:
206232
run: ./ci/do_ci.sh cmake.opentracing_shim.install.test
207233

208234
ubuntu_2404_conan_latest:
209-
name: Ubuntu 24.04 conan latest cxx17 (static libs)
235+
name: Ubuntu 24.04 conan latest versions cxx17 (static libs)
210236
runs-on: ubuntu-24.04
211237
env:
212238
INSTALL_TEST_DIR: '/home/runner/install_test'
239+
# Set to the latest version of cmake 3.x
240+
CMAKE_VERSION: '3.31.6'
213241
CXX_STANDARD: '17'
214242
CMAKE_TOOLCHAIN_FILE: /home/runner/conan/build/Debug/generators/conan_toolchain.cmake
215243
BUILD_TYPE: 'Debug'
@@ -225,7 +253,7 @@ jobs:
225253
- name: Install or build all dependencies with Conan
226254
run: |
227255
sudo -E ./ci/setup_cmake.sh
228-
conan install install/conan/conanfile_latest.txt --build=missing -of /home/runner/conan -s build_type=Debug
256+
conan install install/conan/conanfile_latest.txt --build=missing -of /home/runner/conan -s build_type=${BUILD_TYPE} -s compiler.cppstd=${CXX_STANDARD}
229257
- name: Run Tests (static libs)
230258
env:
231259
BUILD_SHARED_LIBS: 'OFF'
@@ -236,10 +264,11 @@ jobs:
236264
./ci/verify_packages.sh
237265
238266
macos_14_conan_stable:
239-
name: macOS 14 conan stable cxx17 (static libs)
267+
name: macOS 14 conan stable versions cxx17 (static libs)
240268
runs-on: macos-14
241269
env:
242270
INSTALL_TEST_DIR: '/Users/runner/install_test'
271+
CMAKE_VERSION: '3.28.3'
243272
CXX_STANDARD: '17'
244273
CMAKE_TOOLCHAIN_FILE: '/Users/runner/conan/build/Debug/generators/conan_toolchain.cmake'
245274
BUILD_TYPE: 'Debug'
@@ -250,19 +279,22 @@ jobs:
250279
- name: Install Conan and tools
251280
run: |
252281
brew install conan autoconf automake libtool coreutils
253-
sudo -E ./ci/setup_cmake_macos.sh
282+
./ci/setup_cmake_macos.sh
254283
conan profile detect --force
255284
- name: Install or build all dependencies with Conan
256-
run: conan install install/conan/conanfile_stable.txt --build=missing -of /Users/runner/conan -s build_type=Debug
285+
run: conan install install/conan/conanfile_stable.txt --build=missing -of /Users/runner/conan -s build_type=${BUILD_TYPE} -s compiler.cppstd=${CXX_STANDARD}
257286
- name: Run Tests (static libs)
258287
env:
259288
BUILD_SHARED_LIBS: 'OFF'
260289
run: ./ci/do_ci.sh cmake.install.test
261290

262291
macos_14_brew_packages:
263-
name: macOS 14 brew packages cxx17 (static libs)
292+
name: macOS 14 brew latest versions cxx17 (static libs)
264293
runs-on: macos-14
265294
env:
295+
INSTALL_TEST_DIR: '/Users/runner/install_test'
296+
# Set to the latest version of cmake 3.x
297+
CMAKE_VERSION: '3.31.6'
266298
CXX_STANDARD: '17'
267299
BUILD_TYPE: 'Debug'
268300
steps:
@@ -271,7 +303,7 @@ jobs:
271303
submodules: 'recursive'
272304
- name: Install Dependencies with Homebrew
273305
run: |
274-
sudo -E ./ci/setup_cmake_macos.sh
306+
./ci/setup_cmake_macos.sh
275307
brew install coreutils
276308
brew install googletest
277309
brew install google-benchmark

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ Increment the:
2929
* [API] Remove `WITH_ABSEIL` and `HAVE_ABSEIL`
3030
[#3318](https://github.com/open-telemetry/opentelemetry-cpp/pull/3318)
3131

32+
* [CMAKE] Bump cmake minimum required version to 3.14
33+
[#3349](https://github.com/open-telemetry/opentelemetry-cpp/pull/3349)
34+
3235
## [1.20 2025-04-01]
3336

3437
* [BUILD] Update opentelemetry-proto version

CMakeLists.txt

+38-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright The OpenTelemetry Authors
22
# SPDX-License-Identifier: Apache-2.0
33

4-
cmake_minimum_required(VERSION 3.10)
4+
cmake_minimum_required(VERSION 3.14)
55

66
# See https://cmake.org/cmake/help/latest/policy/CMP0074.html required by
77
# certain version of zlib which CURL depends on.
@@ -36,8 +36,9 @@ project(opentelemetry-cpp)
3636
# Mark variables as used so cmake doesn't complain about them
3737
mark_as_advanced(CMAKE_TOOLCHAIN_FILE)
3838

39-
# Prefer cmake CONFIG to auto resolve dependencies. This is important to
40-
# properly find protobuf versions 3.22.0 and above
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.
4142
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
4243

4344
# Don't use customized cmake modules if vcpkg is used to resolve dependence.
@@ -420,15 +421,32 @@ if(WITH_OTLP_GRPC
420421
OR WITH_OTLP_HTTP
421422
OR WITH_OTLP_FILE)
422423

423-
find_package(Protobuf)
424-
# Protobuf 3.22 or upper require abseil-cpp, we can find it in
425-
# opentelemetry-cpp-config.cmake
424+
# Including the CMakeFindDependencyMacro resolves an error from
425+
# gRPCConfig.cmake on some grpc versions. See
426+
# https://github.com/grpc/grpc/pull/33361 for more details.
427+
include(CMakeFindDependencyMacro)
428+
429+
# Protobuf 3.22+ depends on abseil-cpp and must be found using the cmake
430+
# find_package CONFIG search mode. The following attempts to find Protobuf
431+
# using the CONFIG mode first, and if not found, falls back to the MODULE
432+
# mode. See https://gitlab.kitware.com/cmake/cmake/-/issues/24321 for more
433+
# details.
434+
find_package(Protobuf CONFIG)
435+
if(NOT Protobuf_FOUND)
436+
find_package(Protobuf MODULE)
437+
if(Protobuf_FOUND AND Protobuf_VERSION VERSION_GREATER_EQUAL "3.22.0")
438+
message(
439+
WARNING
440+
"Found Protobuf version ${Protobuf_VERSION} using MODULE mode. "
441+
"Linking errors may occur. Protobuf 3.22+ depends on abseil-cpp "
442+
"and should be found using the CONFIG mode.")
443+
endif()
444+
endif()
426445

427446
if(WITH_OTLP_GRPC)
428447
find_package(gRPC CONFIG)
429448
endif()
430-
if((NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND) OR (WITH_OTLP_GRPC
431-
AND NOT gRPC_FOUND))
449+
if((NOT Protobuf_FOUND) OR (WITH_OTLP_GRPC AND NOT gRPC_FOUND))
432450
if(WIN32 AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE))
433451
install_windows_deps()
434452
endif()
@@ -440,8 +458,8 @@ if(WITH_OTLP_GRPC
440458
include(${CMAKE_TOOLCHAIN_FILE})
441459
endif()
442460

443-
if(NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND)
444-
find_package(Protobuf REQUIRED)
461+
if(NOT Protobuf_FOUND)
462+
find_package(Protobuf CONFIG REQUIRED)
445463
endif()
446464
if(NOT gRPC_FOUND AND WITH_OTLP_GRPC)
447465
find_package(gRPC CONFIG)
@@ -502,6 +520,11 @@ endif()
502520
if((NOT WITH_API_ONLY) AND WITH_HTTP_CLIENT_CURL)
503521
# No specific version required.
504522
find_package(CURL REQUIRED)
523+
# Set the CURL_VERSION from the legacy CURL_VERSION_STRING Required for CMake
524+
# versions below 4.0
525+
if(NOT DEFINED CURL_VERSION AND DEFINED CURL_VERSION_STRING)
526+
set(CURL_VERSION ${CURL_VERSION_STRING})
527+
endif()
505528
endif()
506529

507530
#
@@ -513,6 +536,11 @@ if((NOT WITH_API_ONLY)
513536
AND WITH_OTLP_HTTP_COMPRESSION)
514537
# No specific version required.
515538
find_package(ZLIB REQUIRED)
539+
# Set the ZLIB_VERSION from the legacy ZLIB_VERSION_STRING Required for CMake
540+
# versions below 3.26
541+
if(NOT DEFINED ZLIB_VERSION AND DEFINED ZLIB_VERSION_STRING)
542+
set(ZLIB_VERSION ${ZLIB_VERSION_STRING})
543+
endif()
516544
endif()
517545

518546
#

INSTALL.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ You can link OpenTelemetry C++ SDK with libraries provided in
2323
repository. To install Git, consult the [Set up
2424
Git](https://help.github.com/articles/set-up-git/) guide on GitHub.
2525
- [CMake](https://cmake.org/) for building opentelemetry-cpp API, SDK with their
26-
unittests. We use CMake version 3.15.2 in our build system. To install CMake,
26+
unittests. The minimum CMake version is 3.14.
27+
CMake 3.15+ is recommended on Windows due to known CI test failures with 3.14.
28+
To install CMake,
2729
consult the [Installing CMake](https://cmake.org/install/) guide.
2830
- [GoogleTest](https://github.com/google/googletest) framework to build and run
2931
the unittests. Refer to

0 commit comments

Comments
 (0)