2
0

xmake.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. package("libtomcrypt")
  2. set_homepage("https://www.libtom.net")
  3. set_description("A fairly comprehensive, modular and portable cryptographic toolkit.")
  4. set_license("Unlicense")
  5. add_urls("https://github.com/libtom/libtomcrypt.git")
  6. add_versions("2024.06.26", "2302a3a89752b317d59e9cdb67d2d4eb9b53be8e")
  7. add_deps("libtommath", "cmake")
  8. on_install("!wasm and (macosx|!x86_64 or !macosx)", function (package)
  9. local configs = {}
  10. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  11. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  12. if package:is_plat("windows") and package:config("shared") then
  13. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  14. end
  15. import("package.tools.cmake").install(package, configs)
  16. end)
  17. on_test(function (package)
  18. assert(package:check_cxxsnippets({test = [[
  19. #include <libtomcrypt/tomcrypt.h>
  20. void test() {
  21. unsigned char input[] = "hello";
  22. unsigned long input_len = 5;
  23. char out[256];
  24. unsigned long out_len;
  25. base64_encode(input, input_len, out, &out_len);
  26. }
  27. ]]}, {configs = {languages = "cxx11"}}))
  28. end)