diff options
| author | Carsten Neumann <carsten.p.neumann@gmail.com> | 2020-04-30 20:22:56 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-30 17:22:56 -0700 |
| commit | 41f360b8339109ebd7a6a4d94ea8d604f9078a62 (patch) | |
| tree | 50f2552c810f90a13c16ec27d3ca2ea3770c18ea | |
| parent | c1dd394d1cae25ca17ce0d28cae5bb5ff7f2ae11 (diff) | |
| download | vcpkg-41f360b8339109ebd7a6a4d94ea8d604f9078a62.tar.gz vcpkg-41f360b8339109ebd7a6a4d94ea8d604f9078a62.zip | |
[abseil] Use std:: types when feature cxx17 is enabled (#11039)
Adds a patch changing macros in absl/base/options.h to
always use the std:: namespace types instead of the
absl:: namespace replacements (for any, optional,
string_view, variant).
The upstream version of options.h uses compiler/library
feature detection to decide this, but patch
fix-lnk2019-error.patch hard codes use of absl:: types,
thus rendering setting CMAKE_CXX_STANDARD to 17 in the
port file ineffective. Since auto detection is problematic
from an ABI point of view (see comments in
absl/base/options.h for details), this applies an
alternate patch for fix-lnk2019-error.patch when feature
cxx17 is enabled.
| -rw-r--r-- | ports/abseil/CONTROL | 10 | ||||
| -rw-r--r-- | ports/abseil/fix-use-cxx17-stdlib-types.patch | 40 | ||||
| -rw-r--r-- | ports/abseil/portfile.cmake | 25 |
3 files changed, 65 insertions, 10 deletions
diff --git a/ports/abseil/CONTROL b/ports/abseil/CONTROL index bdfd2c6b8..5822ef2ce 100644 --- a/ports/abseil/CONTROL +++ b/ports/abseil/CONTROL @@ -1,10 +1,10 @@ Source: abseil
-Version: 2020-03-03-3
+Version: 2020-03-03-4
Homepage: https://github.com/abseil/abseil-cpp
Description: an open-source collection designed to augment the C++ standard library.
Abseil is an open-source collection of C++ library code designed to augment the C++ standard library. The Abseil library code is collected from Google's own C++ code base, has been extensively tested and used in production, and is the same code we depend on in our daily coding lives.
In some cases, Abseil provides pieces missing from the C++ standard; in others, Abseil provides alternatives to the standard for special needs we've found through usage in the Google code base. We denote those cases clearly within the library code we provide you.
- Abseil is not meant to be a competitor to the standard library; we've just found that many of these utilities serve a purpose within our code base, and we now want to provide those resources to the C++ community as a whole. - -Feature: cxx17 -Description: Enable compiler C++17. + Abseil is not meant to be a competitor to the standard library; we've just found that many of these utilities serve a purpose within our code base, and we now want to provide those resources to the C++ community as a whole.
+
+Feature: cxx17
+Description: Enable compiler C++17.
diff --git a/ports/abseil/fix-use-cxx17-stdlib-types.patch b/ports/abseil/fix-use-cxx17-stdlib-types.patch new file mode 100644 index 000000000..86715824d --- /dev/null +++ b/ports/abseil/fix-use-cxx17-stdlib-types.patch @@ -0,0 +1,40 @@ +diff --git a/absl/base/options.h b/absl/base/options.h +index 234137c..1fb77e4 100644 +--- a/absl/base/options.h ++++ b/absl/base/options.h +@@ -100,7 +100,7 @@ + // User code should not inspect this macro. To check in the preprocessor if + // absl::any is a typedef of std::any, use the feature macro ABSL_USES_STD_ANY. + +-#define ABSL_OPTION_USE_STD_ANY 2 ++#define ABSL_OPTION_USE_STD_ANY 1 + + + // ABSL_OPTION_USE_STD_OPTIONAL +@@ -127,7 +127,7 @@ + // absl::optional is a typedef of std::optional, use the feature macro + // ABSL_USES_STD_OPTIONAL. + +-#define ABSL_OPTION_USE_STD_OPTIONAL 2 ++#define ABSL_OPTION_USE_STD_OPTIONAL 1 + + + // ABSL_OPTION_USE_STD_STRING_VIEW +@@ -154,7 +154,7 @@ + // absl::string_view is a typedef of std::string_view, use the feature macro + // ABSL_USES_STD_STRING_VIEW. + +-#define ABSL_OPTION_USE_STD_STRING_VIEW 2 ++#define ABSL_OPTION_USE_STD_STRING_VIEW 1 + + // ABSL_OPTION_USE_STD_VARIANT + // +@@ -180,7 +180,7 @@ + // absl::variant is a typedef of std::variant, use the feature macro + // ABSL_USES_STD_VARIANT. + +-#define ABSL_OPTION_USE_STD_VARIANT 2 ++#define ABSL_OPTION_USE_STD_VARIANT 1 + + + // ABSL_OPTION_USE_INLINE_NAMESPACE diff --git a/ports/abseil/portfile.cmake b/ports/abseil/portfile.cmake index 495885572..a82b72b9f 100644 --- a/ports/abseil/portfile.cmake +++ b/ports/abseil/portfile.cmake @@ -1,15 +1,30 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+set(ABSEIL_PATCHES
+ fix-uwp-build.patch
+
+ # This patch is an upstream commit, the related PR: https://github.com/abseil/abseil-cpp/pull/637
+ fix-MSVCbuildfail.patch
+)
+
+if("cxx17" IN_LIST FEATURES)
+ # in C++17 mode, use std::any, std::optional, std::string_view, std::variant
+ # instead of the library replacement types
+ list(APPEND ABSEIL_PATCHES fix-use-cxx17-stdlib-types.patch)
+else()
+ # fore use of library replacement types, otherwise the automatic
+ # detection can cause ABI issues depending on which compiler options
+ # are enabled for consuming user code
+ list(APPEND ABSEIL_PATCHES fix-lnk2019-error.patch)
+endif()
+
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO abseil/abseil-cpp
- REF 06f0e767d13d4d68071c4fc51e25724e0fc8bc74 #commit 2020-03-03 + REF 06f0e767d13d4d68071c4fc51e25724e0fc8bc74 #commit 2020-03-03
SHA512 f6e2302676ddae39d84d8ec92dbd13520ae214013b43455f14ced3ae6938b94cedb06cfc40eb1781dac48f02cd35ed80673ed2d871541ef4438c282a9a4133b9
HEAD_REF master
- PATCHES
- fix-lnk2019-error.patch
- fix-uwp-build.patch
- fix-MSVCbuildfail.patch #This patch is an upstream commit, the related PR: https://github.com/abseil/abseil-cpp/pull/637
+ PATCHES ${ABSEIL_PATCHES}
)
set(CMAKE_CXX_STANDARD )
|
