xmake.lua 1.2 KB

123456789101112131415161718192021222324252627282930
  1. package("littlefs")
  2. set_homepage("https://github.com/littlefs-project/littlefs")
  3. set_description("A little fail-safe filesystem designed for microcontrollers")
  4. add_urls("https://github.com/littlefs-project/littlefs/archive/refs/tags/$(version).tar.gz",
  5. "https://github.com/littlefs-project/littlefs.git")
  6. add_versions("v2.8.2", "9f46d00d6d6ad0a0d72840455ba748efcad84b8a236bd8b9d3a08e3af7953386")
  7. add_versions("v2.5.0", "07de0d788c2a849a137715b48cce9daeb3fdc7570873ac6faae4566432e140c8")
  8. on_install(function (package)
  9. local configs = {}
  10. io.writefile("xmake.lua", [[
  11. add_rules("mode.release", "mode.debug")
  12. target("littlefs")
  13. set_kind("$(kind)")
  14. add_files("*.c")
  15. add_headerfiles("*.h")
  16. if is_plat("windows") then
  17. add_defines("LFS_NO_ERROR", "LFS_NO_DEBUG", "LFS_NO_WARN")
  18. end
  19. ]])
  20. if package:config("shared") then
  21. configs.kind = "shared"
  22. end
  23. import("package.tools.xmake").install(package, configs)
  24. end)
  25. on_test(function (package)
  26. assert(package:has_cfuncs("lfs_mount", {includes = "lfs.h"}))
  27. end)