xmake.lua 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package("libde265")
  2. set_homepage("https://www.libde265.org/")
  3. set_description("Open h.265 video codec implementation.")
  4. set_license("LGPL-3.0")
  5. add_urls("https://github.com/strukturag/libde265/releases/download/v$(version)/libde265-$(version).tar.gz",
  6. "https://github.com/strukturag/libde265.git")
  7. add_versions("1.0.15", "00251986c29d34d3af7117ed05874950c875dd9292d016be29d3b3762666511d")
  8. add_versions("1.0.8", "24c791dd334fa521762320ff54f0febfd3c09fc978880a8c5fbc40a88f21d905")
  9. add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
  10. if is_plat("linux", "bsd") then
  11. add_syslinks("pthread")
  12. end
  13. add_deps("cmake")
  14. on_load("windows", function (package)
  15. if not package:config("shared") then
  16. package:add("defines", "LIBDE265_STATIC_BUILD")
  17. end
  18. end)
  19. on_install(function (package)
  20. local configs = {"-DENABLE_SDL=OFF"}
  21. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  22. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  23. table.insert(configs, "-DDISABLE_SSE=" .. (package:is_arch("x86", "x64", "x86_64") and "OFF" or "ON"))
  24. table.insert(configs, "-DENABLE_ENCODER=" .. (package:config("tools") and "ON" or "OFF"))
  25. table.insert(configs, "-DENABLE_DECODER=" .. (package:config("tools") and "ON" or "OFF"))
  26. if package:is_plat("windows") then
  27. table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=''")
  28. end
  29. import("package.tools.cmake").install(package, configs)
  30. if package:is_plat("windows") and package:is_debug() then
  31. local dir = package:installdir(package:config("shared") and "bin" or "lib")
  32. os.vcp(path.join(package:buildir(), "libde265/**.pdb"), dir)
  33. if package:config("tools") then
  34. os.vcp(path.join(package:buildir(), "enc265/*.pdb"), package:installdir("bin"))
  35. os.vcp(path.join(package:buildir(), "dec265/*.pdb"), package:installdir("bin"))
  36. end
  37. end
  38. end)
  39. on_test(function (package)
  40. assert(package:has_cfuncs("de265_new_decoder", {includes = "libde265/de265.h"}))
  41. end)