diff --git a/packages/g/gzip-hpp/xmake.lua b/packages/g/gzip-hpp/xmake.lua new file mode 100644 index 000000000..33022d851 --- /dev/null +++ b/packages/g/gzip-hpp/xmake.lua @@ -0,0 +1,37 @@ +package("gzip-hpp") + set_kind("library", {headeronly = true}) + set_homepage("https://github.com/mapbox/gzip-hpp") + set_description("Gzip header-only C++ library") + set_license("MIT") + + add_urls("https://github.com/mapbox/gzip-hpp/archive/$(version).tar.gz", + "https://github.com/mapbox/gzip-hpp.git") + + add_versions("v0.1.0", "7ce3908cd13f186987820be97083fc5e62a7c6df0877af44b334a92e868eff06") + + add_deps("zlib") + + on_install(function (package) + io.replace("include/gzip/utils.hpp", "#include ", "#include \n#include ", {plain = true}) + os.cp("include", package:installdir()) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + #include + #include + #include + + void test() { + const std::string data("Hello World"); + for (int level = Z_BEST_SPEED; level <= Z_BEST_COMPRESSION; ++level) + { + std::string compressed_data = gzip::compress(data.data(), data.size()); + assert(gzip::is_compressed(compressed_data.data(), compressed_data.size())); + std::string new_data = gzip::decompress(compressed_data.data(), compressed_data.size()); + assert(data == new_data); + } + } + ]]}, {configs = {languages = "cxx11"}})) + end) \ No newline at end of file