xmake.lua 1.4 KB

1234567891011121314151617181920212223242526272829
  1. package("libharu")
  2. set_homepage("http://libharu.org/")
  3. set_description("libHaru is a free, cross platform, open source library for generating PDF files.")
  4. set_license("zlib")
  5. add_urls("https://github.com/libharu/libharu/archive/refs/tags/RELEASE_$(version).tar.gz", {version = function (version) return version:gsub("%.", "_") end})
  6. add_urls("https://github.com/libharu/libharu.git")
  7. add_versions("2.3.0", "8f9e68cc5d5f7d53d1bc61a1ed876add1faf4f91070dbc360d8b259f46d9a4d2")
  8. add_deps("cmake", "zlib", "libpng")
  9. on_load("windows", function (package)
  10. if package:config("shared") then
  11. package:add("defines", "HPDF_DLL")
  12. end
  13. end)
  14. on_install("windows", "macosx", "linux", function (package)
  15. io.replace("src/CMakeLists.txt", "install(FILES ${addlib}", "#", {plain = true})
  16. local configs = {"-DLIBHPDF_EXAMPLES=OFF"}
  17. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  18. table.insert(configs, "-DLIBHPDF_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
  19. table.insert(configs, "-DLIBHPDF_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
  20. import("package.tools.cmake").install(package, configs)
  21. end)
  22. on_test(function (package)
  23. assert(package:has_cfuncs("HPDF_GetVersion", {includes = "hpdf.h"}))
  24. end)