xmake.lua 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package("libuvc")
  2. set_homepage("https://github.com/libuvc/libuvc")
  3. set_description("A cross-platform video device oynchronous I/O.")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://github.com/libuvc/libuvc.git")
  6. add_versions("2024.03.05", "047920bcdfb1dac42424c90de5cc77dfc9fba04d")
  7. add_configs("jpeg", {description = "Enable jpeg support.", default = true, type = "boolean"})
  8. add_deps("cmake")
  9. add_deps("libusb")
  10. if is_plat("windows") then
  11. add_patches("2024.03.05", "patches/2024.03.05/windows.patch", "87eae0b3bbc07038654a5ef7f5f7d0213472436e517f9b65963353738bb0a3dc")
  12. add_deps("pkgconf", "pthreads4w")
  13. end
  14. on_load(function (package)
  15. if package:config("jpeg") then
  16. package:add("deps", "libjpeg")
  17. end
  18. end)
  19. on_install("windows|x64", "windows|x86", function (package)
  20. local configs = {}
  21. table.insert(configs, "-DBUILD_EXAMPLE=OFF")
  22. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  23. table.insert(configs, "-DCMAKE_BUILD_TARGET=" .. (package:config("shared") and "Shared" or "Static"))
  24. import("package.tools.cmake").install(package, configs)
  25. end)
  26. on_test(function (package)
  27. assert(package:has_cfuncs("uvc_init", {includes = "libuvc/libuvc.h"}))
  28. end)