xmake.lua 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package("replxx")
  2. set_homepage("https://github.com/AmokHuginnsson/replxx")
  3. set_description("A readline and libedit replacement that supports UTF-8, syntax highlighting, hints and Windows and is BSD licensed.")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://github.com/AmokHuginnsson/replxx.git")
  6. add_versions("2021.11.25", "1f149bfe20bf6e49c1afd4154eaf0032c8c2fda2")
  7. add_deps("cmake")
  8. if on_check then
  9. on_check("android", function (package)
  10. local ndk = package:toolchain("ndk")
  11. local ndk_sdkver = ndk:config("ndk_sdkver")
  12. assert(ndk_sdkver and tonumber(ndk_sdkver) > 23, "package(replxx): need ndk api level > 23")
  13. end)
  14. end
  15. on_load(function(package)
  16. if package:is_plat("linux", "bsd") then
  17. package:add("syslinks", "pthread")
  18. end
  19. if not package:config("shared") then
  20. package:add("defines", "REPLXX_STATIC")
  21. end
  22. end)
  23. on_install(function (package)
  24. local configs = {"-DREPLXX_BUILD_EXAMPLES=OFF", "-DREPLXX_BUILD_PACKAGE=OFF"}
  25. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  26. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  27. import("package.tools.cmake").install(package, configs)
  28. end)
  29. on_test(function (package)
  30. assert(package:check_cxxsnippets({
  31. test = [[
  32. #include <replxx.hxx>
  33. int main() {
  34. replxx::Replxx rx;
  35. rx.invoke(replxx::Replxx::ACTION::CLEAR_SELF, 0);
  36. }
  37. ]]
  38. }, {configs = {languages = "c++11"}}))
  39. end)