Skip to content

Commit ab81479

Browse files
authored
[BUILD] Remove WITH_ABSEIL (open-telemetry#3318)
1 parent 6175aa0 commit ab81479

File tree

18 files changed

+41
-107
lines changed

18 files changed

+41
-107
lines changed

.devcontainer/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ environment variables (for evaluation in `devcontainer.json`).
1212

1313
* **abseil-cpp version:**
1414
This is the version of abseil-cpp that will be used to build protobuf, gRPC,
15-
and opentelemetry-cpp (when WITH_ABSEIL is set).
15+
and opentelemetry-cpp.
1616
* Docker ARG:
1717
`ABSEIL_CPP_VERSION`
1818
* Host Environment Variable:

.github/workflows/ci.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ jobs:
3030
# sudo -E ./ci/setup_googletest.sh
3131
# sudo -E ./ci/install_abseil.sh
3232
# sudo -E ./ci/install_protobuf.sh
33-
# - name: run otlp exporter tests
34-
# env:
35-
# CC: /usr/bin/gcc-10
36-
# CXX: /usr/bin/g++-10
37-
# WITH_ABSEIL: 'ON'
38-
# CXX_STANDARD: '14'
39-
# run: |
40-
# sudo -E ./ci/setup_grpc.sh -m -p protobuf -p abseil-cpp
41-
# ./ci/do_ci.sh cmake.exporter.otprotocol.test
4233

4334
cmake_test:
4435
name: CMake test (prometheus, elasticsearch, zipkin)
@@ -528,7 +519,6 @@ jobs:
528519
sudo -E ./ci/install_protobuf.sh
529520
- name: run otlp exporter tests
530521
env:
531-
WITH_ABSEIL: 'ON'
532522
CXX_STANDARD: '14'
533523
run: |
534524
sudo -E ./ci/setup_grpc.sh -m -p protobuf -p abseil-cpp

.github/workflows/clang-tidy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ jobs:
7878
COUNT=$(grep -c "warning:" clang-tidy.log)
7979
echo "clang-tidy reported ${COUNT} warning(s)"
8080
81-
# TODO: include WITH_OTLP_GRPC and WITH_ABSEIL flags.
81+
# TODO: include WITH_OTLP_GRPC flags.

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ Increment the:
1515

1616
## [Unreleased]
1717

18+
* [API] Remove `WITH_ABSEIL` and `HAVE_ABSEIL`
19+
[#3318](https://github.com/open-telemetry/opentelemetry-cpp/pull/3318)
20+
1821
## [1.20 2025-04-01]
1922

2023
* [BUILD] Update opentelemetry-proto version

CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ set(WITH_STL
188188
option(WITH_GSL
189189
"Whether to use Guidelines Support Library for C++ latest features" OFF)
190190

191-
option(WITH_ABSEIL "Whether to use Abseil for C++latest features" OFF)
192-
193191
set(OPENTELEMETRY_INSTALL_default ON)
194192
if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
195193
set(OPENTELEMETRY_INSTALL_default OFF)
@@ -400,10 +398,8 @@ if(WITH_PROMETHEUS)
400398
endif()
401399
endif()
402400

403-
if(WITH_ABSEIL)
404-
if(NOT TARGET absl::strings)
405-
find_package(absl CONFIG REQUIRED)
406-
endif()
401+
if(WITH_OTLP_GRPC)
402+
find_package(absl CONFIG REQUIRED)
407403
endif()
408404

409405
if(WITH_OTLP_GRPC

api/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ string_flag(
2323
cc_library(
2424
name = "api",
2525
hdrs = glob(["include/**/*.h"]),
26-
defines = ["HAVE_ABSEIL"] + select({
26+
defines = select({
2727
":set_cxx_stdlib_none": [],
2828
### automatic selection
2929
":set_cxx_stdlib_best": ["OPENTELEMETRY_STL_VERSION=(__cplusplus/100)"],

api/CMakeLists.txt

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,6 @@ if(WITH_NO_DEPRECATED_CODE)
3535
INTERFACE OPENTELEMETRY_NO_DEPRECATED_CODE)
3636
endif()
3737

38-
if(WITH_ABSEIL)
39-
target_compile_definitions(opentelemetry_api INTERFACE HAVE_ABSEIL)
40-
target_link_libraries(
41-
opentelemetry_api INTERFACE absl::bad_variant_access absl::any absl::base
42-
absl::bits absl::city)
43-
list(
44-
APPEND
45-
TARGET_DEPS
46-
"absl_bad_variant_access"
47-
"absl_any"
48-
"absl_base"
49-
"absl_bits"
50-
"absl_city")
51-
endif()
52-
5338
if(WITH_STL STREQUAL "OFF")
5439
message(STATUS "Building WITH_STL=OFF")
5540
elseif(WITH_STL STREQUAL "CXX11")

api/include/opentelemetry/nostd/variant.h

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414

1515
#if !defined(OPENTELEMETRY_HAVE_STD_VARIANT)
1616

17-
# ifndef HAVE_ABSEIL
1817
// We use a LOCAL snapshot of Abseil that is known to compile with Visual Studio 2015.
1918
// Header-only. Without compiling the actual Abseil binary. As Abseil moves on to new
2019
// toolchains, it may drop support for Visual Studio 2015 in future versions.
2120

22-
# if defined(__EXCEPTIONS)
23-
# include <exception>
21+
# if defined(__EXCEPTIONS)
22+
# include <exception>
2423
OPENTELEMETRY_BEGIN_NAMESPACE
2524
namespace nostd
2625
{
@@ -37,10 +36,9 @@ class bad_variant_access : public std::exception
3736
}
3837
} // namespace nostd
3938
OPENTELEMETRY_END_NAMESPACE
40-
# define THROW_BAD_VARIANT_ACCESS opentelemetry::nostd::throw_bad_variant_access()
41-
# else
42-
# define THROW_BAD_VARIANT_ACCESS std::terminate()
43-
# endif
39+
# define THROW_BAD_VARIANT_ACCESS opentelemetry::nostd::throw_bad_variant_access()
40+
# else
41+
# define THROW_BAD_VARIANT_ACCESS std::terminate()
4442
# endif
4543

4644
# ifdef _MSC_VER
@@ -51,10 +49,7 @@ OPENTELEMETRY_END_NAMESPACE
5149
# pragma warning(disable : 4127) // conditional expression is constant
5250
# endif
5351

54-
# ifdef HAVE_ABSEIL
55-
# include "absl/types/variant.h"
56-
# else
57-
# include "opentelemetry/nostd/internal/absl/base/options.h"
52+
# include "opentelemetry/nostd/internal/absl/base/options.h"
5853

5954
namespace absl
6055
{
@@ -67,8 +62,7 @@ class variant;
6762
} // namespace OTABSL_OPTION_NAMESPACE_NAME
6863
} // namespace absl
6964

70-
# include "opentelemetry/nostd/internal/absl/types/variant.h"
71-
# endif
65+
# include "opentelemetry/nostd/internal/absl/types/variant.h"
7266

7367
# ifdef _MSC_VER
7468
# pragma warning(pop)
@@ -77,17 +71,6 @@ class variant;
7771
OPENTELEMETRY_BEGIN_NAMESPACE
7872
namespace nostd
7973
{
80-
# ifdef HAVE_ABSEIL
81-
using absl::bad_variant_access;
82-
using absl::get;
83-
using absl::get_if;
84-
using absl::holds_alternative;
85-
using absl::monostate;
86-
using absl::variant;
87-
using absl::variant_alternative_t;
88-
using absl::variant_size;
89-
using absl::visit;
90-
# else
9174
using absl::OTABSL_OPTION_NAMESPACE_NAME::get;
9275
using absl::OTABSL_OPTION_NAMESPACE_NAME::get_if;
9376
using absl::OTABSL_OPTION_NAMESPACE_NAME::holds_alternative;
@@ -96,7 +79,6 @@ using absl::OTABSL_OPTION_NAMESPACE_NAME::variant;
9679
using absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative_t;
9780
using absl::OTABSL_OPTION_NAMESPACE_NAME::variant_size;
9881
using absl::OTABSL_OPTION_NAMESPACE_NAME::visit;
99-
# endif
10082
} // namespace nostd
10183
OPENTELEMETRY_END_NAMESPACE
10284

cmake/opentelemetry-cpp-config.cmake.in

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
# Copyright The OpenTelemetry Authors
22
# SPDX-License-Identifier: Apache-2.0
33

4+
#[[
45
#.rst:
56
# opentelemetry-cpp-config.cmake
67
# --------
78
#
89
# Find the native opentelemetry-cpp includes and library.
910
#
10-
# Result Variables
11-
# ^^^^^^^^^^^^^^^^
12-
#
13-
# This module defines the following variables:
14-
#
1511
# ::
1612
#
1713
# OPENTELEMETRY_CPP_INCLUDE_DIRS - Include directories of opentelemetry-cpp.
@@ -52,10 +48,9 @@
5248
# opentelemetry-cpp::http_client_curl - Imported target of opentelemetry-cpp::http_client_curl
5349
# opentelemetry-cpp::opentracing_shim - Imported target of opentelemetry-cpp::opentracing_shim
5450
#
55-
51+
]]
5652
# =============================================================================
57-
# Copyright The OpenTelemetry Authors
58-
# SPDX-License-Identifier: Apache-2.0
53+
# Copyright The OpenTelemetry Authors SPDX-License-Identifier: Apache-2.0
5954
# =============================================================================
6055

6156
set(OPENTELEMETRY_ABI_VERSION_NO
@@ -73,10 +68,6 @@ include(CMakeFindDependencyMacro)
7368

7469
find_dependency(Threads)
7570

76-
if(@WITH_ABSEIL@)
77-
find_dependency(absl)
78-
endif()
79-
8071
if(@WITH_OTLP_GRPC@)
8172
find_dependency(gRPC)
8273
endif()
@@ -93,7 +84,7 @@ if("@Protobuf_FOUND@" OR "@PROTOBUF_FOUND@")
9384
find_dependency(Protobuf)
9485
endif()
9586

96-
if (@WITH_HTTP_CLIENT_CURL@ AND NOT @BUILD_SHARED_LIBS@)
87+
if(@WITH_HTTP_CLIENT_CURL@ AND NOT @BUILD_SHARED_LIBS@)
9788
if("@CURL_FOUND@")
9889
find_dependency(CURL)
9990
endif()
@@ -103,7 +94,7 @@ if (@WITH_HTTP_CLIENT_CURL@ AND NOT @BUILD_SHARED_LIBS@)
10394
endif()
10495
endif()
10596

106-
if(@WITH_ABSEIL@ OR @WITH_OTLP_GRPC@)
97+
if(@WITH_OTLP_GRPC@)
10798
find_package(absl CONFIG)
10899
elseif(@WITH_OTLP_HTTP@ OR @WITH_OTLP_FILE@)
109100
if("@Protobuf_VERSION@" VERSION_GREATER_EQUAL "3.22.0")

cmake/opentelemetry-proto.cmake

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,9 @@ add_custom_command(
286286
${PROTOBUF_PROTOC_EXECUTABLE} ${PROTOBUF_COMMON_FLAGS}
287287
${PROTOBUF_INCLUDE_FLAGS} ${COMMON_PROTO} ${RESOURCE_PROTO} ${TRACE_PROTO}
288288
${LOGS_PROTO} ${METRICS_PROTO} ${TRACE_SERVICE_PROTO} ${LOGS_SERVICE_PROTO}
289-
${METRICS_SERVICE_PROTO} ${PROFILES_PROTO}
290-
${PROFILES_SERVICE_PROTO}
289+
${METRICS_SERVICE_PROTO} ${PROFILES_PROTO} ${PROFILES_SERVICE_PROTO}
291290
COMMENT "[Run]: ${PROTOBUF_RUN_PROTOC_COMMAND}"
292-
DEPENDS ${PROTOBUF_PROTOC_EXECUTABLE}
293-
)
291+
DEPENDS ${PROTOBUF_PROTOC_EXECUTABLE})
294292

295293
include_directories("${GENERATED_PROTOBUF_PATH}")
296294

@@ -343,7 +341,8 @@ if(WITH_OTLP_GRPC)
343341
set_target_version(opentelemetry_proto_grpc)
344342

345343
# Disable include-what-you-use on generated code.
346-
set_target_properties(opentelemetry_proto_grpc PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "")
344+
set_target_properties(opentelemetry_proto_grpc
345+
PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "")
347346

348347
list(APPEND OPENTELEMETRY_PROTO_TARGETS opentelemetry_proto_grpc)
349348
target_link_libraries(opentelemetry_proto_grpc PUBLIC opentelemetry_proto)
@@ -392,7 +391,6 @@ else() # cmake 3.8 or lower
392391
endif()
393392

394393
if(WITH_OTLP_GRPC)
395-
find_package(absl CONFIG)
396394
if(TARGET absl::synchronization)
397395
target_link_libraries(opentelemetry_proto_grpc
398396
PRIVATE absl::synchronization)

0 commit comments

Comments
 (0)