xmake.lua 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package("vvenc")
  2. set_homepage("https://www.hhi.fraunhofer.de/en/departments/vca/technologies-and-solutions/h266-vvc.html")
  3. set_description("Fraunhofer Versatile Video Encoder (VVenC)")
  4. set_license("BSD-3-Clause-Clear")
  5. add_urls("https://github.com/fraunhoferhhi/vvenc/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/fraunhoferhhi/vvenc.git")
  7. add_versions("v1.11.1", "4f0c8ac3f03eb970bee7a0cacc57a886ac511d58f081bb08ba4bce6f547d92fa")
  8. add_versions("v1.9.0", "4ddb365dfc21bbbb7ed54655c7630ae3e8e977af31f22b28195e720215b1072d")
  9. add_configs("postfix", {description = "set build type postfix for apps and libs", default = false, type = "boolean"})
  10. add_configs("json", {description = "enable JSON support (3rd-party lib.)", default = false, type = "boolean"})
  11. add_configs("asan", {description = "enable address sanitizer in the build", default = false, type = "boolean"})
  12. add_deps("cmake")
  13. on_install("windows|x86", "windows|x64", "linux", "macosx", "bsd", "mingw", "msys", "android", "iphoneos", function (package)
  14. local configs = {"-DVVENC_OVERRIDE_COMPILER_CHECK=ON"}
  15. if package:is_debug() then
  16. table.insert(configs, "-DCMAKE_BUILD_TYPE=Debug")
  17. table.insert(configs, "-DVVENC_ENABLE_TRACING=ON")
  18. else
  19. table.insert(configs, "-DCMAKE_BUILD_TYPE=Release")
  20. table.insert(configs, "-DVVENC_ENABLE_TRACING=OFF")
  21. end
  22. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  23. table.insert(configs, "-DVVENC_ENABLE_LINK_TIME_OPT=" .. (package:config("lto") and "ON" or "OFF"))
  24. table.insert(configs, "-DVVENC_ENABLE_BUILD_TYPE_POSTFIX=" .. (package:config("postfix") and "ON" or "OFF"))
  25. table.insert(configs, "-DVVENC_ENABLE_THIRDPARTY_JSON=" .. (package:config("json") and "ON" or "OFF"))
  26. table.insert(configs, "-DVVENC_USE_ADDRESS_SANITIZER=" .. (package:config("asan") and "ON" or "OFF"))
  27. io.replace("CMakeLists.txt", [[add_subdirectory( "test/vvenclibtest" )]], "", {plain = true})
  28. io.replace("CMakeLists.txt", [[add_subdirectory( "test/vvencinterfacetest" )]], "", {plain = true})
  29. local cxflags = table.wrap(package:config("cxflags"))
  30. if package:is_plat("windows") then
  31. table.insert(cxflags, "/wd4100");
  32. end
  33. package:config_set("cxflags", cxflags)
  34. import("package.tools.cmake").install(package, configs)
  35. end)
  36. on_test(function (package)
  37. assert(package:has_cfuncs("vvenc_init_default", {includes = "vvenc/vvenc.h"}))
  38. end)