xmake.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. package("libminc")
  2. set_homepage("https://github.com/BIC-MNI/libminc")
  3. set_description("libminc is the core library and API of the MINC toolkit")
  4. set_urls("https://github.com/BIC-MNI/libminc/archive/refs/tags/release-$(version).tar.gz",
  5. "https://github.com/BIC-MNI/libminc.git")
  6. add_versions("2.4.06", "2d8b01e67322507000dbfa3e46fa38e12d5c72eb535b169a33a6c5c53202cf90")
  7. add_patches("2.4.06", "patches/2.4.06/libminc.patch", "56205cec43d1e7d10664ff45df2fcdd50102f97b8c6ad60ca0d541957a05626f")
  8. if is_plat("windows") then
  9. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  10. end
  11. add_deps("cmake", "hdf5", "zlib")
  12. if is_plat("linux") then
  13. add_extsources("apt::libminc-dev")
  14. end
  15. on_install("windows", "linux", "macosx", "bsd", function (package)
  16. io.replace("CMakeLists.txt", "${HDF5_LIBRARY}", "hdf5::hdf5-" .. (package:dep("hdf5"):config("shared") and "shared" or "static"), {plain = true})
  17. local configs = {
  18. "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"),
  19. "-DLIBMINC_BUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"),
  20. "-DBUILD_TESTING=OFF",
  21. }
  22. import("package.tools.cmake").install(package, configs)
  23. end)
  24. on_test(function (package)
  25. assert(package:has_cfuncs("miopen_volume", {includes = "minc2.h"}))
  26. end)