xmake.lua 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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.16.0", "e1077fd5846bdd0128fef3ab8c3c28e93e450d2efaf1424d0aa96e0c9e514591")
  8. add_versions("2.15.0", "529ce50566f8421f1707333c201097c490273f93b5de45f4d21231a11d3722cf")
  9. add_versions("2.14.0", "affc3e334e8ee0fc5552aabbc5f1360d4d6d9c6f86285c1e138e3efbbdc4abcb")
  10. add_configs("png", {description = "Build with PNG support", default = false, type = "boolean"})
  11. add_configs("qt", {description = "Build with Qt support", default = false, type = "boolean", readonly = true})
  12. add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
  13. if is_plat("linux", "bsd") then
  14. add_syslinks("m")
  15. end
  16. add_deps("cmake")
  17. on_load(function (package)
  18. if package:config("png") then
  19. package:add("deps", "libpng")
  20. end
  21. if package:is_plat("windows") and package:config("shared") then
  22. package:add("defines", "ZINT_DLL")
  23. end
  24. end)
  25. on_install(function (package)
  26. local configs = {"-DZINT_UNINSTALL=OFF"}
  27. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  28. table.insert(configs, "-DZINT_DEBUG=" .. (package:is_debug() and "ON" or "OFF"))
  29. table.insert(configs, "-DZINT_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
  30. table.insert(configs, "-DZINT_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
  31. table.insert(configs, "-DZINT_SANITIZE=" .. (package:config("asan") and "ON" or "OFF"))
  32. table.insert(configs, "-DZINT_USE_PNG=" .. (package:config("png") and "ON" or "OFF"))
  33. table.insert(configs, "-DZINT_USE_QT=" .. (package:config("qt") and "ON" or "OFF"))
  34. table.insert(configs, "-DZINT_FRONTEND=" .. (package:config("tools") and "ON" or "OFF"))
  35. local opt = {}
  36. if package:has_tool("cxx", "cl") then
  37. opt.cxflags = "/utf-8"
  38. end
  39. import("package.tools.cmake").install(package, configs, opt)
  40. end)
  41. on_test(function (package)
  42. assert(package:has_cfuncs("ZBarcode_Create", {includes = "zint.h"}))
  43. end)