xmake.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package("libmaxminddb")
  2. set_homepage("https://maxmind.github.io/libmaxminddb/")
  3. set_description("C library for the MaxMind DB file format")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/maxmind/libmaxminddb/releases/download/$(version)/libmaxminddb-$(version).tar.gz",
  6. "https://github.com/maxmind/libmaxminddb.git")
  7. add_versions("1.12.2", "1bfbf8efba3ed6462e04e225906ad5ce5fe958aa3d626a1235b2a2253d600743")
  8. add_versions("1.11.0", "b2eea79a96fed77ad4d6c39ec34fed83d45fcb75a31c58956813d58dcf30b19f")
  9. add_versions("1.10.0", "5e6db72df423ae225bfe8897069f6def40faa8931f456b99d79b8b4d664c6671")
  10. add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
  11. if is_plat("wasm") then
  12. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  13. end
  14. if is_plat("windows", "mingw") then
  15. add_syslinks("ws2_32")
  16. end
  17. add_deps("cmake")
  18. on_install(function (package)
  19. local configs = {"-DBUILD_TESTING=OFF"}
  20. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  21. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  22. if package:is_plat("windows") then
  23. table.insert(configs, "-DMSVC_STATIC_RUNTIME=" .. (package:has_runtime("MT") and "ON" or "OFF"))
  24. end
  25. table.insert(configs, "-DMAXMINDDB_BUILD_BINARIES=" .. (package:config("tools") and "ON" or "OFF"))
  26. import("package.tools.cmake").install(package, configs)
  27. end)
  28. on_test(function (package)
  29. assert(package:has_cfuncs("MMDB_open", {includes = "maxminddb.h"}))
  30. end)