xmake.lua 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package("bestsource")
  2. set_homepage("https://github.com/vapoursynth/bestsource")
  3. set_description("A super great audio/video source and FFmpeg wrapper")
  4. set_license("MIT")
  5. add_urls("https://github.com/vapoursynth/bestsource/archive/refs/tags/R$(version).tar.gz")
  6. add_urls("https://github.com/vapoursynth/bestsource.git", {alias = "git", submodules = false})
  7. add_versions("16", "36b035939b6897c68303fc356a7a7d9d37685ce9a102c7a4af955531c1b23be8")
  8. add_versions("git:16", "R16")
  9. add_configs("plugin", {description = "Enable AviSynth and VapourSynth plugin", default = false, type = "boolean"})
  10. if is_plat("windows", "mingw") then
  11. add_syslinks("shell32")
  12. end
  13. add_deps("xxhash", "libp2p", "ffmpeg")
  14. on_check("windows|arm64", function (package)
  15. if not package:is_cross() then
  16. raise("package(bestsource) dep(ffmpeg) unsupported windows arm64 native build, because it require arm64 msys2")
  17. end
  18. end)
  19. on_load(function (package)
  20. if package:config("plugin") then
  21. package:add("deps", "avisynthplus", "vapoursynth")
  22. end
  23. end)
  24. on_install("windows", "mingw@windows,linux,cygwin,msys", "linux", "macosx", "android", "iphoneos", function (package)
  25. io.replace("src/audiosource.cpp", "../libp2p/p2p_api.h", "libp2p/p2p_api.h", {plain = true})
  26. io.replace("src/videosource.cpp", "../libp2p/p2p_api.h", "libp2p/p2p_api.h", {plain = true})
  27. io.replace("src/avisynth.cpp", "../AviSynthPlus/avs_core/include/avisynth.h", "avisynth/avisynth.h", {plain = true})
  28. if package:config("plugin") then
  29. io.replace("src/synthshared.cpp", '#include "VSHelper4.h"', " #include <vapoursynth/VSHelper4.h>", {plain = true})
  30. io.replace("src/avisynth.cpp", "VSHelper4.h", "vapoursynth/VSHelper4.h", {plain = true})
  31. io.replace("src/vapoursynth.cpp", "VSHelper4.h", "vapoursynth/VSHelper4.h", {plain = true})
  32. io.replace("src/vapoursynth.cpp", "VapourSynth4.h", "vapoursynth/VapourSynth4.h", {plain = true})
  33. end
  34. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  35. import("package.tools.xmake").install(package, {plugin = package:config("plugin")})
  36. end)
  37. on_test(function (package)
  38. assert(package:check_cxxsnippets({test = [[
  39. void test(BestVideoSource* bs) {
  40. bs->GetTrack();
  41. }
  42. ]]}, {configs = {languages = "c++17"}, includes = "videosource.h"}))
  43. end)