xmake.lua 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package("clip")
  2. set_homepage("https://github.com/dacap/clip")
  3. set_description("Library to copy/retrieve content to/from the clipboard/pasteboard.")
  4. set_license("MIT")
  5. set_urls("https://github.com/dacap/clip/archive/refs/tags/v$(version).zip")
  6. add_versions("1.9", "905615eb1ceef15e96468891ad85b7aa6836bcda690006d61fa061ca029b2060")
  7. add_versions("1.8", "9df8728c9ce7c3afcfc9a0c6718e064319f0cdffb927243ac1ca3be591578d00")
  8. add_versions("1.5", "4ed7f54184c27c79a8f2382ba747dce11aeb4552017abf5588587369a6caeb6b")
  9. add_deps("cmake", "libpng")
  10. if is_plat("linux") then
  11. add_deps("libxcb")
  12. elseif is_plat("windows") or is_plat("mingw") then
  13. add_syslinks("Shlwapi", "Ole32", "User32")
  14. end
  15. if is_plat("mingw") then
  16. add_syslinks("Windowscodecs")
  17. end
  18. add_includedirs("include")
  19. on_install("linux", "windows", "mingw@windows,msys", "macos", function(package)
  20. local configs = {}
  21. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  22. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  23. table.insert(configs, "-DCLIP_EXAMPLES=OFF")
  24. table.insert(configs, "-DCLIP_TESTS=OFF")
  25. if package:config("shared") and package:is_plat("windows") then
  26. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  27. end
  28. import("package.tools.cmake").install(package, configs, { buildir="build" })
  29. os.cp("clip.h", package:installdir("include/clip"))
  30. os.trycp("build/*.a", package:installdir("lib"))
  31. os.trycp("build/*.dylib", package:installdir("lib"))
  32. os.trycp("build/*.so", package:installdir("lib"))
  33. os.trycp("build/*.lib", package:installdir("lib"))
  34. os.trycp("build/*.dll", package:installdir("bin"))
  35. end)
  36. on_test(function(package)
  37. assert(package:check_cxxsnippets({ test = [[
  38. #include <clip/clip.h>
  39. #include <string>
  40. void test() { clip::set_text("foo"); }
  41. ]]}
  42. ))
  43. end)