xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. package("nghttp3")
  2. set_homepage("https://github.com/ngtcp2/nghttp3")
  3. set_description("HTTP/3 library written in C")
  4. set_license("MIT")
  5. add_urls("https://github.com/ngtcp2/nghttp3/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/ngtcp2/nghttp3.git")
  7. add_versions("v1.3.0", "a83c6a4f589ae777a5f967652969d99b3399a85971340b8de9bed79119a11f88")
  8. add_patches("v1.3.0", "patches/vendor.patch", "51ab785328270b8df854283a8c20403c09813b0586eb84702a9c20241ff14980")
  9. add_deps("cmake", "sfparse")
  10. on_load("windows", function (package)
  11. if not package:config("shared") then
  12. package:add("defines", "NGHTTP3_STATICLIB")
  13. end
  14. end)
  15. on_install("windows", "macosx", "linux", function (package)
  16. local configs = {"-DENABLE_LIB_ONLY=ON", "-DBUILD_TESTING=OFF"}
  17. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  18. table.insert(configs, "-DENABLE_SHARED_LIB=" .. (package:config("shared") and "ON" or "OFF"))
  19. table.insert(configs, "-DENABLE_STATIC_LIB=" .. (package:config("shared") and "OFF" or "ON"))
  20. if package:is_plat("windows") then
  21. table.insert(configs, "-DENABLE_STATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  22. end
  23. import("package.tools.cmake").install(package, configs, {packagedeps = "sfparse"})
  24. end)
  25. on_test(function (package)
  26. assert(package:has_cfuncs("nghttp3_version", {includes = "nghttp3/nghttp3.h"}))
  27. end)