xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. package("zlibcomplete")
  2. set_homepage("https://github.com/rudi-cilibrasi/zlibcomplete")
  3. set_description("C++ interface to the ZLib library supporting compression with FLUSH, decompression, and std::string. RAII")
  4. set_license("MIT")
  5. add_urls("https://github.com/rudi-cilibrasi/zlibcomplete/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/rudi-cilibrasi/zlibcomplete.git")
  7. add_versions("1.0.5", "2b263983823395eaabb091cb9b629eb8466fe24b929bba7ff6d833cadad11977")
  8. add_deps("cmake", "zlib")
  9. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  10. on_install(function (package)
  11. local configs = {}
  12. table.insert(configs, "-DZLIBCOMPLETE_EXAMPLES=off")
  13. table.insert(configs, "-DZLIBCOMPLETE_DOCS=off")
  14. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  15. table.insert(configs, "-DCMAKE_POLICY_DEFAULT_CMP0057=NEW")
  16. if package:config("shared") then
  17. table.insert(configs, "-DZLIBCOMPLETE_SHARED=on")
  18. else
  19. table.insert(configs, "-DZLIBCOMPLETE_STATIC=on")
  20. end
  21. if package:is_cross() then
  22. table.insert(configs, "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY")
  23. end
  24. import("package.tools.cmake").install(package, configs)
  25. os.cp("lib/zlc/*.hpp", package:installdir("include", "zlc"))
  26. end)
  27. on_test(function (package)
  28. assert(package:has_cxxincludes("zlc/zlibcomplete.hpp"))
  29. end)