xmake.lua 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package("pdcurses")
  2. set_homepage("https://pdcurses.org/")
  3. set_description("PDCurses - a curses library for environments that don't fit the termcap/terminfo model.")
  4. add_urls("https://github.com/wmcbrine/PDCurses/archive/refs/tags/$(version).tar.gz",
  5. "https://github.com/wmcbrine/PDCurses.git")
  6. add_versions("3.9", "590dbe0f5835f66992df096d3602d0271103f90cf8557a5d124f693c2b40d7ec")
  7. if not is_plat("windows") then
  8. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  9. end
  10. add_configs("port", {description = "Set the target port.", default = "sdl2", values = {"sdl2", "wincon"}})
  11. on_load(function (package)
  12. if package:config("port") == "sdl2" then
  13. package:add("deps", "libsdl2")
  14. else
  15. package:add("syslinks", "user32", "advapi32")
  16. end
  17. end)
  18. on_install("linux", "macosx", "mingw", "windows", function (package)
  19. io.writefile("xmake.lua", [[
  20. add_rules("mode.debug", "mode.release")
  21. option("port", {description = "Set the target port."})
  22. if is_config("port", "sdl2") then
  23. add_requires("libsdl2")
  24. end
  25. target("pdcurses")
  26. set_kind("$(kind)")
  27. add_files("pdcurses/*.c", "$(port)/*.c")
  28. add_includedirs(".", "$(port)")
  29. add_headerfiles("*.h", "$(port)/*.h")
  30. if is_config("port", "wincon") then
  31. add_defines("PDC_WIDE", "PDC_FORCE_UTF8")
  32. end
  33. add_packages("libsdl2")
  34. ]])
  35. local configs = {}
  36. if package:config("shared") then
  37. configs.kind = "shared"
  38. end
  39. configs.port = package:config("port")
  40. import("package.tools.xmake").install(package, configs)
  41. end)
  42. on_test(function (package)
  43. assert(package:has_cincludes("curses.h"))
  44. end)