xmake.lua 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package("libusb-win32")
  2. set_homepage("https://github.com/mcuee/libusb-win32")
  3. set_description("libusb-win32 is a port of the libusb-0.1 API for Windows with some additional asynchronous transfer support.")
  4. set_license("LGPL-2.0-or-later")
  5. add_urls("https://github.com/mcuee/libusb-win32/archive/refs/tags/release_$(version).0.tar.gz", {alias = "tarball"})
  6. add_urls("https://github.com/mcuee/libusb-win32.git", {alias = "git"})
  7. add_versions("tarball:1.4.0", "78a002442e98d2f01c469ac7d01283f9655e257e18c4ad7670d00494b48deb8d")
  8. add_versions("git:1.4.0", "release_1.4.0.0")
  9. on_install("windows", "mingw", "msys", "cygwin", function (package)
  10. os.cd("libusb")
  11. io.writefile("xmake.lua", [[
  12. add_rules("mode.debug", "mode.release")
  13. target("libusb0")
  14. set_kind("$(kind)")
  15. add_files(
  16. "src/descriptors.c",
  17. "src/error.c",
  18. "src/install.c",
  19. "src/registry.c",
  20. "src/usb.c",
  21. "src/windows.c"
  22. )
  23. add_headerfiles(
  24. "src/error.h",
  25. "src/lusb0_usb.h",
  26. "src/registry.h",
  27. "src/usbi.h"
  28. )
  29. -- add_files("src/resource.rc")
  30. add_syslinks("advapi32", "gdi32", "setupapi", "user32")
  31. add_files("libusb0.def")
  32. add_defines("LOG_APPNAME=\"libusb-dll\"")
  33. add_includedirs(
  34. "src",
  35. "src/driver"
  36. )
  37. ]])
  38. import("package.tools.xmake").install(package)
  39. end)
  40. on_test(function (package)
  41. assert(package:check_csnippets({test = [[
  42. void test() {
  43. usb_init();
  44. }
  45. ]]}, {configs = {languages = "c99"}, includes = "lusb0_usb.h"}))
  46. end)