xmake.lua 2.4 KB

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