xmake.lua 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. set_project("giflib")
  2. option("utils", {showmenu = true, default = false})
  3. add_rules("mode.debug", "mode.release")
  4. target("gif")
  5. set_kind("$(kind)")
  6. add_files(
  7. "dgif_lib.c",
  8. "egif_lib.c",
  9. "gifalloc.c",
  10. "gif_err.c",
  11. "gif_font.c",
  12. "gif_hash.c",
  13. "openbsd-reallocarray.c"
  14. )
  15. add_headerfiles("gif_lib.h")
  16. if is_plat("windows") then
  17. add_files("gif_font.c", {defines = "strtok_r=strtok_s"})
  18. if is_kind("shared") then
  19. add_rules("utils.symbols.export_all")
  20. end
  21. end
  22. target_end()
  23. if has_config("utils") then
  24. if is_plat("windows") then
  25. add_requires("cgetopt")
  26. end
  27. target("utils")
  28. set_kind("$(kind)")
  29. add_files("getarg.c", "qprintf.c", "quantize.c")
  30. add_deps("gif")
  31. if is_plat("windows") and is_kind("shared") then
  32. add_rules("utils.symbols.export_all")
  33. end
  34. for _, tool in ipairs({"gif2rgb", "gifbuild", "gifclrmp", "giffix", "giftext", "giftool"}) do
  35. target(tool)
  36. set_kind("binary")
  37. add_files(tool .. ".c")
  38. add_deps("utils")
  39. if is_plat("windows") then
  40. add_packages("cgetopt")
  41. end
  42. end
  43. end