xmake.lua 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package("libbigwig")
  2. set_homepage("https://github.com/dpryan79/libBigWig")
  3. set_description("A C library for handling bigWig files")
  4. set_license("MIT")
  5. add_urls("https://github.com/dpryan79/libBigWig/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/dpryan79/libBigWig.git")
  7. add_versions("0.4.7", "8e057797011d93fa00e756600898af4fe6ca2d48959236efc9f296abe94916d9")
  8. add_configs("curl", {description = "Enable CURL support", default = false, type = "boolean"})
  9. add_configs("zlib_ng", {description = "Link to zlib-ng instead of zlib", default = false, type = "boolean"})
  10. if is_plat("linux") then
  11. add_syslinks("m")
  12. end
  13. add_deps("cmake")
  14. on_load(function (package)
  15. if package:config("curl") then
  16. package:add("deps", "libcurl")
  17. end
  18. package:add("deps", (package:config("zlib_ng") and "zlib-ng" or "zlib"))
  19. end)
  20. on_install("linux", "macosx", "bsd", "mingw", "msys", "android", "iphoneos", "cross", function (package)
  21. local configs = {}
  22. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  23. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  24. table.insert(configs, "-DWITH_ZLIBNG=" .. (package:config("zlib_ng") and "ON" or "OFF"))
  25. if package:config("curl") then
  26. table.insert(configs, "-DWITH_CURL=ON")
  27. else
  28. table.insert(configs, "-DWITH_CURL=OFF")
  29. package:add("defines", "NOCURL")
  30. end
  31. import("package.tools.cmake").install(package, configs)
  32. end)
  33. on_test(function (package)
  34. assert(package:has_cfuncs("bwOpen", {includes = "libbigwig/bigWig.h", {configs = {languages = "c11"}}}))
  35. end)