xmake.lua 1.2 KB

123456789101112131415161718192021222324252627282930
  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.git")
  6. add_versions("2022.02.08", "98402fb68fffc0ab1b211a5f07c1425dfd42d217")
  7. add_deps("cmake")
  8. on_load("windows", function (package)
  9. if not package:config("shared") then
  10. package:add("defines", "NGHTTP3_STATICLIB")
  11. end
  12. end)
  13. on_install("windows", "macosx", "linux", function (package)
  14. local configs = {"-DENABLE_LIB_ONLY=ON"}
  15. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  16. table.insert(configs, "-DENABLE_SHARED_LIB=" .. (package:config("shared") and "ON" or "OFF"))
  17. table.insert(configs, "-DENABLE_STATIC_LIB=" .. (package:config("shared") and "OFF" or "ON"))
  18. if package:is_plat("windows") then
  19. table.insert(configs, "-DENABLE_STATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  20. end
  21. import("package.tools.cmake").install(package, configs)
  22. end)
  23. on_test(function (package)
  24. assert(package:has_cfuncs("nghttp3_version", {includes = "nghttp3/nghttp3.h"}))
  25. end)