feat: add svt-av1 (#2258)
* feat: add libvpx * fix(libvpx): fix some error * fix(libvpx): fix an error * fix(libvpx): disable on windows and mobile platform * feat(libvpx): run configure manually * feat(libvpx): add configs * feat: add svt-av1 * fix: fix some build errors * fix: fix typos * fix: fix typos * chore(svt-av1): remove unused deps * fix: use nasm in windows * fix(svt-av1): fix wasm build error * fix(svt-av1): fix wasm build error * fix(svt-av1): fix a typo * fix(libvpx): fix fedora build error * fix(svt-av1): fix fedora build error * fix(libvpx): fix fedora build error * feat: add package which * fix(svt-av1): fix wasm build error in some emscripten version * fix(libvpx): fix cross build error * fix(libvpx): fix build error * fix(libvpx): fix some errors * chore(libvpx): tweaks * fix(libvpx): support os name `ios` * fix(libvpx): improve cc detect * chore(libvpx): add debug msg * chore(libvpx): fix typos * chore(libvpx): add debug msg * chore(libvpx): use nasm for mingw * fix(libvpx): fix a typo * chore: tweaks * fix: fix bsd build error * fix: fix bsd build error * feat:libvpx output config.log when configure failed * fix(libvpx): fix typos * chore: temporarily remove libvpx * fix(svt-av1): fix build error on mingw * fix(svt-av1): fix build error on arm * chore(svt-av1): tweaks * fix(svt-av1): fix android build error * chore(svt-av1): tweaks * fix(svt-av1): fix android build error * fix(svt-av1): fix android build error * feat(svt-av1): test with has_cfuncs * Update xmake.lua * Update xmake.lua * fix(svt-av1): add pthread syslink for bsd * fix(svt-av1): disable `pthread_setaffinity_np` for android * fix(svt-av1): fix a typo * fix(svt-av1): disable `pthread_setschedparam` for wasm * feat(svt-av1): add some options * Update xmake.lua --------- Co-authored-by: ruki <waruqi@gmail.com>pull/2306/head
parent
8606500533
commit
e3fd0521db
2 changed files with 100 additions and 0 deletions
@ -0,0 +1,78 @@ |
||||
package("svt-av1") |
||||
set_homepage("https://gitlab.com/AOMediaCodec/SVT-AV1") |
||||
set_description("Scalable Video Technology for AV1 (SVT-AV1 Encoder and Decoder)") |
||||
|
||||
add_urls("https://gitlab.com/AOMediaCodec/SVT-AV1.git", |
||||
"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v$(version)/SVT-AV1-v$(version).tar.gz") |
||||
add_versions("1.4.0", "0a4650b822c4eeb9656fbe96bd795e7a73cbfd1ab8c12546348ba88d8ed6b415") |
||||
add_versions("1.4.1", "e3f7fc194afc6c90b43e0b80fa24c09940cb03bea394e0e1f5d1ded18e9ab23f") |
||||
add_versions("1.5.0", "64e27b024eb43e4ba4e7b85584e0497df534043b2ce494659532c585819d0333") |
||||
add_versions("1.6.0", "3bc207247568ac713245063555082bfc905edc31df3bf6355e3b194cb73ad817") |
||||
|
||||
add_configs("encoder", {description = "Build Encoder lib", default = true, type = "boolean"}) |
||||
add_configs("decoder", {description = "Build Decoder lib", default = true, type = "boolean"}) |
||||
add_configs("avx512", {description = "Enable building avx512 code", default = false, type = "boolean"}) |
||||
|
||||
if not is_plat("windows") then |
||||
add_configs("pgo", {description = "Enable profile guided optimization. Creates the RunPGO and CompilePGO targets", default = false, type = "boolean"}) |
||||
add_configs("native", {description = "Build for native performance (march=native)", default = false, type = "boolean"}) |
||||
end |
||||
|
||||
if is_plat("wasm") then |
||||
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) |
||||
end |
||||
|
||||
if is_plat("bsd", "linux", "wasm") then |
||||
add_syslinks("pthread") |
||||
end |
||||
|
||||
add_deps("cmake") |
||||
|
||||
on_load(function (package) |
||||
if package:is_targetarch("x64", "x86", "x86_64") then |
||||
if is_host("windows") or package:is_plat("bsd") then |
||||
package:add("deps", "nasm") |
||||
else |
||||
package:add("deps", "yasm") |
||||
end |
||||
end |
||||
if not package:has_cfuncs("_mm512_extracti64x4_epi64", {includes = "immintrin.h"}) then |
||||
package:config_set("enable-avx512", false) |
||||
end |
||||
end) |
||||
|
||||
on_install(function (package) |
||||
local configs = {"-DBUILD_TESTING=OFF", "-DCOVERAGE=OFF", "-DBUILD_APPS=OFF"} |
||||
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) |
||||
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) |
||||
table.insert(configs, "-DBUILD_ENC=" .. (package:config("encoder") and "ON" or "OFF")) |
||||
table.insert(configs, "-DBUILD_DEC=" .. (package:config("decoder") and "ON" or "OFF")) |
||||
table.insert(configs, "-DENABLE_AVX512=" .. (package:config("avx512") and "ON" or "OFF")) |
||||
table.insert(configs, "-DSVT_AV1_LTO=" .. (package:config("lto") and "ON" or "OFF")) |
||||
table.insert(configs, "-DSVT_AV1_PGO=" .. (package:config("pgo") and "ON" or "OFF")) |
||||
table.insert(configs, "-DNATIVE=" .. (package:config("native") and "ON" or "OFF")) |
||||
if package:is_plat("wasm") then |
||||
io.replace("CMakeLists.txt", "if(MINGW)", "if(TRUE)\n check_both_flags_add(-pthread)\n elseif(MINGW)", {plain = true}) |
||||
io.replace("CMakeLists.txt", "set(CMAKE_EXE_LINKER_FLAGS \"${CMAKE_EXE_LINKER_FLAGS} -z noexecstack -z relro -z now\")", "", {plain = true}) |
||||
io.replace("Source/Lib/Decoder/CMakeLists.txt", "list(APPEND PLATFORM_LIBS Threads::Threads)", "", {plain = true}) |
||||
io.replace("Source/Lib/Encoder/CMakeLists.txt", "list(APPEND PLATFORM_LIBS Threads::Threads)", "", {plain = true}) |
||||
io.replace("Source/Lib/Decoder/Codec/EbDecHandle.c", "!geteuid()", "0", {plain = true}) |
||||
io.replace("Source/Lib/Common/Codec/EbThreads.c", "!geteuid()", "0", {plain = true}) |
||||
io.replace("Source/Lib/Encoder/Globals/EbEncHandle.c", "!geteuid()", "0", {plain = true}) |
||||
elseif package:is_plat("mingw") and package:is_arch("x64", "x86_64") then |
||||
table.insert(configs, "-DCMAKE_SYSTEM_PROCESSOR=AMD64") |
||||
elseif package:is_plat("android") then |
||||
io.replace("CMakeLists.txt", "CMAKE_C_COMPILER_ID MATCHES \"Clang\" AND UNIX AND NOT APPLE", "FALSE", {plain = true}) |
||||
io.replace("Source/Lib/Decoder/CMakeLists.txt", "list(APPEND PLATFORM_LIBS Threads::Threads)", "", {plain = true}) |
||||
io.replace("Source/Lib/Decoder/CMakeLists.txt", "set(LIBS_PRIVATE \"-lpthread -lm\")", "set(LIBS_PRIVATE \"-lm\")", {plain = true}) |
||||
io.replace("Source/Lib/Encoder/CMakeLists.txt", "list(APPEND PLATFORM_LIBS Threads::Threads)", "", {plain = true}) |
||||
io.replace("Source/Lib/Encoder/CMakeLists.txt", "set(LIBS_PRIVATE \"-lpthread -lm\")", "set(LIBS_PRIVATE \"-lm\")", {plain = true}) |
||||
io.replace("Source/Lib/Common/Codec/EbThreads.h", "#if defined(__linux__)", "#if 0", {plain = true}) |
||||
end |
||||
import("package.tools.cmake").install(package, configs) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:has_cfuncs("svt_av1_enc_init_handle", {includes = "svt-av1/EbSvtAv1Enc.h"})) |
||||
end) |
||||
|
@ -0,0 +1,22 @@ |
||||
package("which") |
||||
|
||||
set_kind("binary") |
||||
set_homepage("https://www.gnu.org/software/which/") |
||||
set_description("shows the full path of (shell) commands") |
||||
|
||||
add_urls("https://ftp.gnu.org/gnu/which/which-$(version).tar.gz", |
||||
"https://carlowood.github.io/which/which-$(version).tar.gz", |
||||
"https://mirrors.ustc.edu.cn/gnu/which/which-$(version).tar.gz") |
||||
add_versions("2.16", "0ac8502e9985a3ac6b0e2aa4f2a60f91cad0dc0cca6dc9c1c142ebba4b8dd664") |
||||
add_versions("2.17", "176fe9c451487eda787dd58d9469d48c95509f49dbb34a574004a936905dd6da") |
||||
add_versions("2.19", "7d79b874f65118ac846a0deb31a8fbd6816cd81e74930299c82103765d45cd52") |
||||
add_versions("2.20", "d417b65c650d88ad26a208293c1c6e3eb60d4b6d847f01ff8f66aca63e2857f8") |
||||
add_versions("2.21", "f4a245b94124b377d8b49646bf421f9155d36aa7614b6ebf83705d3ffc76eaad") |
||||
|
||||
on_install("@bsd", "@linux", "@macosx", function (package) |
||||
import("package.tools.autoconf").install(package) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
os.vrun("which -v") |
||||
end) |
Loading…
Reference in new issue