Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 63 additions & 31 deletions .github/workflows/cmake_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ on:
branches: [ main ]

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

windows_2019_vcpkg:
name: Windows 2019 vcpkg cxx14 (static libs)
windows_2019_vcpkg_submodule_min_cmake:
name: Windows 2019 vcpkg submodule versions minimum cmake cxx14 (static libs)
runs-on: windows-2019
env:
# cmake 3.15 is the minimum for windows builds (See https://github.com/open-telemetry/opentelemetry-cpp/pull/3349#discussion_r2030319430)
CMAKE_VERSION: '3.15.0'
# cxx14 is the default for windows-2019
CXX_STANDARD: '14'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -47,6 +53,9 @@ jobs:
runs-on: ubuntu-24.04
env:
INSTALL_TEST_DIR: '/home/runner/install_test'
# CMake 3.28 is apt package version for Ubuntu 24.04
CMAKE_VERSION: '3.28.3'
# cxx17 is the default for Ubuntu 24.04
CXX_STANDARD: '17'
BUILD_TYPE: 'Debug'
steps:
Expand All @@ -71,12 +80,22 @@ jobs:
BUILD_SHARED_LIBS: 'ON'
run: ./ci/do_ci.sh cmake.install.test

ubuntu_2404_script_build_grpc_1_71_0:
name: Ubuntu 24.04 script grpc 1.71.0 cxx17 (static libs)
ubuntu_2404_latest:
name: Ubuntu 24.04 latest versions cxx20 (static libs)
runs-on: ubuntu-24.04
env:
INSTALL_TEST_DIR: '/home/runner/install_test'
# Set to the latest version of cmake 3.x
CMAKE_VERSION: '3.31.6'
# Set to the latest cxx standard supported by opentelemetry-cpp
CXX_STANDARD: '20'
# Versions below set to the latest version available
# The abseil and protobuf versions are taken from
# the grpc submodules at the GRPC_VERSION tag
GOOGLETEST_VERSION: '1.16.0'
ABSEIL_CPP_VERSION: '20240722.1'
PROTOBUF_VERSION: '29.0'
GRPC_VERSION: 'v1.71.0'
BUILD_TYPE: 'Debug'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -88,10 +107,6 @@ jobs:
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_googletest.sh
- name: Build abseil, protobuf, and grpc with ci scripts
env:
ABSEIL_CPP_VERSION: '20240722.1'
PROTOBUF_VERSION: '29.0'
GRPC_VERSION: 'v1.71.0'
run: |
sudo -E ./ci/install_abseil.sh
sudo -E ./ci/install_protobuf.sh
Expand All @@ -101,12 +116,20 @@ jobs:
BUILD_SHARED_LIBS: 'OFF'
run: ./ci/do_ci.sh cmake.install.test

ubuntu_2204_script_build_grpc_1_55_0:
name: Ubuntu 22.04 script grpc 1.55.0 cxx17 (static libs - shared libs)
ubuntu_2204_stable:
name: Ubuntu 22.04 stable versions cxx17 (static libs - shared libs)
runs-on: ubuntu-22.04
env:
INSTALL_TEST_DIR: '/home/runner/install_test'
# CMake 3.22 is the apt package version for Ubuntu 22.04
CMAKE_VERSION: '3.22.0'
CXX_STANDARD: '17'
# These are stable versions tested in the main ci workflow
# and defaults in the devcontainer
GOOGLETEST_VERSION: '1.14.0'
ABSEIL_CPP_VERSION: '20230125.3'
PROTOBUF_VERSION: '23.3'
GRPC_VERSION: 'v1.55.0'
BUILD_TYPE: 'Debug'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -118,10 +141,6 @@ jobs:
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_googletest.sh
- name: Build abseil, protobuf, and grpc with ci scripts
env:
ABSEIL_CPP_VERSION: '20230125.3'
PROTOBUF_VERSION: '23.3'
GRPC_VERSION: 'v1.55.0'
run: |
sudo -E ./ci/install_abseil.sh
sudo -E ./ci/install_protobuf.sh
Expand All @@ -135,12 +154,21 @@ jobs:
BUILD_SHARED_LIBS: 'ON'
run: ./ci/do_ci.sh cmake.install.test

ubuntu_2204_script_build_grpc_1_49_2:
name: Ubuntu 22.04 script grpc 1.49.2 cxx14 (static libs - shared libs)
ubuntu_2204_minimum:
name: Ubuntu 22.04 minimum versions cxx14 (static libs - shared libs)
runs-on: ubuntu-22.04
env:
INSTALL_TEST_DIR: '/home/runner/install_test'
# Set to the current minimum version of cmake
CMAKE_VERSION: '3.14.0'
# cxx14 is the default for Ubuntu 22.04
CXX_STANDARD: '14'
# This is the apt package version of googletest for Ubuntu 22.04
GOOGLETEST_VERSION: '1.11.0'
# These are minimum versions tested in the main ci workflow
ABSEIL_CPP_VERSION: '20220623.2'
PROTOBUF_VERSION: '21.12'
GRPC_VERSION: 'v1.49.2'
BUILD_TYPE: 'Debug'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -152,10 +180,6 @@ jobs:
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_googletest.sh
- name: Build abseil, protobuf, and grpc with ci scripts
env:
ABSEIL_CPP_VERSION: '20220623.2'
PROTOBUF_VERSION: '21.12'
GRPC_VERSION: 'v1.49.2'
run: |
sudo -E ./ci/install_abseil.sh
sudo -E ./ci/install_protobuf.sh
Expand All @@ -170,10 +194,12 @@ jobs:
run: ./ci/do_ci.sh cmake.install.test

ubuntu_2404_conan_stable:
name: Ubuntu 24.04 conan stable cxx17 (static libs - shared libs - opentracing shim)
name: Ubuntu 24.04 conan stable versions cxx17 (static libs - shared libs - opentracing shim)
runs-on: ubuntu-24.04
env:
INSTALL_TEST_DIR: '/home/runner/install_test'
# CMake 3.28 is apt package version for Ubuntu 24.04
CMAKE_VERSION: '3.28.3'
CXX_STANDARD: '17'
CMAKE_TOOLCHAIN_FILE: /home/runner/conan/build/Debug/generators/conan_toolchain.cmake
BUILD_TYPE: 'Debug'
Expand All @@ -189,7 +215,7 @@ jobs:
- name: Install or build all dependencies with Conan
run: |
sudo -E ./ci/setup_cmake.sh
conan install install/conan/conanfile_stable.txt --build=missing -of /home/runner/conan -s build_type=Debug
conan install install/conan/conanfile_stable.txt --build=missing -of /home/runner/conan -s build_type=${BUILD_TYPE} -s compiler.cppstd=${CXX_STANDARD}
- name: Run Tests (static libs)
env:
BUILD_SHARED_LIBS: 'OFF'
Expand All @@ -206,10 +232,12 @@ jobs:
run: ./ci/do_ci.sh cmake.opentracing_shim.install.test

ubuntu_2404_conan_latest:
name: Ubuntu 24.04 conan latest cxx17 (static libs)
name: Ubuntu 24.04 conan latest versions cxx17 (static libs)
runs-on: ubuntu-24.04
env:
INSTALL_TEST_DIR: '/home/runner/install_test'
# Set to the latest version of cmake 3.x
CMAKE_VERSION: '3.31.6'
CXX_STANDARD: '17'
CMAKE_TOOLCHAIN_FILE: /home/runner/conan/build/Debug/generators/conan_toolchain.cmake
BUILD_TYPE: 'Debug'
Expand All @@ -225,7 +253,7 @@ jobs:
- name: Install or build all dependencies with Conan
run: |
sudo -E ./ci/setup_cmake.sh
conan install install/conan/conanfile_latest.txt --build=missing -of /home/runner/conan -s build_type=Debug
conan install install/conan/conanfile_latest.txt --build=missing -of /home/runner/conan -s build_type=${BUILD_TYPE} -s compiler.cppstd=${CXX_STANDARD}
- name: Run Tests (static libs)
env:
BUILD_SHARED_LIBS: 'OFF'
Expand All @@ -236,10 +264,11 @@ jobs:
./ci/verify_packages.sh

macos_14_conan_stable:
name: macOS 14 conan stable cxx17 (static libs)
name: macOS 14 conan stable versions cxx17 (static libs)
runs-on: macos-14
env:
INSTALL_TEST_DIR: '/Users/runner/install_test'
CMAKE_VERSION: '3.28.3'
CXX_STANDARD: '17'
CMAKE_TOOLCHAIN_FILE: '/Users/runner/conan/build/Debug/generators/conan_toolchain.cmake'
BUILD_TYPE: 'Debug'
Expand All @@ -250,19 +279,22 @@ jobs:
- name: Install Conan and tools
run: |
brew install conan autoconf automake libtool coreutils
sudo -E ./ci/setup_cmake_macos.sh
./ci/setup_cmake_macos.sh
conan profile detect --force
- name: Install or build all dependencies with Conan
run: conan install install/conan/conanfile_stable.txt --build=missing -of /Users/runner/conan -s build_type=Debug
run: conan install install/conan/conanfile_stable.txt --build=missing -of /Users/runner/conan -s build_type=${BUILD_TYPE} -s compiler.cppstd=${CXX_STANDARD}
- name: Run Tests (static libs)
env:
BUILD_SHARED_LIBS: 'OFF'
run: ./ci/do_ci.sh cmake.install.test

macos_14_brew_packages:
name: macOS 14 brew packages cxx17 (static libs)
name: macOS 14 brew latest versions cxx17 (static libs)
runs-on: macos-14
env:
INSTALL_TEST_DIR: '/Users/runner/install_test'
# Set to the latest version of cmake 3.x
CMAKE_VERSION: '3.31.6'
CXX_STANDARD: '17'
BUILD_TYPE: 'Debug'
steps:
Expand All @@ -271,7 +303,7 @@ jobs:
submodules: 'recursive'
- name: Install Dependencies with Homebrew
run: |
sudo -E ./ci/setup_cmake_macos.sh
./ci/setup_cmake_macos.sh
brew install coreutils
brew install googletest
brew install google-benchmark
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Increment the:
* [API] Remove `WITH_ABSEIL` and `HAVE_ABSEIL`
[#3318](https://github.com/open-telemetry/opentelemetry-cpp/pull/3318)

* [CMAKE] Bump cmake minimum required version to 3.14
[#3349](https://github.com/open-telemetry/opentelemetry-cpp/pull/3349)

## [1.20 2025-04-01]

* [BUILD] Update opentelemetry-proto version
Expand Down
48 changes: 38 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.14)

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

# Prefer cmake CONFIG to auto resolve dependencies. This is important to
# properly find protobuf versions 3.22.0 and above
# Note: CMAKE_FIND_PACKAGE_PREFER_CONFIG requires cmake 3.15. Prefer cmake
# CONFIG search mode to find dependencies. This is important to properly find
# protobuf versions 3.22.0 and above due to the abseil-cpp dependency.
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)

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

find_package(Protobuf)
# Protobuf 3.22 or upper require abseil-cpp, we can find it in
# opentelemetry-cpp-config.cmake
# Including the CMakeFindDependencyMacro resolves an error from
# gRPCConfig.cmake on some grpc versions. See
# https://github.com/grpc/grpc/pull/33361 for more details.
include(CMakeFindDependencyMacro)

# Protobuf 3.22+ depends on abseil-cpp and must be found using the cmake
# find_package CONFIG search mode. The following attempts to find Protobuf
# using the CONFIG mode first, and if not found, falls back to the MODULE
# mode. See https://gitlab.kitware.com/cmake/cmake/-/issues/24321 for more
# details.
find_package(Protobuf CONFIG)
if(NOT Protobuf_FOUND)
find_package(Protobuf MODULE)
if(Protobuf_FOUND AND Protobuf_VERSION VERSION_GREATER_EQUAL "3.22.0")
message(
WARNING
"Found Protobuf version ${Protobuf_VERSION} using MODULE mode. "
"Linking errors may occur. Protobuf 3.22+ depends on abseil-cpp "
"and should be found using the CONFIG mode.")
endif()
endif()

if(WITH_OTLP_GRPC)
find_package(gRPC CONFIG)
endif()
if((NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND) OR (WITH_OTLP_GRPC
AND NOT gRPC_FOUND))
if((NOT Protobuf_FOUND) OR (WITH_OTLP_GRPC AND NOT gRPC_FOUND))
if(WIN32 AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE))
install_windows_deps()
endif()
Expand All @@ -440,8 +458,8 @@ if(WITH_OTLP_GRPC
include(${CMAKE_TOOLCHAIN_FILE})
endif()

if(NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND)
find_package(Protobuf REQUIRED)
if(NOT Protobuf_FOUND)
find_package(Protobuf CONFIG REQUIRED)
endif()
if(NOT gRPC_FOUND AND WITH_OTLP_GRPC)
find_package(gRPC CONFIG)
Expand Down Expand Up @@ -502,6 +520,11 @@ endif()
if((NOT WITH_API_ONLY) AND WITH_HTTP_CLIENT_CURL)
# No specific version required.
find_package(CURL REQUIRED)
# Set the CURL_VERSION from the legacy CURL_VERSION_STRING Required for CMake
# versions below 4.0
if(NOT DEFINED CURL_VERSION AND DEFINED CURL_VERSION_STRING)
set(CURL_VERSION ${CURL_VERSION_STRING})
endif()
endif()

#
Expand All @@ -513,6 +536,11 @@ if((NOT WITH_API_ONLY)
AND WITH_OTLP_HTTP_COMPRESSION)
# No specific version required.
find_package(ZLIB REQUIRED)
# Set the ZLIB_VERSION from the legacy ZLIB_VERSION_STRING Required for CMake
# versions below 3.26
if(NOT DEFINED ZLIB_VERSION AND DEFINED ZLIB_VERSION_STRING)
set(ZLIB_VERSION ${ZLIB_VERSION_STRING})
endif()
endif()

#
Expand Down
4 changes: 3 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ You can link OpenTelemetry C++ SDK with libraries provided in
repository. To install Git, consult the [Set up
Git](https://help.github.com/articles/set-up-git/) guide on GitHub.
- [CMake](https://cmake.org/) for building opentelemetry-cpp API, SDK with their
unittests. We use CMake version 3.15.2 in our build system. To install CMake,
unittests. The minimum CMake version is 3.14.
CMake 3.15+ is recommended on Windows due to known CI test failures with 3.14.
To install CMake,
consult the [Installing CMake](https://cmake.org/install/) guide.
- [GoogleTest](https://github.com/google/googletest) framework to build and run
the unittests. Refer to
Expand Down
Loading
Loading