Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some improvements for packaged build [wip] #82

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks the fallback logic when a library is not found

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that can't be right.
#85 should do the trick, though.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is wrong, as Ilya has already told me. 5986975 should fix that.
(However, there are linking problems with snap pack builds there; I haven't had a chance to reproduce it yet, but I'm still going to)

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 @@ -129,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 @@ -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)
Expand Down Expand Up @@ -2411,7 +2414,6 @@ set(export_targets
librnnoise
libsrtp
libwebrtcbuild
libyuv
${platform_export}
)
if (TG_OWT_USE_PROTOBUF)
Expand All @@ -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}
Expand Down
31 changes: 31 additions & 0 deletions cmake/external.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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}
Expand All @@ -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)
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
4 changes: 2 additions & 2 deletions src/api/video/i010_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/api/video/i420_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/api/video/nv12_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion src/common_video/libyuv/libyuv_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <math.h>
#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion src/common_video/libyuv/webrtc_libyuv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion src/common_video/video_frame_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion src/modules/desktop_capture/desktop_frame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion src/modules/desktop_capture/desktop_frame_rotation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion src/modules/video_capture/video_capture_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/video_coding/codecs/av1/libaom_av1_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/video_coding/codecs/h264/h264_decoder_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
4 changes: 2 additions & 2 deletions src/modules/video_coding/codecs/h264/h264_encoder_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <wels/codec_api.h>
#include <wels/codec_app_def.h>
#include <wels/codec_def.h>
Expand Down
4 changes: 2 additions & 2 deletions src/modules/video_coding/codecs/test/videoprocessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/video_coding/codecs/vp9/libvpx_vp9_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion src/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion src/modules/video_processing/video_denoiser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <string.h>

#include "api/video/i420_buffer.h"
#include "third_party/libyuv/include/libyuv/planar_functions.h"
#include "libyuv/planar_functions.h"

namespace webrtc {

Expand Down