xmake.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package("aklomp-base64")
  2. set_homepage("https://github.com/aklomp/base64")
  3. set_description("Fast Base64 stream encoder/decoder in C99, with SIMD acceleration.")
  4. set_license("BSD-2-Clause")
  5. add_urls("https://github.com/aklomp/base64/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/aklomp/base64.git")
  7. add_versions("v0.5.2", "723a0f9f4cf44cf79e97bcc315ec8f85e52eb104c8882942c3f2fba95acc080d")
  8. add_deps("cmake")
  9. on_load(function (package)
  10. package:add("links", "base64")
  11. if not package:config("shared") then
  12. package:add("defines", "BASE64_STATIC_DEFINE")
  13. end
  14. end)
  15. on_install(function (package)
  16. local configs = {}
  17. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  18. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  19. import("package.tools.cmake").install(package, configs)
  20. end)
  21. on_test(function (package)
  22. assert(package:check_csnippets({test = [[
  23. void test() {
  24. char src[] = "hello world";
  25. char out[20];
  26. size_t srclen = sizeof(src) - 1;
  27. size_t outlen;
  28. base64_encode(src, srclen, out, &outlen, 0);
  29. }
  30. ]]}, {configs = {languages = "c99"}, includes = "libbase64.h"}))
  31. end)