xmake.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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.5", "4ed7f54184c27c79a8f2382ba747dce11aeb4552017abf5588587369a6caeb6b")
  7. add_deps("cmake", "libpng")
  8. if is_plat("linux") then
  9. add_deps("libxcb")
  10. elseif is_plat("windows") or is_plat("mingw") then
  11. add_syslinks("Shlwapi", "Ole32", "User32")
  12. end
  13. if is_plat("mingw") then
  14. add_syslinks("Windowscodecs")
  15. end
  16. add_includedirs("include")
  17. on_install("linux", "windows", "mingw@windows,msys", "macos", function(package)
  18. local configs = {}
  19. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  20. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  21. table.insert(configs, "-DCLIP_EXAMPLES=OFF")
  22. table.insert(configs, "-DCLIP_TESTS=OFF")
  23. if package:config("shared") and package:is_plat("windows") then
  24. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  25. end
  26. import("package.tools.cmake").install(package, configs, { buildir="build" })
  27. os.cp("clip.h", package:installdir("include/clip"))
  28. os.trycp("build/*.a", package:installdir("lib"))
  29. os.trycp("build/*.dylib", package:installdir("lib"))
  30. os.trycp("build/*.so", package:installdir("lib"))
  31. os.trycp("build/*.lib", package:installdir("lib"))
  32. os.trycp("build/*.dll", package:installdir("bin"))
  33. end)
  34. on_test(function(package)
  35. assert(package:check_cxxsnippets({ test = [[
  36. #include <clip/clip.h>
  37. #include <string>
  38. void test() { clip::set_text("foo"); }
  39. ]]}
  40. ))
  41. end)