xmake.lua 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package("msquic")
  2. set_homepage("https://github.com/microsoft/msquic")
  3. set_description("Cross-platform, C implementation of the IETF QUIC protocol.")
  4. set_license("MIT")
  5. add_urls("https://github.com/microsoft/msquic.git")
  6. add_versions("v1.9.0", "v1.9.0")
  7. add_deps("cmake")
  8. add_includedirs("msquic/include")
  9. if is_plat("macosx") then
  10. add_frameworks("CoreFoundation", "Security")
  11. elseif is_plat("linux") then
  12. add_syslinks("pthread", "dl", "m")
  13. end
  14. on_load(function (package)
  15. if package:config("shared") then
  16. package:add("links", "msquic")
  17. else
  18. package:add("links", "msquic_static")
  19. end
  20. package:add("links", "core", "platform", "ssl", "crypto")
  21. end)
  22. on_install("linux", "macosx", function (package)
  23. local configs = {"-DQUIC_BUILD_TOOLS=OFF",
  24. "-DQUIC_BUILD_TEST=OFF",
  25. "-DQUIC_BUILD_PERF=OFF"}
  26. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  27. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  28. import("package.tools.cmake").install(package, configs, {buildir = "build"})
  29. if package:debug() then
  30. os.cp("build/*/Debug/*", package:installdir("lib"))
  31. else
  32. os.cp("build/*/Release/*", package:installdir("lib"))
  33. end
  34. os.cp("build/*/*/openssl/lib/*", package:installdir("lib"))
  35. end)
  36. on_test(function (package)
  37. assert(package:has_cfuncs("MsQuicOpenVersion", {includes = "msquic.h"}))
  38. end)