diff --git a/CMakeLists.txt b/CMakeLists.txt index 8db78bf42..7f212da42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,14 +77,17 @@ include(cmake/init_target.cmake) include(cmake/generate_target.cmake) include(cmake/target_yasm_sources.cmake) include(cmake/external.cmake) -include(cmake/libabsl.cmake) -include(cmake/libopenh264.cmake) include(cmake/libpffft.cmake) include(cmake/librnnoise.cmake) include(cmake/libsrtp.cmake) -include(cmake/libusrsctp.cmake) -include(cmake/libvpx.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() @@ -129,7 +132,6 @@ PRIVATE tg_owt::libpffft tg_owt::librnnoise tg_owt::libsrtp - tg_owt::libyuv ) if (is_x86 OR is_x64) @@ -164,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) @@ -2411,7 +2414,6 @@ set(export_targets librnnoise libsrtp libwebrtcbuild - libyuv ${platform_export} ) if (TG_OWT_USE_PROTOBUF) @@ -2430,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} diff --git a/cmake/external.cmake b/cmake/external.cmake index 336861912..52d7a725d 100644 --- a/cmake/external.cmake +++ b/cmake/external.cmake @@ -123,6 +123,9 @@ function(link_libabsl target_name) endif() endif() if (NOT absl_FOUND) + if (NOT TARGET libabsl) + include(cmake/libabsl.cmake) + endif() target_link_libraries(${target_name} PRIVATE tg_owt::libabsl) endif() endfunction() @@ -139,6 +142,9 @@ function(link_libopenh264 target_name) endif() endif() if (NOT LIBOPENH264_FOUND) + if (NOT TARGET libopenh264) + include(cmake/libopenh264.cmake) + endif() target_link_libraries(${target_name} PRIVATE tg_owt::libopenh264) target_include_directories(${target_name} PRIVATE ${libopenh264_loc}/include) endif() @@ -156,6 +162,9 @@ function(link_libusrsctp target_name) endif() endif() if (NOT LIBUSRSCTP_FOUND) + if (NOT TARGET libusrsctp) + include(cmake/libusrsctp.cmake) + endif() target_link_libraries(${target_name} PRIVATE tg_owt::libusrsctp) endif() endfunction() @@ -172,6 +181,9 @@ function(link_libvpx target_name) endif() endif() if (NOT LIBVPX_FOUND) + if (NOT TARGET libvpx) + include(cmake/libvpx.cmake) + endif() target_link_libraries(${target_name} PRIVATE tg_owt::libvpx) if (is_x86 OR is_x64) target_link_libraries(${target_name} @@ -187,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) diff --git a/cmake/libwebrtcbuild.cmake b/cmake/libwebrtcbuild.cmake index 46467d728..d521ebce0 100644 --- a/cmake/libwebrtcbuild.cmake +++ b/cmake/libwebrtcbuild.cmake @@ -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() diff --git a/src/api/video/i010_buffer.cc b/src/api/video/i010_buffer.cc index 74d37d1b5..6ea7a7b40 100644 --- a/src/api/video/i010_buffer.cc +++ b/src/api/video/i010_buffer.cc @@ -14,8 +14,8 @@ #include "api/video/i420_buffer.h" #include "rtc_base/checks.h" #include "rtc_base/ref_counted_object.h" -#include "third_party/libyuv/include/libyuv/convert.h" -#include "third_party/libyuv/include/libyuv/scale.h" +#include "libyuv/convert.h" +#include "libyuv/scale.h" // Aligning pointer to 64 bytes for improved performance, e.g. use SIMD. static const int kBufferAlignment = 64; diff --git a/src/api/video/i420_buffer.cc b/src/api/video/i420_buffer.cc index 8783a4a31..f680d7838 100644 --- a/src/api/video/i420_buffer.cc +++ b/src/api/video/i420_buffer.cc @@ -16,9 +16,9 @@ #include "rtc_base/checks.h" #include "rtc_base/ref_counted_object.h" -#include "third_party/libyuv/include/libyuv/convert.h" -#include "third_party/libyuv/include/libyuv/planar_functions.h" -#include "third_party/libyuv/include/libyuv/scale.h" +#include "libyuv/convert.h" +#include "libyuv/planar_functions.h" +#include "libyuv/scale.h" // Aligning pointer to 64 bytes for improved performance, e.g. use SIMD. static const int kBufferAlignment = 64; diff --git a/src/api/video/nv12_buffer.cc b/src/api/video/nv12_buffer.cc index 37d688b88..322450440 100644 --- a/src/api/video/nv12_buffer.cc +++ b/src/api/video/nv12_buffer.cc @@ -13,8 +13,8 @@ #include "api/video/i420_buffer.h" #include "rtc_base/checks.h" #include "rtc_base/ref_counted_object.h" -#include "third_party/libyuv/include/libyuv/convert.h" -#include "third_party/libyuv/include/libyuv/scale.h" +#include "libyuv/convert.h" +#include "libyuv/scale.h" namespace webrtc { diff --git a/src/common_video/libyuv/libyuv_unittest.cc b/src/common_video/libyuv/libyuv_unittest.cc index 62d9e87fa..a70fd25b8 100644 --- a/src/common_video/libyuv/libyuv_unittest.cc +++ b/src/common_video/libyuv/libyuv_unittest.cc @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "third_party/libyuv/include/libyuv.h" +#include "libyuv.h" #include #include diff --git a/src/common_video/libyuv/webrtc_libyuv.cc b/src/common_video/libyuv/webrtc_libyuv.cc index cc6a71a61..573c5e571 100644 --- a/src/common_video/libyuv/webrtc_libyuv.cc +++ b/src/common_video/libyuv/webrtc_libyuv.cc @@ -15,7 +15,7 @@ #include "api/video/i420_buffer.h" #include "common_video/include/video_frame_buffer.h" #include "rtc_base/checks.h" -#include "third_party/libyuv/include/libyuv.h" +#include "libyuv.h" namespace webrtc { diff --git a/src/common_video/video_frame_buffer.cc b/src/common_video/video_frame_buffer.cc index 78a126419..93f6c398f 100644 --- a/src/common_video/video_frame_buffer.cc +++ b/src/common_video/video_frame_buffer.cc @@ -12,7 +12,7 @@ #include "api/video/i420_buffer.h" #include "rtc_base/checks.h" #include "rtc_base/ref_counted_object.h" -#include "third_party/libyuv/include/libyuv/convert.h" +#include "libyuv/convert.h" namespace webrtc { diff --git a/src/modules/desktop_capture/desktop_frame.cc b/src/modules/desktop_capture/desktop_frame.cc index 9e4a899fd..902617f96 100644 --- a/src/modules/desktop_capture/desktop_frame.cc +++ b/src/modules/desktop_capture/desktop_frame.cc @@ -19,7 +19,7 @@ #include "modules/desktop_capture/desktop_capture_types.h" #include "modules/desktop_capture/desktop_geometry.h" #include "rtc_base/checks.h" -#include "third_party/libyuv/include/libyuv/planar_functions.h" +#include "libyuv/planar_functions.h" namespace webrtc { diff --git a/src/modules/desktop_capture/desktop_frame_rotation.cc b/src/modules/desktop_capture/desktop_frame_rotation.cc index daef385f2..ab229d230 100644 --- a/src/modules/desktop_capture/desktop_frame_rotation.cc +++ b/src/modules/desktop_capture/desktop_frame_rotation.cc @@ -11,7 +11,7 @@ #include "modules/desktop_capture/desktop_frame_rotation.h" #include "rtc_base/checks.h" -#include "third_party/libyuv/include/libyuv/rotate_argb.h" +#include "libyuv/rotate_argb.h" namespace webrtc { diff --git a/src/modules/video_capture/video_capture_impl.cc b/src/modules/video_capture/video_capture_impl.cc index 6619d1592..562ce9606 100644 --- a/src/modules/video_capture/video_capture_impl.cc +++ b/src/modules/video_capture/video_capture_impl.cc @@ -21,7 +21,7 @@ #include "rtc_base/ref_counted_object.h" #include "rtc_base/time_utils.h" #include "rtc_base/trace_event.h" -#include "third_party/libyuv/include/libyuv.h" +#include "libyuv.h" namespace webrtc { namespace videocapturemodule { diff --git a/src/modules/video_coding/codecs/av1/libaom_av1_decoder.cc b/src/modules/video_coding/codecs/av1/libaom_av1_decoder.cc index 2405e2c52..844e38e6f 100644 --- a/src/modules/video_coding/codecs/av1/libaom_av1_decoder.cc +++ b/src/modules/video_coding/codecs/av1/libaom_av1_decoder.cc @@ -23,7 +23,7 @@ #include "rtc_base/logging.h" #include "third_party/libaom/source/libaom/aom/aom_decoder.h" #include "third_party/libaom/source/libaom/aom/aomdx.h" -#include "third_party/libyuv/include/libyuv/convert.h" +#include "libyuv/convert.h" namespace webrtc { namespace { diff --git a/src/modules/video_coding/codecs/h264/h264_decoder_impl.cc b/src/modules/video_coding/codecs/h264/h264_decoder_impl.cc index 81da0f26b..b6938a3df 100644 --- a/src/modules/video_coding/codecs/h264/h264_decoder_impl.cc +++ b/src/modules/video_coding/codecs/h264/h264_decoder_impl.cc @@ -35,7 +35,7 @@ extern "C" { #include "rtc_base/logging.h" #include "system_wrappers/include/field_trial.h" #include "system_wrappers/include/metrics.h" -#include "third_party/libyuv/include/libyuv/convert.h" +#include "libyuv/convert.h" namespace webrtc { diff --git a/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc b/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc index fbb112186..4e79acce0 100644 --- a/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc +++ b/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc @@ -28,8 +28,8 @@ #include "rtc_base/logging.h" #include "rtc_base/time_utils.h" #include "system_wrappers/include/metrics.h" -#include "third_party/libyuv/include/libyuv/convert.h" -#include "third_party/libyuv/include/libyuv/scale.h" +#include "libyuv/convert.h" +#include "libyuv/scale.h" #include #include #include diff --git a/src/modules/video_coding/codecs/test/videoprocessor.cc b/src/modules/video_coding/codecs/test/videoprocessor.cc index 473be0155..eedec1b6a 100644 --- a/src/modules/video_coding/codecs/test/videoprocessor.cc +++ b/src/modules/video_coding/codecs/test/videoprocessor.cc @@ -35,8 +35,8 @@ #include "rtc_base/task_utils/to_queued_task.h" #include "rtc_base/time_utils.h" #include "test/gtest.h" -#include "third_party/libyuv/include/libyuv/compare.h" -#include "third_party/libyuv/include/libyuv/scale.h" +#include "libyuv/compare.h" +#include "libyuv/scale.h" namespace webrtc { namespace test { diff --git a/src/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc b/src/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc index 10bd2adf4..1cf28d926 100644 --- a/src/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc +++ b/src/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc @@ -30,7 +30,7 @@ #include "rtc_base/time_utils.h" #include "system_wrappers/include/field_trial.h" #include "system_wrappers/include/metrics.h" -#include "third_party/libyuv/include/libyuv/convert.h" +#include "libyuv/convert.h" #include "vpx/vp8.h" #include "vpx/vp8dx.h" #include "vpx/vpx_decoder.h" diff --git a/src/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc b/src/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc index 1f7056952..40e1a3db9 100644 --- a/src/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc +++ b/src/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc @@ -38,7 +38,7 @@ #include "rtc_base/logging.h" #include "rtc_base/trace_event.h" #include "system_wrappers/include/field_trial.h" -#include "third_party/libyuv/include/libyuv/scale.h" +#include "libyuv/scale.h" #include "vpx/vp8cx.h" namespace webrtc { diff --git a/src/modules/video_coding/codecs/vp9/libvpx_vp9_decoder.cc b/src/modules/video_coding/codecs/vp9/libvpx_vp9_decoder.cc index a21505f9b..a12be25f9 100644 --- a/src/modules/video_coding/codecs/vp9/libvpx_vp9_decoder.cc +++ b/src/modules/video_coding/codecs/vp9/libvpx_vp9_decoder.cc @@ -23,7 +23,7 @@ #include "modules/video_coding/utility/vp9_uncompressed_header_parser.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" -#include "third_party/libyuv/include/libyuv/convert.h" +#include "libyuv/convert.h" #include "vpx/vp8dx.h" #include "vpx/vpx_decoder.h" diff --git a/src/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc b/src/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc index 525fbe8ed..c4e07bd0e 100644 --- a/src/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc +++ b/src/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc @@ -39,7 +39,7 @@ #include "rtc_base/strings/string_builder.h" #include "rtc_base/time_utils.h" #include "rtc_base/trace_event.h" -#include "third_party/libyuv/include/libyuv/convert.h" +#include "libyuv/convert.h" #include "vpx/vp8cx.h" #include "vpx/vpx_encoder.h" diff --git a/src/modules/video_processing/video_denoiser.cc b/src/modules/video_processing/video_denoiser.cc index 1d844e61d..90659ee9c 100644 --- a/src/modules/video_processing/video_denoiser.cc +++ b/src/modules/video_processing/video_denoiser.cc @@ -14,7 +14,7 @@ #include #include "api/video/i420_buffer.h" -#include "third_party/libyuv/include/libyuv/planar_functions.h" +#include "libyuv/planar_functions.h" namespace webrtc {