xmake.lua 4.2 KB

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