Skip to content

Commit

Permalink
Integrated the Vitaly Lipatov's patch for libyuv
Browse files Browse the repository at this point in the history
Integrated the Vitaly Lipatov's ([email protected]) patch.
It allows to build tg_owt with the system libyuv. If libyuv is
not installed on the system, the build will be performed with
libyuv from src/third_party/.
Also fixed build in non-packaged mode.
  • Loading branch information
noiseless committed Dec 30, 2021
1 parent 5986975 commit ddcb55f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
15 changes: 12 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,14 @@ include(cmake/external.cmake)
include(cmake/libpffft.cmake)
include(cmake/librnnoise.cmake)
include(cmake/libsrtp.cmake)
include(cmake/libyuv.cmake)
if (NOT TG_OWT_PACKAGED_BUILD)
include(cmake/libabsl.cmake)
include(cmake/libopenh264.cmake)
include(cmake/libusrsctp.cmake)
include(cmake/libvpx.cmake)
include(cmake/libyuv.cmake)
endif()

if (APPLE)
include(cmake/libsdkmacos.cmake)
endif()
Expand Down Expand Up @@ -125,7 +132,6 @@ PRIVATE
tg_owt::libpffft
tg_owt::librnnoise
tg_owt::libsrtp
tg_owt::libyuv
)

if (is_x86 OR is_x64)
Expand Down Expand Up @@ -160,6 +166,7 @@ link_libabsl(tg_owt)
link_libopenh264(tg_owt)
link_libusrsctp(tg_owt)
link_libvpx(tg_owt)
link_libyuv(tg_owt)

if (TG_OWT_BUILD_AUDIO_BACKENDS AND (UNIX AND NOT APPLE))
link_libalsa(tg_owt)
Expand Down Expand Up @@ -2407,7 +2414,6 @@ set(export_targets
librnnoise
libsrtp
libwebrtcbuild
libyuv
${platform_export}
)
if (TG_OWT_USE_PROTOBUF)
Expand All @@ -2426,6 +2432,9 @@ endif()
if (NOT LIBVPX_FOUND)
list(APPEND export_targets libvpx ${vpx_export})
endif()
if (NOT LIBYUV_FOUND)
list(APPEND export_targets libyuv)
endif()

export(
TARGETS ${export_targets}
Expand Down
19 changes: 19 additions & 0 deletions cmake/external.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,25 @@ function(link_libvpx target_name)
endif()
endfunction()

# libyuv
function(link_libyuv target_name)
if (TG_OWT_PACKAGED_BUILD)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBYUV libyuv>=0.0.1767)
set(LIBYUV_FOUND ${LIBYUV_FOUND} PARENT_SCOPE)
if (LIBYUV_FOUND)
target_link_libraries(${target_name} PRIVATE ${LIBYUV_LIBRARIES})
target_include_directories(${target_name} PRIVATE ${LIBYUV_INCLUDE_DIRS})
endif()
endif()
if (NOT LIBYUV_FOUND)
if (NOT TARGET libyuv)
include(cmake/libyuv.cmake)
endif()
target_link_libraries(${target_name} PRIVATE tg_owt::libyuv)
endif()
endfunction()

function(link_glib target_name)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GLIB2 REQUIRED glib-2.0)
Expand Down
7 changes: 3 additions & 4 deletions cmake/libwebrtcbuild.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
add_library(libwebrtcbuild INTERFACE)
add_library(tg_owt::libwebrtcbuild ALIAS libwebrtcbuild)

target_link_libraries(libwebrtcbuild
INTERFACE
tg_owt::libyuv
)
if (NOT LIBYUV_FOUND)
target_link_libraries(libwebrtcbuild INTERFACE tg_owt::libyuv)
endif()
if (NOT absl_FOUND)
target_link_libraries(libwebrtcbuild INTERFACE tg_owt::libabsl)
endif()
Expand Down

0 comments on commit ddcb55f

Please sign in to comment.