2
0

xmake.lua 2.4 KB

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