Skip to content

Commit

Permalink
Switch from MPark variant to absl::variant as default (#771)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgolov authored Jun 4, 2021
1 parent 3de8f35 commit d0e73c8
Show file tree
Hide file tree
Showing 38 changed files with 797 additions and 2,210 deletions.
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,19 @@ if(WITH_ABSEIL)
add_definitions(-DHAVE_ABSEIL)
find_package(absl CONFIG REQUIRED)

# Abseil headers-only lib is needed for absl::variant to work vs2015.
# `nostd::mpark::variant` is not compiling in vs2015.
set(CORE_RUNTIME_LIBS absl::any absl::base absl::bits absl::city)

# target_link_libraries(main PRIVATE absl::any absl::base absl::bits
# absl::city)
endif()

if(WITH_STL)
# These definitions are needed for test projects that do not link against
# opentelemetry-api library directly. We ensure that variant implementation
# (absl::variant or std::variant) in variant unit test code is consistent with
# the global project build definitions.
add_definitions(-DHAVE_CPP_STDLIB)
add_definitions(-DHAVE_GSL)
# Require at least C++17. C++20 is needed to avoid gsl::span
if(CMAKE_MINOR_VERSION VERSION_GREATER "3.18")
# Ask for 20, may get anything below
Expand Down
2 changes: 2 additions & 0 deletions api/include/opentelemetry/common/attribute_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ using AttributeValue =
int64_t,
uint32_t,
double,
const char *,
nostd::string_view,
nostd::span<const bool>,
nostd::span<const int32_t>,
Expand All @@ -64,6 +65,7 @@ enum AttributeType
kTypeInt64,
kTypeUInt,
kTypeDouble,
kTypeCString,
kTypeString,
kTypeSpanBool,
kTypeSpanInt,
Expand Down
10 changes: 0 additions & 10 deletions api/include/opentelemetry/nostd/absl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,3 @@

This is a snapshot of Abseil Variant `absl::variant` from Abseil
`v2020-03-03#8`.

This code is required to compile OpenTelemetry code in vs2015 because MPark
Variant implementation is not compatible with vs2015.

Build option `HAVE_ABSEIL_VARIANT` allows to enable the build with
`absl::variant`, `absl::get` and `absl::visit` as defalt implementation for
`nostd::` classes.

Going forward it makes sense to use `absl::variant` as default implementation
for Windows OS and vs2015, vs2017, vs2019 and newer compilers.
Loading

0 comments on commit d0e73c8

Please sign in to comment.