xmake.lua 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package("lsp-framework")
  2. set_homepage("https://github.com/leon-bckl/lsp-framework")
  3. set_description("Language Server Protocol implementation in C++")
  4. set_license("MIT")
  5. add_urls("https://github.com/leon-bckl/lsp-framework/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/leon-bckl/lsp-framework.git")
  7. add_versions("1.0.1", "07f924d851896a2d424d554d20820483f8458aa1ff907bb68657b0d2d0bd0d13")
  8. add_patches("1.0.1", "patches/1.0.1/fix-install.diff", "bb5e4436091ba1846144ffa80fb8afd4d0213760bce45dd6fd31662905cb4bc3")
  9. add_patches("1.0.1", "patches/1.0.1/fix-missing-ios.diff", "8447605c2ed14cfbf394b29ffe2348e2179424504100aa01cd88b3d054e5ceb1")
  10. add_deps("cmake")
  11. if is_plat("linux", "bsd") then
  12. add_syslinks("pthread")
  13. elseif is_plat("windows", "mingw") then
  14. add_syslinks("ws2_32")
  15. end
  16. if on_check then
  17. on_check("windows|arm64", function (package)
  18. import("core.base.semver")
  19. local vs = package:toolchain("msvc"):config("vs")
  20. assert(tonumber(vs) >= 2022, "lsp-framework requires Visual Studio 2022 and later for arm64 targets")
  21. assert(os.arch() == "arm64", "package(lsp-framework): requires host arch to be arm64.")
  22. end)
  23. end
  24. on_install("windows", "linux", "macosx", "mingw@windows", "bsd", function (package)
  25. local configs = {}
  26. table.insert(configs, "-DLSP_USE_SANITIZERS=" .. (package:config("asan") and "ON" or "OFF"))
  27. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  28. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  29. import("package.tools.cmake").install(package, configs)
  30. end)
  31. on_test(function (package)
  32. assert(package:check_cxxsnippets({test = [[
  33. #include <lsp/messages.h>
  34. #include <lsp/connection.h>
  35. #include <lsp/io/standardio.h>
  36. #include <lsp/messagehandler.h>
  37. void test() {
  38. auto connection = lsp::Connection(lsp::io::standardIO());
  39. auto messageHandler = lsp::MessageHandler(connection);
  40. }
  41. ]]}, {configs = {languages = "c++20"}}))
  42. end)