xmake.lua 2.0 KB

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