* add folly

* force folly to be a static library on windows
pull/472/head
Hoildkv 3 years ago committed by GitHub
parent 6417275dcf
commit c745f29ee9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 33
      packages/f/folly/patches/2021.06.28/regex.patch
  2. 27
      packages/f/folly/patches/2021.06.28/reorder.patch
  3. 52
      packages/f/folly/xmake.lua

@ -0,0 +1,33 @@
diff --git a/folly/experimental/TestUtil.cpp b/folly/experimental/TestUtil.cpp
--- a/folly/experimental/TestUtil.cpp
+++ b/folly/experimental/TestUtil.cpp
@@ -19,6 +19,7 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include <folly/portability/Windows.h>
#include <boost/regex.hpp>
#include <glog/logging.h>
diff --git a/folly/experimental/io/HugePages.cpp b/folly/experimental/io/HugePages.cpp
--- a/folly/experimental/io/HugePages.cpp
+++ b/folly/experimental/io/HugePages.cpp
@@ -27,6 +27,7 @@
#include <stdexcept>
#include <system_error>
+#include <folly/portability/Windows.h>
#include <boost/regex.hpp>
#include <folly/Conv.h>
diff --git a/folly/Benchmark.cpp b/folly/Benchmark.cpp
--- a/folly/Benchmark.cpp
+++ b/folly/Benchmark.cpp
@@ -29,6 +29,7 @@
#include <utility>
#include <vector>
+#include <folly/portability/Windows.h>
#include <boost/regex.hpp>
#include <folly/FileUtil.h>

@ -0,0 +1,27 @@
diff --git a/CMake/folly-deps.cmake b/CMake/folly-deps.cmake
--- a/CMake/folly-deps.cmake
+++ b/CMake/folly-deps.cmake
@@ -52,6 +52,11 @@ find_package(DoubleConversion MODULE REQUIRED)
list(APPEND FOLLY_LINK_LIBRARIES ${DOUBLE_CONVERSION_LIBRARY})
list(APPEND FOLLY_INCLUDE_DIRECTORIES ${DOUBLE_CONVERSION_INCLUDE_DIR})
+find_package(Glog CONFIG REQUIRED)
+set(FOLLY_HAVE_LIBGLOG ${GLOG_FOUND})
+list(APPEND FOLLY_LINK_LIBRARIES glog::glog)
+list(APPEND FOLLY_INCLUDE_DIRECTORIES ${GLOG_INCLUDE_DIR})
+
find_package(Gflags MODULE)
set(FOLLY_HAVE_LIBGFLAGS ${LIBGFLAGS_FOUND})
if(LIBGFLAGS_FOUND)
@@ -61,11 +66,6 @@
set(FOLLY_LIBGFLAGS_INCLUDE ${LIBGFLAGS_INCLUDE_DIR})
endif()
-find_package(Glog MODULE)
-set(FOLLY_HAVE_LIBGLOG ${GLOG_FOUND})
-list(APPEND FOLLY_LINK_LIBRARIES ${GLOG_LIBRARY})
-list(APPEND FOLLY_INCLUDE_DIRECTORIES ${GLOG_INCLUDE_DIR})
-
find_package(LibEvent MODULE REQUIRED)
list(APPEND FOLLY_LINK_LIBRARIES ${LIBEVENT_LIB})
list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBEVENT_INCLUDE_DIR})

@ -0,0 +1,52 @@
package("folly")
set_homepage("https://github.com/facebook/folly")
set_description("An open-source C++ library developed and used at Facebook.")
set_license("Apache-2.0")
add_urls("https://github.com/facebook/folly/releases/download/v$(version).00/folly-v$(version).00.zip",
"https://github.com/facebook/folly.git")
add_versions("2021.06.28", "477765d43045d82ac6a2750142aed9534cd5efc1fbf2be622bb682a8c02a45a4")
add_patches("2021.06.28", path.join(os.scriptdir(), "patches", "2021.06.28", "reorder.patch"), "9a6bf283881580474040cfc7a8e89d461d68b89bae5583d89fff0a3198739980")
add_patches("2021.06.28", path.join(os.scriptdir(), "patches", "2021.06.28", "regex.patch"), "6a77ade9f48dd9966d3f7154e66ca8a5c030ae2b6d335cbe3315784aefd8f495")
if is_plat("windows") then
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
end
add_deps("cmake")
add_deps("boost", {configs = {context = true, filesystem = true, program_options = true, regex = true, system = true, thread = true}})
add_deps("libevent", {configs = {openssl = true}})
add_deps("double-conversion", "gflags", "glog", "zlib", "fmt")
add_deps("bzip2", "lz4", "zstd", {optional = true})
if is_plat("linux") then
add_syslinks("pthread")
end
on_install("windows|x64", "linux", "macosx", function (package)
local configs = {"-DBUILD_TESTS=OFF",
"-DCMAKE_DISABLE_FIND_PACKAGE_LibDwarf=ON",
"-DCMAKE_DISABLE_FIND_PACKAGE_Libiberty=ON",
"-DCMAKE_DISABLE_FIND_PACKAGE_LibAIO=ON",
"-DCMAKE_DISABLE_FIND_PACKAGE_LibURCU=ON",
"-DLIBAIO_FOUND=OFF",
"-DLIBURCU_FOUND=OFF",
"-DBOOST_LINK_STATIC=ON"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
if package:is_plat("windows") then
table.insert(configs, "-DBoost_USE_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
end
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <cassert>
void test() {
folly::CpuId id;
assert(folly::kIsArchAmd64 == id.mmx());
}
]]}, {configs = {languages = "c++17"}, includes = "folly/CpuId.h"}))
end)
Loading…
Cancel
Save