xmake.lua 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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.13.0", "28994435e4f7792cc3a907b1c5f20afd0f7ef1fcd82eee2af7713df7a72422eb")
  8. add_versions("v1.12.1", "ba353363779e8f835200f319c801b052a97d592ebc817b52c41bdce093fa2fe2")
  9. add_versions("v1.12.0", "e7311ffcc87d8fcc4b839807061cca1b89be017ae7c449a69436dc2dd07615c2")
  10. add_versions("v1.11.1", "4f0c8ac3f03eb970bee7a0cacc57a886ac511d58f081bb08ba4bce6f547d92fa")
  11. add_versions("v1.9.0", "4ddb365dfc21bbbb7ed54655c7630ae3e8e977af31f22b28195e720215b1072d")
  12. add_configs("json", {description = "enable JSON support", default = false, type = "boolean"})
  13. add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
  14. if is_plat("wasm") then
  15. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  16. end
  17. add_deps("cmake")
  18. on_load(function (package)
  19. if package:config("json") then
  20. package:add("deps", "nlohmann_json")
  21. end
  22. if package:is_plat("windows") and package:config("shared") then
  23. package:add("defines", "VVENC_DYN_LINK")
  24. end
  25. end)
  26. on_install(function (package)
  27. io.replace("CMakeLists.txt", [[add_subdirectory( "test/vvenclibtest" )]], "", {plain = true})
  28. io.replace("CMakeLists.txt", [[add_subdirectory( "test/vvencinterfacetest" )]], "", {plain = true})
  29. io.replace("CMakeLists.txt", [[add_subdirectory( "test/vvenc_unit_test" )]], "", {plain = true})
  30. io.replace("CMakeLists.txt", [[include( cmake/modules/vvencTests.cmake )]], "", {plain = true})
  31. io.replace("CMakeLists.txt", "if( CCACHE_FOUND )", "if(0)", {plain = true})
  32. if package:config("json") then
  33. io.replace("source/Lib/vvenc/CMakeLists.txt",
  34. "../../../thirdparty/nlohmann_json/single_include",
  35. path.unix(package:dep("nlohmann_json"):installdir("include")), {plain = true})
  36. io.replace("source/Lib/apputils/LogoRenderer.h",
  37. "../../../thirdparty/nlohmann_json/single_include/nlohmann/json.hpp",
  38. "nlohmann/json.hpp", {plain = true})
  39. end
  40. local configs = {
  41. "-DVVENC_ENABLE_WERROR=OFF",
  42. "-DVVENC_OVERRIDE_COMPILER_CHECK=ON",
  43. "-DVVENC_ENABLE_BUILD_TYPE_POSTFIX=OFF",
  44. }
  45. if package:is_debug() then
  46. table.insert(configs, "-DCMAKE_BUILD_TYPE=Debug")
  47. table.insert(configs, "-DVVENC_ENABLE_TRACING=ON")
  48. else
  49. table.insert(configs, "-DCMAKE_BUILD_TYPE=Release")
  50. table.insert(configs, "-DVVENC_ENABLE_TRACING=OFF")
  51. end
  52. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  53. table.insert(configs, "-DVVENC_ENABLE_LINK_TIME_OPT=" .. (package:config("lto") and "ON" or "OFF"))
  54. table.insert(configs, "-DVVENC_USE_ADDRESS_SANITIZER=" .. (package:config("asan") and "ON" or "OFF"))
  55. table.insert(configs, "-DVVENC_LIBRARY_ONLY=" .. (package:config("tools") and "OFF" or "ON"))
  56. table.insert(configs, "-DVVENC_ENABLE_THIRDPARTY_JSON=" .. (package:config("json") and "ON" or "OFF"))
  57. if (package:is_plat("android") and package:is_arch("armeabi-v7a")) or package:is_plat("wasm") then
  58. table.insert(configs, "-DVVENC_ENABLE_X86_SIMD=OFF")
  59. end
  60. import("package.tools.cmake").install(package, configs)
  61. end)
  62. on_test(function (package)
  63. assert(package:has_cfuncs("vvenc_init_default", {includes = "vvenc/vvenc.h"}))
  64. end)