xmake.lua 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package("folly")
  2. set_homepage("https://github.com/facebook/folly")
  3. set_description("An open-source C++ library developed and used at Facebook.")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/facebook/folly/releases/download/v$(version).00/folly-v$(version).00.zip",
  6. "https://github.com/facebook/folly.git")
  7. add_versions("2021.06.28", "477765d43045d82ac6a2750142aed9534cd5efc1fbf2be622bb682a8c02a45a4")
  8. add_versions("2021.08.02", "03159657ef7a08c1207d90e63f02d4d6b1241dcae49f11a72441c0c269b269fa")
  9. add_versions("2021.11.01", "2620ad559f1e041f50328c91838cde666d422ed09f23b31bcdbf61e709da5c17")
  10. add_versions("2022.02.14", "6a50d4cc954f0f77efc85af231ee6b7f676a0d743c12b7080fb03fd3da3ffbf2")
  11. add_versions("2022.04.25", "7d5cd59613780d7d2b9c946c810bfd6b0d11ed3a8a74c5ab00d4e9de5d1b2104")
  12. add_versions("2022.08.29", "3adac6d4b203c2917185fd190fc04d615051cb2a4f6b988ddf3c42034efc8d4d")
  13. add_versions("2023.11.20", "7aabcfc5d85ca88fbd06bca1a7381654ec8b0c31fe919788b8d7c18ba50f38ff")
  14. add_patches("<=2022.08.29", path.join(os.scriptdir(), "patches", "2021.06.28", "reorder.patch"), "9a6bf283881580474040cfc7a8e89d461d68b89bae5583d89fff0a3198739980")
  15. add_patches("<=2022.08.29", path.join(os.scriptdir(), "patches", "2021.06.28", "regex.patch"), "6a77ade9f48dd9966d3f7154e66ca8a5c030ae2b6d335cbe3315784aefd8f495")
  16. add_patches("<=2023.11.20", path.join(os.scriptdir(), "patches", "2023.11.20", "pkgconfig.patch"), "6838623d453418569853f62ad97c729e802a120c13d804aabba6d6455997e674")
  17. add_patches("<=2023.11.20", path.join(os.scriptdir(), "patches", "2023.11.20", "msvc.patch"), "1ee01c75528bd42736541022af461e44af3031c01d62c9342006f0abc0f44f2d")
  18. if is_plat("windows") then
  19. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  20. end
  21. add_deps("cmake")
  22. add_deps("boost", {configs = {context = true, filesystem = true, program_options = true, regex = true, system = true, thread = true}})
  23. add_deps("libevent", {configs = {openssl = true}})
  24. add_deps("double-conversion", "gflags", "glog", "zlib", "fmt")
  25. add_deps("bzip2", "lz4", "zstd", {optional = true})
  26. if is_plat("linux") then
  27. add_syslinks("pthread")
  28. end
  29. on_install("windows|x64", "linux", "macosx", function (package)
  30. local configs = {"-DBUILD_TESTS=OFF",
  31. "-DCMAKE_DISABLE_FIND_PACKAGE_LibDwarf=ON",
  32. "-DCMAKE_DISABLE_FIND_PACKAGE_Libiberty=ON",
  33. "-DCMAKE_DISABLE_FIND_PACKAGE_LibAIO=ON",
  34. "-DCMAKE_DISABLE_FIND_PACKAGE_LibURCU=ON",
  35. "-DLIBAIO_FOUND=OFF",
  36. "-DLIBURCU_FOUND=OFF",
  37. "-DBOOST_LINK_STATIC=ON"}
  38. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  39. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  40. if package:is_plat("windows") then
  41. table.insert(configs, "-DBoost_USE_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  42. end
  43. import("package.tools.cmake").install(package, configs)
  44. end)
  45. on_test(function (package)
  46. assert(package:check_cxxsnippets({test = [[
  47. #include <cassert>
  48. void test() {
  49. folly::CpuId id;
  50. assert(folly::kIsArchAmd64 == id.mmx());
  51. }
  52. ]]}, {configs = {languages = "c++17"}, includes = "folly/CpuId.h"}))
  53. end)