diff --git a/ports/abseil/fix-cxx-standard.patch b/ports/abseil/fix-cxx-standard.patch new file mode 100644 index 00000000000000..19e1f54db3f100 --- /dev/null +++ b/ports/abseil/fix-cxx-standard.patch @@ -0,0 +1,96 @@ +diff --git a/CMake/abslConfig.cmake.in b/CMake/abslConfig.cmake.in +index 62d246d..00947cf 100644 +--- a/CMake/abslConfig.cmake.in ++++ b/CMake/abslConfig.cmake.in +@@ -6,3 +6,5 @@ find_dependency(Threads) + @PACKAGE_INIT@ + + include ("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") ++ ++set(ABSL_USE_CXX17 @ABSL_USE_CXX17@) +\ No newline at end of file +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f0af6f6..927f4ed 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -57,6 +57,23 @@ else() + option(ABSL_ENABLE_INSTALL "Enable install rule" ON) + endif() + ++# CXX standard ++option(ABSL_USE_CXX17 "Enable CXX 17 standard" OFF) ++ ++if (ABSL_USE_CXX17) ++ set(CMAKE_CXX_STANDARD 17) ++ set(STD_ANY 1) ++ set(STD_OPTIONAL 1) ++ set(STD_STRING_VIEW 1) ++ set(STD_VARIANT 1) ++else() ++ set(CMAKE_CXX_STANDARD 11) ++ set(STD_ANY 0) ++ set(STD_OPTIONAL 0) ++ set(STD_STRING_VIEW 0) ++ set(STD_VARIANT 0) ++endif() ++ + list(APPEND CMAKE_MODULE_PATH + ${CMAKE_CURRENT_LIST_DIR}/CMake + ${CMAKE_CURRENT_LIST_DIR}/absl/copts +diff --git a/absl/base/CMakeLists.txt b/absl/base/CMakeLists.txt +index 9ff5aa2..315bee4 100644 +--- a/absl/base/CMakeLists.txt ++++ b/absl/base/CMakeLists.txt +@@ -87,6 +87,12 @@ absl_cc_library( + absl::errno_saver + ) + ++if (NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/options.h.in) ++ file(RENAME ${CMAKE_CURRENT_LIST_DIR}/options.h ${CMAKE_CURRENT_LIST_DIR}/options.h.in) ++endif() ++file(REMOVE ${CMAKE_CURRENT_LIST_DIR}/options.h) ++configure_file(${CMAKE_CURRENT_LIST_DIR}/options.h.in ${CMAKE_CURRENT_LIST_DIR}/options.h @ONLY) ++ + absl_cc_library( + NAME + config +diff --git a/absl/base/options.h b/absl/base/options.h +index 6a0fb07..54a9780 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 @STD_ANY@ + + + // 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 @STD_OPTIONAL@ + + + // 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 @STD_STRING_VIEW@ + + // 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 @STD_VARIANT@ + + + // ABSL_OPTION_USE_INLINE_NAMESPACE diff --git a/ports/abseil/fix-lnk2019-error.patch b/ports/abseil/fix-lnk2019-error.patch deleted file mode 100644 index 645d1e094a420b..00000000000000 --- a/ports/abseil/fix-lnk2019-error.patch +++ /dev/null @@ -1,40 +0,0 @@ -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 0 - - - // 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 0 - - - // 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 0 - - // 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 0 - - - // ABSL_OPTION_USE_INLINE_NAMESPACE diff --git a/ports/abseil/fix-use-cxx17-stdlib-types.patch b/ports/abseil/fix-use-cxx17-stdlib-types.patch deleted file mode 100644 index 86715824d4b632..00000000000000 --- a/ports/abseil/fix-use-cxx17-stdlib-types.patch +++ /dev/null @@ -1,40 +0,0 @@ -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 536e88f094eb01..a544c1fe43da9e 100644 --- a/ports/abseil/portfile.cmake +++ b/ports/abseil/portfile.cmake @@ -2,37 +2,29 @@ if (NOT VCPKG_TARGET_IS_WINDOWS) vcpkg_check_linkage(ONLY_STATIC_LIBRARY) endif() -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() - # force 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 0f3bb466b868b523cf1dc9b2aaaed65c77b28862 #LTS 20200923, Patch 2 SHA512 17e766a2f7a655a3877eb3accc5745a910b69a5e2426b7ce7f6d31095523dd32d48a709c5f8380488b4cb93ce9faadedc08f0481dbdbd00cf68831541d724b4d HEAD_REF master - PATCHES ${ABSEIL_PATCHES} + # in C++17 mode, use std::any, std::optional, std::string_view, std::variant + # instead of the library replacement types + # in C++11 mode, force use of library replacement types, otherwise the automatic + # detection can cause ABI issues depending on which compiler options + # are enabled for consuming user code + PATCHES fix-cxx-standard.patch ) -set(CMAKE_CXX_STANDARD 11) -if("cxx17" IN_LIST FEATURES) - set(CMAKE_CXX_STANDARD 17) -endif() +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + cxx17 ABSL_USE_CXX17 +) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA - OPTIONS - -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} + DISABLE_PARALLEL_CONFIGURE + OPTIONS ${FEATURE_OPTIONS} ) vcpkg_install_cmake() diff --git a/ports/abseil/vcpkg.json b/ports/abseil/vcpkg.json index bd0cd8300c0d9f..96f3288e89a072 100644 --- a/ports/abseil/vcpkg.json +++ b/ports/abseil/vcpkg.json @@ -1,6 +1,7 @@ { "name": "abseil", "version-string": "2020-09-23", + "port-version": 1, "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.", diff --git a/ports/grpc/00012-fix-use-cxx17.patch b/ports/grpc/00012-fix-use-cxx17.patch new file mode 100644 index 00000000000000..012db102b332ba --- /dev/null +++ b/ports/grpc/00012-fix-use-cxx17.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1911144..c749d28 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -257,6 +257,11 @@ include(cmake/re2.cmake) + include(cmake/ssl.cmake) + include(cmake/upb.cmake) + include(cmake/zlib.cmake) ++ ++if (ABSL_USE_CXX17) ++ message(STATUS "Found absl uses CXX17, enable CXX17 feature.") ++ set(CMAKE_CXX_STANDARD 17) ++endif() + + if(_gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_IOS) + set(_gRPC_ALLTARGETS_LIBRARIES ${CMAKE_DL_LIBS} m pthread) diff --git a/ports/grpc/CONTROL b/ports/grpc/CONTROL index f44b4e00e9b181..f5954763e7c451 100644 --- a/ports/grpc/CONTROL +++ b/ports/grpc/CONTROL @@ -1,5 +1,6 @@ Source: grpc Version: 1.33.1 +Port-Version: 1 Build-Depends: zlib, openssl, protobuf, c-ares (!uwp), upb, abseil, re2 Homepage: https://github.com/grpc/grpc Description: An RPC library and framework diff --git a/ports/grpc/portfile.cmake b/ports/grpc/portfile.cmake index a082a69634941a..8253fe3e67b1ba 100644 --- a/ports/grpc/portfile.cmake +++ b/ports/grpc/portfile.cmake @@ -18,6 +18,7 @@ vcpkg_from_github( 00010-add-feature-absl-sync.patch 00011-fix-csharp_plugin.patch snprintf.patch + 00012-fix-use-cxx17.patch ) if((NOT VCPKG_TARGET_IS_LINUX) AND (VCPKG_TARGET_IS_UWP OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64"))