Use self compilied openh264 instead of xmake-repo

This commit is contained in:
dijunkun
2024-05-28 15:23:07 +08:00
parent 28f9d9cfd6
commit 5d6861233e
3 changed files with 65 additions and 4 deletions

61
thirdparty/openh264/xmake.lua vendored Normal file
View File

@@ -0,0 +1,61 @@
package("openh264")
set_homepage("http://www.openh264.org/")
set_description("OpenH264 is a codec library which supports H.264 encoding and decoding.")
set_license("BSD-2-Clause")
set_urls("https://github.com/cisco/openh264/archive/refs/tags/$(version).tar.gz",
"https://github.com/cisco/openh264.git")
add_versions("v2.4.1", "8ffbe944e74043d0d3fb53d4a2a14c94de71f58dbea6a06d0dc92369542958ea")
add_versions("v2.1.1", "af173e90fce65f80722fa894e1af0d6b07572292e76de7b65273df4c0a8be678")
if is_plat("linux") then
add_syslinks("pthread", "rt")
end
add_deps("meson", "ninja", "nasm")
on_load("windows", function (package)
if package:is_plat("windows") and package:is_arch("arm.*") and (not package:is_precompiled()) then
package:add("deps", "strawberry-perl")
end
end)
on_install("windows", "linux", "macosx", function (package)
if package:version():ge("2.4.1") then
import("package.tools.meson")
local opt = {}
opt.envs = meson.buildenvs(package)
-- add gas-preprocessor to PATH
if package:is_plat("windows") and package:is_arch("arm.*") then
opt.envs.PATH = path.join(os.programdir(), "scripts") .. path.envsep() .. opt.envs.PATH
end
if package:is_plat("linux") and package:has_tool("cc", "clang", "clangxx") then
opt.ldflags = "-lstdc++"
opt.shflags = "-lstdc++"
end
local configs = {"-Dtests=disabled"}
table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
meson.install(package, configs, opt)
else
import("package.tools.meson").build(package, {"-Dtests=disabled"}, {buildir = "out"})
import("package.tools.ninja").install(package, {}, {buildir = "out"})
if package:config("shared") then
os.tryrm(path.join(package:installdir("lib"), "libopenh264.a"))
else
os.tryrm(path.join(package:installdir("lib"), "libopenh264.so*"))
os.tryrm(path.join(package:installdir("lib"), "openh264.lib"))
os.tryrm(path.join(package:installdir("bin"), "openh264-*.dll"))
end
if package:is_plat("windows") then
os.trymv(path.join(package:installdir("lib"), "libopenh264.a"), path.join(package:installdir("lib"), "openh264.lib"))
end
end
end)
on_test(function (package)
assert(package:has_cxxfuncs("WelsGetCodecVersion", {includes = "wels/codec_api.h"}))
end)

View File

@@ -1 +1 @@
includes("openfec", "libyuv", "aom")
includes("openfec", "libyuv", "aom", "openh264")

View File

@@ -11,7 +11,7 @@ add_defines("ASIO_STANDALONE", "ASIO_HAS_STD_TYPE_TRAITS", "ASIO_HAS_STD_SHARED_
"ASIO_HAS_STD_ADDRESSOF", "ASIO_HAS_STD_ATOMIC", "ASIO_HAS_STD_CHRONO",
"ASIO_HAS_CSTDINT", "ASIO_HAS_STD_ARRAY", "ASIO_HAS_STD_SYSTEM_ERROR")
add_requires("asio 1.24.0", "nlohmann_json", "spdlog 1.14.1", "openfec", "libopus 1.4", "dav1d 1.1.0", "libyuv", "aom")
add_requires("asio 1.24.0", "nlohmann_json", "spdlog 1.14.1", "openfec", "libopus 1.5.1", "dav1d 1.1.0", "libyuv", "aom", {system = false})
add_packages("asio", "nlohmann_json", "spdlog", "openfec", "libopus", "dav1d", "libyuv", "aom")
includes("thirdparty")
@@ -31,8 +31,8 @@ elseif is_os("linux") then
add_syslinks("pthread")
elseif is_os("macosx") then
add_requires("vcpkg::libnice", {configs = {shared = false}})
add_requires("vcpkg::openh264", {configs = {shared = false}})
add_packages("vcpkg::libnice", "vcpkg::openh264")
add_requires("openh264 2.4.1", {configs = {shared = false}}, {system = false})
add_packages("vcpkg::libnice", "openh264")
add_ldflags("-Wl,-ld_classic")
end