xmake.lua 1.4 KB

12345678910111213141516171819202122232425262728
  1. package("libfswatch")
  2. set_homepage("https://emcrisostomo.github.io/fswatch/")
  3. set_description("A cross-platform file change monitor with multiple backends: Apple OS X File System Events, *BSD kqueue, Solaris/Illumos File Events Notification, Linux inotify, Microsoft Windows and a stat()-based backend.")
  4. add_urls("https://github.com/emcrisostomo/fswatch/archive/refs/tags/$(version).tar.gz",
  5. "https://github.com/emcrisostomo/fswatch.git")
  6. add_versions("1.17.1", "bd492b6e203b10b30857778f4dd26f688426cd352937bd7779ee245139bafa2b")
  7. add_deps("cmake")
  8. if is_plat("macosx") then
  9. add_frameworks("CoreFoundation", "CoreServices")
  10. elseif is_plat("linux", "bsd") then
  11. add_syslinks("pthread", "dl")
  12. end
  13. on_install("linux", "bsd", "macosx", function (package)
  14. local configs = {"-DUSE_NLS=OFF"}
  15. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  16. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  17. io.replace("CMakeLists.txt", "add_subdirectory(test/src)", "", {plain = true})
  18. io.replace("CMakeLists.txt", "add_subdirectory(fswatch/src)", "", {plain = true})
  19. import("package.tools.cmake").install(package, configs)
  20. end)
  21. on_test(function (package)
  22. assert(package:has_cfuncs("fsw_add_path", {includes = "libfswatch/c/libfswatch.h"}))
  23. end)