xmake.lua 1.4 KB

1234567891011121314151617181920212223242526272829
  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. set_license("GPL-3.0")
  5. add_urls("https://github.com/emcrisostomo/fswatch/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/emcrisostomo/fswatch.git")
  7. add_versions("1.17.1", "bd492b6e203b10b30857778f4dd26f688426cd352937bd7779ee245139bafa2b")
  8. add_deps("cmake")
  9. if is_plat("macosx") then
  10. add_frameworks("CoreFoundation", "CoreServices")
  11. elseif is_plat("linux", "bsd") then
  12. add_syslinks("pthread", "dl")
  13. end
  14. on_install("linux", "bsd", "macosx", function (package)
  15. local configs = {"-DUSE_NLS=OFF"}
  16. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  17. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  18. io.replace("CMakeLists.txt", "add_subdirectory(test/src)", "", {plain = true})
  19. io.replace("CMakeLists.txt", "add_subdirectory(fswatch/src)", "", {plain = true})
  20. import("package.tools.cmake").install(package, configs)
  21. end)
  22. on_test(function (package)
  23. assert(package:has_cfuncs("fsw_add_path", {includes = "libfswatch/c/libfswatch.h"}))
  24. end)