xmake.lua 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package("ffms2")
  2. set_homepage("https://github.com/FFMS/ffms2")
  3. set_description("An FFmpeg based source library and Avisynth/VapourSynth plugin for easy frame accurate access")
  4. set_license("MIT")
  5. add_urls("https://github.com/FFMS/ffms2/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/FFMS/ffms2.git")
  7. add_versions("5.0", "7770af0bbc0063f9580a6a5c8e7c51f1788f171d7da0b352e48a1e60943a8c3c")
  8. add_configs("avisynth", {description = "Enable avisynth support", default = false, type = "boolean"})
  9. add_configs("vapoursynth", {description = "Enable vapoursynth support", default = false, type = "boolean"})
  10. add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
  11. add_deps("zlib", "ffmpeg")
  12. on_check("windows|arm64", function (package)
  13. if not package:is_cross() then
  14. raise("package(ffms2) dep(ffmpeg) unsupported windows arm64 native build, because it require arm64 msys2")
  15. end
  16. end)
  17. on_load(function (package)
  18. if package:config("avisynth") then
  19. package:add("deps", "avisynthplus")
  20. end
  21. if package:config("vapoursynth") then
  22. package:add("deps", "vapoursynth")
  23. end
  24. if not package:config("shared") then
  25. package:add("defines", "FFMS_STATIC")
  26. end
  27. end)
  28. on_install("windows", "mingw@windows,linux,cygwin,msys", "linux", "macosx", "android", "iphoneos", function (package)
  29. io.replace("src/avisynth/avssources.h", "avisynth.h", "avisynth/avisynth.h", {plain = true})
  30. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  31. import("package.tools.xmake").install(package, {
  32. avisynth = package:config("avisynth"),
  33. vapoursynth = package:config("vapoursynth"),
  34. tools = package:config("tools"),
  35. })
  36. end)
  37. on_test(function (package)
  38. assert(package:has_cfuncs("FFMS_Init", {includes = "ffms.h"}))
  39. end)