xmake.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package("cnpy")
  2. set_homepage("https://github.com/rogersce/cnpy")
  3. set_description("library to read/write .npy and .npz files in C/C++")
  4. set_license("MIT")
  5. add_urls("https://github.com/rogersce/cnpy.git")
  6. add_versions("2018.06.01", "4e8810b1a8637695171ed346ce68f6984e585ef4")
  7. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  8. add_deps("zlib")
  9. on_install(function (package)
  10. io.writefile("xmake.lua", [[
  11. add_rules("mode.debug", "mode.release")
  12. set_languages("c++11")
  13. add_requires("zlib")
  14. target("cnpy")
  15. set_kind("static")
  16. add_files("cnpy.cpp")
  17. add_headerfiles("cnpy.h")
  18. add_packages("zlib")
  19. ]])
  20. import("package.tools.xmake").install(package)
  21. end)
  22. on_test(function (package)
  23. assert(package:check_cxxsnippets({test = [[
  24. void test() {
  25. double myVar1 = 1.2;
  26. char myVar2 = 'a';
  27. cnpy::npz_save("out.npz","myVar1",&myVar1,{1},"w");
  28. cnpy::npz_save("out.npz","myVar2",&myVar2,{1},"a");
  29. }
  30. ]]}, {configs = {languages = "c++11"}, includes = "cnpy.h"}))
  31. end)