Skip to content

Commit

Permalink
Merge pull request microsoft#1967 from KindDragon/folly-v2017.10.02.00
Browse files Browse the repository at this point in the history
[folly] Update to version v2017.10.02.00
  • Loading branch information
alexkaratarakis authored Oct 18, 2017
2 parents d7f6a7e + c9d3512 commit 5c5e130
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ports/folly/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Source: folly
Version: v2017.07.17.01-1
Version: v2017.10.02.00
Description: An open-source C++ library developed and used at Facebook. The library is UNSTABLE on Windows
Build-Depends: zlib, openssl, boost, libevent, double-conversion, glog, gflags, lz4, liblzma, snappy
22 changes: 22 additions & 0 deletions ports/folly/fix-MSG_ERRQUEUE.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/folly/io/async/AsyncSocket.cpp b/folly/io/async/AsyncSocket.cpp
index 7f8c5f13..f77adbc0 100644
--- a/folly/io/async/AsyncSocket.cpp
+++ b/folly/io/async/AsyncSocket.cpp
@@ -41,7 +41,7 @@ namespace fsp = folly::portability::sockets;
namespace folly {

static constexpr bool msgErrQueueSupported =
-#ifdef MSG_ERRQUEUE
+#if defined(MSG_ERRQUEUE) && !defined(_WIN32)
true;
#else
false;
@@ -1551,7 +1551,7 @@ void AsyncSocket::handleErrMessages() noexcept {
return;
}

-#ifdef MSG_ERRQUEUE
+#if defined(MSG_ERRQUEUE) && !defined(_WIN32)
uint8_t ctrl[1024];
unsigned char data;
struct msghdr msg;
11 changes: 11 additions & 0 deletions ports/folly/fix-histogram.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/folly/stats/Histogram.h
+++ b/folly/stats/Histogram.h
@@ -485,7 +485,7 @@
// with /permissive- (the default for the CMake build), so we directly include
// the -defs as if it were -inl, and don't provide the explicit instantiations.
// https://developercommunity.visualstudio.com/content/problem/81223/incorrect-error-c5037-with-permissive.html
-#if defined(_MSC_VER) && _MSC_FULL_VER >= 191125506 && _MSC_FULL_VER < 191125542
+#if defined(_MSC_VER) && _MSC_FULL_VER >= 191125506 && _MSC_FULL_VER <= 191125547
#define FOLLY_MSVC_USE_WORKAROUND_FOR_C5037 1
#else
#define FOLLY_MSVC_USE_WORKAROUND_FOR_C5037 0
12 changes: 12 additions & 0 deletions ports/folly/fix-malloc.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- a/folly/Malloc.h Mon Oct 09 04:35:09 2017
+++ b/folly/Malloc.h Fri Oct 13 15:31:36 2017
@@ -189,9 +189,6 @@
return false;
}

- /* Avoid optimizing away the malloc. */
- asm volatile("" ::"m"(ptr) : "memory");
-
return (origAllocated != *counter);
}();

98 changes: 98 additions & 0 deletions ports/folly/fix-static-linking.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
diff --git a/CMake/folly-deps.cmake b/CMake/folly-deps.cmake
index 211c6fbf..fbcbddf0 100755
--- a/CMake/folly-deps.cmake
+++ b/CMake/folly-deps.cmake
@@ -10,9 +10,26 @@ find_package(Boost 1.55.0 MODULE
thread
REQUIRED
)
+
find_package(DoubleConversion MODULE REQUIRED)
-find_package(GFlags MODULE REQUIRED)
-find_package(GLog MODULE REQUIRED)
-find_package(LibEvent MODULE REQUIRED)
+
+find_package(gflags CONFIG)
+if(NOT TARGET gflags)
+ message(STATUS "MODULE: GFlags")
+ find_package(GFlags MODULE REQUIRED)
+endif()
+
+find_package(glog CONFIG)
+if(NOT TARGET glog::glog)
+ message(STATUS "MODULE: GLog")
+ find_package(GLog MODULE REQUIRED)
+endif()
+
+find_package(Libevent CONFIG)
+if(NOT TARGET event)
+ message(STATUS "MODULE: Libevent")
+ find_package(LibEvent MODULE REQUIRED)
+endif()
+
find_package(OpenSSL MODULE REQUIRED)
find_package(PThread MODULE)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cdc992a8..c0231402 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -141,9 +141,38 @@ set(FOLLY_SHINY_DEPENDENCIES

set(FOLLY_LINK_LIBRARIES
${DOUBLE_CONVERSION_LIBRARY}
- ${LIBEVENT_LIB}
- ${LIBGFLAGS_LIBRARY}
- ${LIBGLOG_LIBRARY}
+)
+
+set(FOLLY_INCLUDE_DIRECTORIES
+ ${DOUBLE_CONVERSION_INCLUDE_DIR}
+)
+
+if(TARGET gflags_static)
+ set(FOLLY_SHINY_DEPENDENCIES ${FOLLY_SHINY_DEPENDENCIES} gflags_static)
+elseif(TARGET gflags)
+ set(FOLLY_SHINY_DEPENDENCIES ${FOLLY_SHINY_DEPENDENCIES} gflags)
+else()
+ set(FOLLY_LINK_LIBRARIES ${FOLLY_LINK_LIBRARIES} ${LIBGFLAGS_LIBRARY})
+ set(FOLLY_INCLUDE_DIRECTORIES ${FOLLY_INCLUDE_DIRECTORIES} ${LIBGFLAGS_INCLUDE_DIR})
+endif()
+
+if(TARGET glog::glog)
+ set(FOLLY_SHINY_DEPENDENCIES ${FOLLY_SHINY_DEPENDENCIES} glog::glog)
+else()
+ set(FOLLY_LINK_LIBRARIES ${FOLLY_LINK_LIBRARIES} ${LIBGLOG_LIBRARY})
+ set(FOLLY_INCLUDE_DIRECTORIES ${FOLLY_INCLUDE_DIRECTORIES} ${LIBGLOG_INCLUDE_DIR})
+endif()
+
+if(TARGET event)
+ set(FOLLY_SHINY_DEPENDENCIES ${FOLLY_SHINY_DEPENDENCIES} event)
+else()
+ set(FOLLY_LINK_LIBRARIES ${FOLLY_LINK_LIBRARIES} ${LIBEVENT_LIB})
+ set(FOLLY_INCLUDE_DIRECTORIES ${FOLLY_INCLUDE_DIRECTORIES} ${LIBEVENT_INCLUDE_DIR})
+endif()
+
+
+set(FOLLY_LINK_LIBRARIES
+ ${FOLLY_LINK_LIBRARIES}
Iphlpapi.lib
Ws2_32.lib

@@ -152,15 +181,12 @@ set(FOLLY_LINK_LIBRARIES

target_include_directories(folly_base
PUBLIC
- ${DOUBLE_CONVERSION_INCLUDE_DIR}
- ${LIBGFLAGS_INCLUDE_DIR}
- ${LIBGLOG_INCLUDE_DIR}
- ${LIBEVENT_INCLUDE_DIR}
- $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
+ ${FOLLY_INCLUDE_DIRECTORIES}
)

foreach (LIB ${FOLLY_SHINY_DEPENDENCIES})
target_include_directories(folly_base PUBLIC $<TARGET_PROPERTY:${LIB},INCLUDE_DIRECTORIES>)
+ target_compile_definitions(folly_base PUBLIC $<TARGET_PROPERTY:${LIB},INTERFACE_COMPILE_DEFINITIONS>)
endforeach()

if (FOLLY_HAVE_PTHREAD)
14 changes: 12 additions & 2 deletions ports/folly/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,21 @@ set(ENV{PATH} "$ENV{PATH};${PYTHON3_DIR}")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO facebook/folly
REF v2017.07.17.01
SHA512 1529941ebcc9ee3502e4ab07463bb5bc6a397259cbbf1817ac64fd186fd4cd964ffe8b473fe6a432e80632ffa553106a0d3fe2962e860eb409e3391029ed5584
REF v2017.10.02.00
SHA512 4fc7840c7a6c528c8ba6a21817bc75f15f5cd5f781d104a1f0622fe1085a6cb26ff9749616b164afff0ea46be6d16877457a98f417e6dbe1044db7605650a6d3
HEAD_REF master
)

vcpkg_apply_patches(
SOURCE_PATH
${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/fix-static-linking.diff
${CMAKE_CURRENT_LIST_DIR}/fix-malloc.diff
${CMAKE_CURRENT_LIST_DIR}/fix-MSG_ERRQUEUE.diff
${CMAKE_CURRENT_LIST_DIR}/fix-histogram.diff
)

if(VCPKG_CRT_LINKAGE STREQUAL static)
set(MSVC_USE_STATIC_RUNTIME ON)
else()
Expand Down

0 comments on commit 5c5e130

Please sign in to comment.