xmake.lua 1.3 KB

12345678910111213141516171819202122232425
  1. package("hdrhistogram_c")
  2. set_homepage("https://github.com/HdrHistogram/HdrHistogram_c")
  3. set_description("C port of High Dynamic Range (HDR) Histogram")
  4. add_urls("https://github.com/HdrHistogram/HdrHistogram_c.git")
  5. add_versions("2021.1.25", "7615a45ed0975d76dced55eaeac4ad13b150a983")
  6. add_deps("cmake", "zlib")
  7. on_install("linux", "windows", "macosx", function (package)
  8. local configs = {"-DHDR_HISTOGRAM_BUILD_PROGRAMS=OFF"}
  9. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  10. table.insert(configs, "-DHDR_HISTOGRAM_BUILD_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
  11. table.insert(configs, "-DHDR_HISTOGRAM_INSTALL_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
  12. table.insert(configs, "-DHDR_HISTOGRAM_BUILD_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
  13. table.insert(configs, "-DHDR_HISTOGRAM_INSTALL_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
  14. if package:is_plat("windows") and package:config("shared") then
  15. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  16. end
  17. import("package.tools.cmake").install(package, configs)
  18. end)
  19. on_test(function (package)
  20. assert(package:has_cfuncs("hdr_init", {includes = "hdr/hdr_histogram.h"}))
  21. end)