xmake.lua 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package("libtommath")
  2. set_homepage("https://www.libtom.net")
  3. set_description("LibTomMath is a free open source portable number theoretic multiple-precision integer library written entirely in C.")
  4. set_license("Unlicense")
  5. add_urls("https://github.com/libtom/libtommath/releases/download/v$(version)/ltm-$(version).tar.xz",
  6. "https://github.com/libtom/libtommath/releases/download/v$(version)/ltm-$(version).tar.xz",
  7. "https://github.com/libtom/libtommath.git")
  8. add_versions("1.3.0", "296272d93435991308eb73607600c034b558807a07e829e751142e65ccfa9d08")
  9. if is_plat("mingw") and is_subhost("msys") then
  10. add_extsources("pacman::libtommath")
  11. elseif is_plat("linux") then
  12. add_extsources("pacman::libtommath", "apt::libtommath-dev")
  13. elseif is_plat("macosx") then
  14. add_extsources("brew::libtommath")
  15. end
  16. add_deps("cmake")
  17. on_install(function (package)
  18. local configs = {}
  19. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  20. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  21. table.insert(configs, "-DCOMPILE_LTO =" .. (package:config("lto") and "ON" or "OFF"))
  22. if package:is_plat("windows") and package:config("shared") then
  23. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  24. end
  25. import("package.tools.cmake").install(package, configs)
  26. end)
  27. on_test(function (package)
  28. assert(package:has_cfuncs("mp_init", {includes = "tommath.h"}))
  29. end)