xmake.lua 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package("highfive")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/BlueBrain/HighFive")
  4. set_description("HighFive - Header-only C++ HDF5 interface")
  5. set_license("BSL-1.0")
  6. add_urls("https://github.com/BlueBrain/HighFive/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/BlueBrain/HighFive.git")
  8. add_versions("v2.10.1", "60d66ba1315730494470afaf402bb40300a39eb6ef3b9d67263335a236069cce")
  9. add_versions("v2.10.0", "c29e8e1520e7298fabb26545f804e35bb3af257005c1c2df62e39986458d7c38")
  10. add_versions("v2.9.0", "6301def8ceb9f4d7a595988612db288b448a3c0546f6c83417dab38c64994d7e")
  11. add_versions("v2.6.1", "b5002c1221cf1821e02fb2ab891b0160bac88b43f56655bd844a472106ca3397")
  12. add_versions("v2.3.1", "41728a1204bdfcdcef8cbc3ddffe5d744c5331434ce3dcef35614b831234fcd7")
  13. add_patches("v2.6.1", path.join(os.scriptdir(), "patches", "fix-find-hdf5.patch"), "6a37e12f1796394d7691b36561829bf220336ec42a736c103509ac93537a36c9")
  14. add_patches("v2.3.1", path.join(os.scriptdir(), "patches", "fix-find-hdf5.patch"), "6a37e12f1796394d7691b36561829bf220336ec42a736c103509ac93537a36c9")
  15. add_deps("cmake")
  16. add_deps("hdf5")
  17. on_install("windows", "macosx", "linux", function (package)
  18. if package:version():eq("2.9.0") then
  19. io.replace("CMake/HighFiveTargetDeps.cmake", "find_package(HDF5 REQUIRED)", "find_package(HDF5 REQUIRED HINTS ${HDF5_ROOT})", {plain = true})
  20. end
  21. local configs = {"-DHIGHFIVE_UNIT_TESTS=OFF",
  22. "-DHIGHFIVE_EXAMPLES=OFF",
  23. "-DHIGHFIVE_BUILD_DOCS=OFF",
  24. "-DHIGHFIVE_USE_BOOST=OFF"}
  25. local hdf5 = package:dep("hdf5")
  26. if hdf5 and not hdf5:is_system() then
  27. table.insert(configs, "-DHDF5_ROOT=" .. hdf5:installdir())
  28. end
  29. import("package.tools.cmake").install(package, configs)
  30. end)
  31. on_test(function (package)
  32. assert(package:check_cxxsnippets({test = [[
  33. #include <highfive/H5File.hpp>
  34. using namespace HighFive;
  35. void test() {
  36. File file("/tmp/new_file.h5", File::ReadWrite | File::Create | File::Truncate);
  37. std::vector<int> data(50, 1);
  38. DataSet dataset = file.createDataSet<int>("/dataset_one", DataSpace::From(data));
  39. dataset.write(data);
  40. }
  41. ]]}, {configs = {languages = "c++17"}}))
  42. end)