xmake.lua 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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.12.0", "e7311ffcc87d8fcc4b839807061cca1b89be017ae7c449a69436dc2dd07615c2")
  8. add_versions("v1.11.1", "4f0c8ac3f03eb970bee7a0cacc57a886ac511d58f081bb08ba4bce6f547d92fa")
  9. add_versions("v1.9.0", "4ddb365dfc21bbbb7ed54655c7630ae3e8e977af31f22b28195e720215b1072d")
  10. add_configs("postfix", {description = "set build type postfix for apps and libs", default = false, type = "boolean"})
  11. add_configs("json", {description = "enable JSON support (3rd-party lib.)", default = false, type = "boolean"})
  12. add_configs("asan", {description = "enable address sanitizer in the build", default = false, type = "boolean"})
  13. add_deps("cmake")
  14. on_install("windows|x86", "windows|x64", "linux", "macosx", "bsd", "mingw", "msys", "android", "iphoneos", function (package)
  15. local configs = {"-DVVENC_OVERRIDE_COMPILER_CHECK=ON"}
  16. if package:is_debug() then
  17. table.insert(configs, "-DCMAKE_BUILD_TYPE=Debug")
  18. table.insert(configs, "-DVVENC_ENABLE_TRACING=ON")
  19. else
  20. table.insert(configs, "-DCMAKE_BUILD_TYPE=Release")
  21. table.insert(configs, "-DVVENC_ENABLE_TRACING=OFF")
  22. end
  23. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  24. table.insert(configs, "-DVVENC_ENABLE_LINK_TIME_OPT=" .. (package:config("lto") and "ON" or "OFF"))
  25. table.insert(configs, "-DVVENC_ENABLE_BUILD_TYPE_POSTFIX=" .. (package:config("postfix") and "ON" or "OFF"))
  26. table.insert(configs, "-DVVENC_ENABLE_THIRDPARTY_JSON=" .. (package:config("json") and "ON" or "OFF"))
  27. table.insert(configs, "-DVVENC_USE_ADDRESS_SANITIZER=" .. (package:config("asan") and "ON" or "OFF"))
  28. io.replace("CMakeLists.txt", [[add_subdirectory( "test/vvenclibtest" )]], "", {plain = true})
  29. io.replace("CMakeLists.txt", [[add_subdirectory( "test/vvencinterfacetest" )]], "", {plain = true})
  30. local cxflags = table.wrap(package:config("cxflags"))
  31. if package:is_plat("windows") then
  32. table.insert(cxflags, "/wd4100");
  33. end
  34. package:config_set("cxflags", cxflags)
  35. import("package.tools.cmake").install(package, configs)
  36. end)
  37. on_test(function (package)
  38. assert(package:has_cfuncs("vvenc_init_default", {includes = "vvenc/vvenc.h"}))
  39. end)