xmake.lua 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package("zint")
  2. set_homepage("http://www.zint.org.uk")
  3. set_description("A barcode encoding library supporting over 50 symbologies including Code 128, Data Matrix, USPS OneCode, EAN-128, UPC/EAN, ITF, QR Code, Code 16k, PDF417, MicroPDF417, LOGMARS, Maxicode, GS1 DataBar, Aztec, Composite Symbols and more.")
  4. set_license("GPL-3.0")
  5. set_urls("https://github.com/zint/zint/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/zint/zint.git")
  7. add_versions("2.14.0", "affc3e334e8ee0fc5552aabbc5f1360d4d6d9c6f86285c1e138e3efbbdc4abcb")
  8. add_configs("png", {description = "Build with PNG support", default = false, type = "boolean"})
  9. add_configs("qt", {description = "Build with Qt support", default = false, type = "boolean", readonly = true})
  10. add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
  11. if is_plat("linux", "bsd") then
  12. add_syslinks("m")
  13. end
  14. add_deps("cmake")
  15. on_load(function (package)
  16. if package:config("png") then
  17. package:add("deps", "libpng")
  18. end
  19. if package:is_plat("windows") and package:config("shared") then
  20. package:add("defines", "ZINT_DLL")
  21. end
  22. end)
  23. on_install(function (package)
  24. local configs = {"-DZINT_UNINSTALL=OFF"}
  25. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  26. table.insert(configs, "-DZINT_DEBUG=" .. (package:is_debug() and "ON" or "OFF"))
  27. table.insert(configs, "-DZINT_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
  28. table.insert(configs, "-DZINT_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
  29. table.insert(configs, "-DZINT_SANITIZE=" .. (package:config("asan") and "ON" or "OFF"))
  30. table.insert(configs, "-DZINT_USE_PNG=" .. (package:config("png") and "ON" or "OFF"))
  31. table.insert(configs, "-DZINT_USE_QT=" .. (package:config("qt") and "ON" or "OFF"))
  32. table.insert(configs, "-DZINT_FRONTEND=" .. (package:config("tools") and "ON" or "OFF"))
  33. local opt = {}
  34. if package:has_tool("cxx", "cl") then
  35. opt.cxflags = "/utf-8"
  36. end
  37. import("package.tools.cmake").install(package, configs, opt)
  38. end)
  39. on_test(function (package)
  40. assert(package:has_cfuncs("ZBarcode_Create", {includes = "zint.h"}))
  41. end)