xmake.lua 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package("libvpx")
  2. set_homepage("https://chromium.googlesource.com/webm/libvpx/")
  3. set_description("libvpx is a free software video codec library from Google and the Alliance for Open Media (AOMedia)")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://github.com/webmproject/libvpx/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/webmproject/libvpx.git",
  7. "https://chromium.googlesource.com/webm/libvpx.git")
  8. add_versions("v1.15.0", "e935eded7d81631a538bfae703fd1e293aad1c7fd3407ba00440c95105d2011e")
  9. add_versions("v1.14.1", "901747254d80a7937c933d03bd7c5d41e8e6c883e0665fadcb172542167c7977")
  10. if not is_plat("windows") then
  11. add_deps("autoconf", "automake", "libtool", "m4", "yasm")
  12. end
  13. add_configs("vp8", {description = "enable the vp8 codec", default = false, type = "boolean"})
  14. add_configs("vp9", {description = "enable the vp9 codec", default = false, type = "boolean"})
  15. add_configs("vp9_post", {description = "vp9 specific postprocessing", default = false, type = "boolean"})
  16. add_configs("vp9_highbitdepth", {description = "use VP9 high bit depth (10/12) profiles", default = false, type = "boolean"})
  17. add_configs("postproc", {description = "postprocessing", default = false, type = "boolean"})
  18. add_configs("codec_srcs", {description = "in/exclude codec library source code", default = false, type = "boolean"})
  19. add_configs("webm_io", {description = "enable input from and output to WebM container", default = false, type = "boolean"})
  20. add_configs("libyuv", {description = "enable libyuv", default = false, type = "boolean"})
  21. on_load(function (package)
  22. if package:config("libyuv") then
  23. package:add("deps", "libyuv")
  24. end
  25. end)
  26. if on_check then
  27. on_check(function (package)
  28. if package:has_tool("cxx", "clang") and package:is_arch("x64", "x86_64") then
  29. raise("package(libvpx) unsupported clang toolchain")
  30. end
  31. end)
  32. end
  33. on_install("linux", "macosx", function (package)
  34. local configs = {"--disable-dependency-tracking", "--disable-examples", "--disable-docs", "--as=yasm", "--disable-unit-tests"}
  35. table.insert(configs, (package:config("shared") and "--enable-shared --disable-static" or "--disable-shared --enable-static"))
  36. table.insert(configs, (package:is_debug() and "--enable-debug" or ""))
  37. table.insert(configs, (package:config("vp8") and "--enable-vp8" or "--disable-vp8"))
  38. table.insert(configs, (package:config("vp9") and "--enable-vp9" or "--disable-vp9"))
  39. table.insert(configs, (package:config("vp9_post") and "--enable-vp9-postproc" or "--disable-vp9-postproc"))
  40. table.insert(configs, (package:config("vp9_highbitdepth") and "--enable-vp9-highbitdepth" or "--disable-vp9-highbitdepth"))
  41. table.insert(configs, (package:config("postproc") and "--enable-postproc" or "--disable-postproc"))
  42. table.insert(configs, (package:config("codec_srcs") and "--enable-codec-srcs" or ""))
  43. table.insert(configs, (package:config("webm_io") and "--enable-webm-io" or "--disable-webm-io"))
  44. table.insert(configs, (package:config("libyuv") and "--enable-libyuv" or "--disable-libyuv"))
  45. import("package.tools.autoconf").install(package, configs)
  46. end)
  47. on_test(function (package)
  48. assert(package:has_cfuncs("vpx_codec_build_config", {includes = "vpx/vpx_codec.h"}))
  49. if package:config("vp8") then
  50. assert(package:has_cfuncs("vpx_codec_encode", {includes = "vpx/vpx_encoder.h"}))
  51. end
  52. end)