xmake.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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.18.3", "07f9fec15138fe25ea92d869117811c7c4fba2e6c6231682d49b159bae2ebd53")
  8. add_versions("1.18.2", "698f21fe5489311dabe9e90463fb9d40796780abac8d207b857e86ade7345d86")
  9. add_versions("1.17.1", "bd492b6e203b10b30857778f4dd26f688426cd352937bd7779ee245139bafa2b")
  10. add_deps("cmake")
  11. if is_plat("macosx") then
  12. add_frameworks("CoreFoundation", "CoreServices")
  13. elseif is_plat("linux", "bsd") then
  14. add_syslinks("pthread", "dl")
  15. end
  16. if on_check then
  17. on_check(function (package)
  18. if package:version() and package:version():ge("1.18.2") then
  19. if package:is_plat("bsd") then
  20. -- libfswatch/src/libfswatch/c++/kqueue_monitor.cpp:134:29: error: unknown type name '__darwin_time_t'; did you mean '__sbintime_t'
  21. raise("package(libfswatch >=1.18.2) unsupported platform")
  22. end
  23. end
  24. end)
  25. end
  26. on_install("linux", "bsd", "macosx", function (package)
  27. io.replace("CMakeLists.txt", "add_subdirectory(test/src)", "", {plain = true})
  28. io.replace("CMakeLists.txt", "add_subdirectory(fswatch/src)", "", {plain = true})
  29. local configs = {"-DUSE_NLS=OFF"}
  30. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  31. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  32. import("package.tools.cmake").install(package, configs)
  33. end)
  34. on_test(function (package)
  35. assert(package:has_cfuncs("fsw_add_path", {includes = "libfswatch/c/libfswatch.h"}))
  36. end)