xmake.lua 2.0 KB

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