xmake.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package("xquic")
  2. set_homepage("https://github.com/alibaba/xquic")
  3. set_description("A client and server implementation of QUIC and HTTP/3 as specified by the IETF")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/alibaba/xquic.git")
  6. add_versions("2022.01.08", "837c493d51952cd842b815f7d60c88efbad3b9eb")
  7. add_deps("cmake", "boringssl")
  8. on_install("linux", "macosx", function (package)
  9. local configs = {"-DSSL_TYPE=boringssl"}
  10. if package:is_plat("macosx") then
  11. table.insert(configs, "-DPLATFORM=mac")
  12. end
  13. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  14. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  15. io.replace("CMakeLists.txt", "${SSL_LIB_PATH}", "", {plain = true})
  16. io.replace("CMakeLists.txt", "-Werror", "", {plain = true})
  17. io.replace("CMakeLists.txt", "include_directories(${SSL_INC_PATH})", "", {plain = true})
  18. import("package.tools.cmake").install(package, configs, {buildir = "build", packagedeps = "boringssl"})
  19. os.cp("include", package:installdir())
  20. if package:config("shared") then
  21. if package:is_plat("macosx") then
  22. os.cp("build/*.dylib", package:installdir("lib"))
  23. else
  24. os.cp("build/*.so", package:installdir("lib"))
  25. end
  26. else
  27. os.cp("build/*.a", package:installdir("lib"))
  28. end
  29. end)
  30. on_test(function (package)
  31. assert(package:has_cfuncs("xqc_engine_main_logic", {includes = "xquic/xquic.h"}))
  32. end)