2
0

xmake.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132
  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.10.0", "5e6db72df423ae225bfe8897069f6def40faa8931f456b99d79b8b4d664c6671")
  8. add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
  9. if is_plat("windows", "mingw") then
  10. add_syslinks("ws2_32")
  11. end
  12. add_deps("cmake")
  13. on_install(function (package)
  14. local configs = {"-DBUILD_TESTING=OFF"}
  15. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  16. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  17. if package:is_plat("windows") then
  18. table.insert(configs, "-DMSVC_STATIC_RUNTIME=" .. (package:has_runtime("MT") and "ON" or "OFF"))
  19. end
  20. table.insert(configs, "-DMAXMINDDB_BUILD_BINARIES=" .. (package:config("tools") and "ON" or "OFF"))
  21. import("package.tools.cmake").install(package, configs)
  22. end)
  23. on_test(function (package)
  24. assert(package:has_cfuncs("MMDB_open", {includes = "maxminddb.h"}))
  25. end)