Skip to content

Commit

Permalink
[folly]: fix lz4 Snappy deps (#27998)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiayuehua authored Nov 28, 2022
1 parent 90e8f9d commit 300f6a2
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
42 changes: 36 additions & 6 deletions ports/folly/fix-deps.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/CMake/folly-config.cmake.in b/CMake/folly-config.cmake.in
index 1689f9a..1d3295a 100644
index 1689f9a..801d562 100644
--- a/CMake/folly-config.cmake.in
+++ b/CMake/folly-config.cmake.in
@@ -28,10 +28,24 @@ endif()
@@ -28,10 +28,30 @@ endif()
set(FOLLY_LIBRARIES Folly::folly)

# Find folly's dependencies
Expand All @@ -21,6 +21,12 @@ index 1689f9a..1d3295a 100644
+if (NOT @CMAKE_DISABLE_FIND_PACKAGE_unofficial-sodium@)
+ find_dependency(unofficial-sodium CONFIG)
+endif()
+if (NOT @CMAKE_DISABLE_FIND_PACKAGE_Snappy@)
+ find_dependency(Snappy CONFIG)
+endif()
+if (NOT @CMAKE_DISABLE_FIND_PACKAGE_LZ4@)
+ find_dependency(lz4 CONFIG)
+endif()
+find_dependency(fmt CONFIG)

set(Boost_USE_STATIC_LIBS "@FOLLY_BOOST_LINK_STATIC@")
Expand All @@ -30,7 +36,7 @@ index 1689f9a..1d3295a 100644
context
filesystem
diff --git a/CMake/folly-deps.cmake b/CMake/folly-deps.cmake
index 4b78e9f..6228bf9 100644
index 4b78e9f..d4c224e 100644
--- a/CMake/folly-deps.cmake
+++ b/CMake/folly-deps.cmake
@@ -35,7 +35,7 @@ else()
Expand Down Expand Up @@ -105,8 +111,20 @@ index 4b78e9f..6228bf9 100644
endif()

find_package(OpenSSL 1.1.1 MODULE REQUIRED)
@@ -111,11 +112,15 @@ if (LZ4_FOUND)
list(APPEND FOLLY_LINK_LIBRARIES ${LZ4_LIBRARY})
@@ -104,25 +105,29 @@ if (LIBLZMA_FOUND)
list(APPEND FOLLY_LINK_LIBRARIES ${LIBLZMA_LIBRARIES})
endif()

-find_package(LZ4 MODULE)
-set(FOLLY_HAVE_LIBLZ4 ${LZ4_FOUND})
-if (LZ4_FOUND)
- list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LZ4_INCLUDE_DIR})
- list(APPEND FOLLY_LINK_LIBRARIES ${LZ4_LIBRARY})
+if (NOT CMAKE_DISABLE_FIND_PACKAGE_LZ4)
+ find_package(lz4 CONFIG)
+ if(TARGET lz4::lz4)
+ list(APPEND FOLLY_LINK_LIBRARIES lz4::lz4)
+ endif()
endif()

-find_package(Zstd MODULE)
Expand All @@ -125,7 +143,19 @@ index 4b78e9f..6228bf9 100644
+ endif()
endif()

find_package(Snappy MODULE)
-find_package(Snappy MODULE)
-set(FOLLY_HAVE_LIBSNAPPY ${SNAPPY_FOUND})
-if (SNAPPY_FOUND)
- list(APPEND FOLLY_INCLUDE_DIRECTORIES ${SNAPPY_INCLUDE_DIR})
- list(APPEND FOLLY_LINK_LIBRARIES ${SNAPPY_LIBRARY})
+if (NOT CMAKE_DISABLE_FIND_PACKAGE_Snappy)
+ find_package(Snappy CONFIG)
+ if(TARGET Snappy::snappy)
+ list(APPEND FOLLY_LINK_LIBRARIES Snappy::snappy)
+ endif()
endif()

find_package(LibDwarf)
@@ -141,9 +146,12 @@ find_package(LibUring)
list(APPEND FOLLY_LINK_LIBRARIES ${LIBURING_LIBRARIES})
list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBURING_INCLUDE_DIRS})
Expand Down
2 changes: 2 additions & 0 deletions ports/folly/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ vcpkg_from_github(
file(REMOVE "${SOURCE_PATH}/CMake/FindFmt.cmake")
file(REMOVE "${SOURCE_PATH}/CMake/FindLibsodium.cmake")
file(REMOVE "${SOURCE_PATH}/CMake/FindZstd.cmake")
file(REMOVE "${SOURCE_PATH}/CMake/FindSnappy.cmake")
file(REMOVE "${SOURCE_PATH}/CMake/FindLZ4.cmake")
file(REMOVE "${SOURCE_PATH}/build/fbcode_builder/CMake/FindDoubleConversion.cmake")
file(REMOVE "${SOURCE_PATH}/build/fbcode_builder/CMake/FindGMock.cmake")
file(REMOVE "${SOURCE_PATH}/build/fbcode_builder/CMake/FindGflags.cmake")
Expand Down
2 changes: 1 addition & 1 deletion ports/folly/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "folly",
"version-string": "2022.10.31.00",
"port-version": 2,
"port-version": 3,
"description": "An open-source C++ library developed and used at Facebook. The library is UNSTABLE on Windows",
"homepage": "https://github.com/facebook/folly",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2386,7 +2386,7 @@
},
"folly": {
"baseline": "2022.10.31.00",
"port-version": 2
"port-version": 3
},
"font-chef": {
"baseline": "1.1.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/f-/folly.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "134e8cf60a376c02580a13800bf83d345bf082f9",
"version-string": "2022.10.31.00",
"port-version": 3
},
{
"git-tree": "fe39202619449823918182d7eb34a7eab60e1f59",
"version-string": "2022.10.31.00",
Expand Down

0 comments on commit 300f6a2

Please sign in to comment.