From b8caf6a5042e4a8bf0230b8a202a0fbfc414fb59 Mon Sep 17 00:00:00 2001 From: "kjellander@webrtc.org" Date: Tue, 30 Sep 2014 18:05:02 +0000 Subject: [PATCH] GN: Enable libvpx, add link target and convert some test targets Libvpx now supports GN and this CL turns on compiling it. I also introduced an executable target 'webrtc_tests' that depends on all in WeBRTC + tests in order to get a full linking step executed (since we've seen link problems for GN when rolling WebRTC into Chromium). I also converted a few test targets and made a GN file for third_party/gflags. BUG=3441 TESTED=Trybots + full Chromium build with a symlinked src/third_party/webrtc dir to a workspace wit this CL applied. R=brettw@chromium.org TBR=niklas.enbom@webrtc.org Review URL: https://webrtc-codereview.appspot.com/25569004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7344 4adac7df-926f-26a2-2b94-8c16560cd09d --- .gitignore | 5 + setup_links.py | 5 + third_party/gflags/BUILD.gn | 59 ++++++++++ third_party/gflags/OWNERS | 2 + webrtc/BUILD.gn | 13 +++ webrtc/common_audio/BUILD.gn | 6 +- webrtc/modules/audio_coding/BUILD.gn | 9 +- .../modules/remote_bitrate_estimator/BUILD.gn | 16 +++ webrtc/modules/video_coding/BUILD.gn | 32 +++--- webrtc/test/BUILD.gn | 102 ++++++++++++++++++ webrtc/tools/BUILD.gn | 40 +++++++ 11 files changed, 266 insertions(+), 23 deletions(-) create mode 100644 third_party/gflags/BUILD.gn create mode 100644 webrtc/test/BUILD.gn create mode 100644 webrtc/tools/BUILD.gn diff --git a/.gitignore b/.gitignore index f1490c5f15..97370295f3 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,7 @@ /third_party/android_testrunner /third_party/android_tools /third_party/asan +/third_party/ashmem /third_party/binutils /third_party/boringssl /third_party/BUILD.gn @@ -73,17 +74,21 @@ /third_party/google-visualization-python /third_party/icu /third_party/jsoncpp +/third_party/jsr-305 /third_party/junit /third_party/libc++ /third_party/libc++abi +/third_party/libevent /third_party/libjingle /third_party/libjpeg /third_party/libjpeg_turbo /third_party/libsrtp /third_party/libvpx +/third_party/libxml /third_party/libyuv /third_party/llvm /third_party/llvm-build +/third_party/modp_b64 /third_party/nss /third_party/oauth2 /third_party/openmax_dl diff --git a/setup_links.py b/setup_links.py index c403ca8249..a72565e4d3 100755 --- a/setup_links.py +++ b/setup_links.py @@ -79,6 +79,11 @@ if 'android' in get_target_os_list(): 'base', 'third_party/android_testrunner', 'third_party/android_tools', + 'third_party/ashmem', + 'third_party/jsr-305', + 'third_party/libevent', + 'third_party/libxml', + 'third_party/modp_b64', 'tools/android', ] diff --git a/third_party/gflags/BUILD.gn b/third_party/gflags/BUILD.gn new file mode 100644 index 0000000000..a2f1c3d413 --- /dev/null +++ b/third_party/gflags/BUILD.gn @@ -0,0 +1,59 @@ +# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. +# +# Use of this source code is governed by a BSD-style license +# that can be found in the LICENSE file in the root of the source +# tree. An additional intellectual property rights grant can be found +# in the file PATENTS. All contributing project authors may +# be found in the AUTHORS file in the root of the source tree. + +if (is_win) { + gflags_gen_arch_root = "gen/win" +} else { + gflags_gen_arch_root = "gen/posix" +} + +config("gflags_config") { + include_dirs = [ + "$gflags_gen_arch_root/include", # For configured files. + "src", # For everything else. + ] + + defines = [ + # These macros exist so flags and symbols are properly exported when + # building DLLs. Since we don't build DLLs, we need to disable them. + "GFLAGS_DLL_DECL=", + "GFLAGS_DLL_DECLARE_FLAG=", + "GFLAGS_DLL_DEFINE_FLAG=", + ] +} + +source_set("gflags") { + sources = [ + "src/gflags.cc", + "src/gflags_completions.cc", + "src/gflags_reporting.cc", + ] + if (is_win) { + sources += [ "src/windows/port.cc" ] + + cflags = [ + "/wd4005", # WIN32_LEAN_AND_MEAN. + "/wd4267", # Conversion from size_t to "type". + ] + } + + include_dirs = [ + "$gflags_gen_arch_root/include/private", # For config.h + ] + + public_configs = [ ":gflags_config" ] + + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ "//build/config/compiler:no_chromium_code" ] + + if (is_clang) { + # TODO(andrew): Look into fixing this warning upstream: + # http://code.google.com/p/webrtc/issues/detail?id=760 + configs -= [ "//build/config/clang:extra_warnings" ] + } +} diff --git a/third_party/gflags/OWNERS b/third_party/gflags/OWNERS index 3ee6b4bf5f..26b205a780 100644 --- a/third_party/gflags/OWNERS +++ b/third_party/gflags/OWNERS @@ -3,3 +3,5 @@ # structural changes, please get a review from a reviewer in this file. per-file *.gyp=* per-file *.gypi=* + +per-file BUILD.gn=kjellander@webrtc.org diff --git a/webrtc/BUILD.gn b/webrtc/BUILD.gn index 0f6c09c8cf..9d2fa6a0c1 100644 --- a/webrtc/BUILD.gn +++ b/webrtc/BUILD.gn @@ -205,12 +205,25 @@ static_library("webrtc") { "modules/video_processing", "modules/video_render", "system_wrappers", + "tools", "video", "video_engine", "voice_engine", ] } +if (!build_with_chromium) { + executable("webrtc_tests") { + testonly = true + deps = [ + ":webrtc", + "modules/video_render:video_render_internal_impl", + "modules/video_capture:video_capture_internal_impl", + "test", + ] + } +} + source_set("webrtc_common") { sources = [ "config.h", diff --git a/webrtc/common_audio/BUILD.gn b/webrtc/common_audio/BUILD.gn index 27f9bc8f51..adee4b29cc 100644 --- a/webrtc/common_audio/BUILD.gn +++ b/webrtc/common_audio/BUILD.gn @@ -116,15 +116,13 @@ source_set("common_audio") { sources += [ "signal_processing/vector_scaling_operations_mips.c" ] } } else { - sources += [ - "signal_processing/complex_fft.c", - "signal_processing/filter_ar_fast_q12.c", - ] + sources += [ "signal_processing/complex_fft.c" ] } if (cpu_arch != "arm" && cpu_arch != "mipsel") { sources += [ "signal_processing/complex_bit_reverse.c", + "signal_processing/filter_ar_fast_q12.c", "signal_processing/spl_sqrt_floor.c", ] } diff --git a/webrtc/modules/audio_coding/BUILD.gn b/webrtc/modules/audio_coding/BUILD.gn index b3c954d7f7..d6cdf0e896 100644 --- a/webrtc/modules/audio_coding/BUILD.gn +++ b/webrtc/modules/audio_coding/BUILD.gn @@ -528,13 +528,12 @@ source_set("isacfix") { } else { sources += [ "codecs/isac/fix/source/pitch_filter_c.c" ] } + } else { + sources += [ "codecs/isac/fix/source/pitch_estimator_c.c" ] } - if (rtc_build_armv7_neon) { - sources += [ - "codecs/isac/fix/source/lattice_c.c", - "codecs/isac/fix/source/pitch_estimator_c.c", - ] + if (!rtc_build_armv7_neon && cpu_arch != "mipsel") { + sources += [ "codecs/isac/fix/source/lattice_c.c" ] } } diff --git a/webrtc/modules/remote_bitrate_estimator/BUILD.gn b/webrtc/modules/remote_bitrate_estimator/BUILD.gn index a7a45bde46..d7945776f8 100644 --- a/webrtc/modules/remote_bitrate_estimator/BUILD.gn +++ b/webrtc/modules/remote_bitrate_estimator/BUILD.gn @@ -7,6 +7,22 @@ # be found in the AUTHORS file in the root of the source tree. source_set("remote_bitrate_estimator") { + sources = [ + "include/bwe_defines.h", + "include/remote_bitrate_estimator.h", + "rate_statistics.cc", + "rate_statistics.h", + ] + + configs += [ "../../:common_inherited_config"] + + deps = [ + ":rbe_components", + "../../system_wrappers", + ] +} + +source_set("rbe_components") { sources = [ "overuse_detector.cc", "overuse_detector.h", diff --git a/webrtc/modules/video_coding/BUILD.gn b/webrtc/modules/video_coding/BUILD.gn index f101e2b974..07e7afc00b 100644 --- a/webrtc/modules/video_coding/BUILD.gn +++ b/webrtc/modules/video_coding/BUILD.gn @@ -86,6 +86,8 @@ source_set("video_coding_utility") { sources = [ "utility/include/frame_dropper.h", "utility/frame_dropper.cc", + "utility/quality_scaler.cc", + "utility/quality_scaler.h", ] configs += [ "../..:common_config" ] @@ -118,21 +120,19 @@ source_set("webrtc_i420") { deps = [ "../../system_wrappers" ] } -# TODO(holmer): Some files below has been commented out since libvpx is still -# missing a BUILD.gn file. source_set("webrtc_vp8") { sources = [ -# "codecs/vp8/default_temporal_layers.cc", -# "codecs/vp8/default_temporal_layers.h", -# "codecs/vp8/realtime_temporal_layers.cc", -# "codecs/vp8/reference_picture_selection.cc", -# "codecs/vp8/reference_picture_selection.h", + "codecs/vp8/default_temporal_layers.cc", + "codecs/vp8/default_temporal_layers.h", + "codecs/vp8/realtime_temporal_layers.cc", + "codecs/vp8/reference_picture_selection.cc", + "codecs/vp8/reference_picture_selection.h", "codecs/vp8/include/vp8.h", "codecs/vp8/include/vp8_common_types.h", "codecs/vp8/temporal_layers.h", "codecs/vp8/vp8_factory.cc", -# "codecs/vp8/vp8_impl.cc", -# "codecs/vp8/vp8_impl.h", + "codecs/vp8/vp8_impl.cc", + "codecs/vp8/vp8_impl.h", ] configs += [ "../..:common_config" ] @@ -144,14 +144,18 @@ source_set("webrtc_vp8") { configs -= [ "//build/config/clang:find_bad_constructs" ] } + # TODO(kjellander): Remove once libvpx has changed it's libvpx_config to be + # in direct_dependent_configs. + configs += [ "//third_party/libvpx:libvpx_config" ] + deps = [ ":video_coding_utility", "../../common_video", "../../system_wrappers", ] -# if (rtc_build_libvpx) { -# deps += [ -# "//third_party/libvpx", -# ] -# } + if (rtc_build_libvpx) { + deps += [ + "//third_party/libvpx", + ] + } } diff --git a/webrtc/test/BUILD.gn b/webrtc/test/BUILD.gn new file mode 100644 index 0000000000..3de1dcaf42 --- /dev/null +++ b/webrtc/test/BUILD.gn @@ -0,0 +1,102 @@ +# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. +# +# Use of this source code is governed by a BSD-style license +# that can be found in the LICENSE file in the root of the source +# tree. An additional intellectual property rights grant can be found +# in the file PATENTS. All contributing project authors may +# be found in the AUTHORS file in the root of the source tree. + +# TODO(kjellander): Convert the rest of the test.gyp targets and put here. + +source_set("test") { + testonly = true + + deps = [ + ":field_trial", + ":test_support", + ":test_support_main", + ] +} + +source_set("field_trial") { + sources = [ + "field_trial.cc", + "field_trial.h", + ] + + deps = [ + "../system_wrappers", + ] + + if (is_clang) { + # Suppress warnings from Chrome's Clang plugins. + # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. + configs -= [ "//build/config/clang:find_bad_constructs" ] + } +} + +source_set("test_support") { + testonly = true + + sources = [ + "testsupport/fileutils.cc", + "testsupport/fileutils.h", + "testsupport/frame_reader.cc", + "testsupport/frame_reader.h", + "testsupport/frame_writer.cc", + "testsupport/frame_writer.h", + "testsupport/gtest_prod_util.h", + "testsupport/gtest_disable.h", + "testsupport/mock/mock_frame_reader.h", + "testsupport/mock/mock_frame_writer.h", + "testsupport/packet_reader.cc", + "testsupport/packet_reader.h", + "testsupport/perf_test.cc", + "testsupport/perf_test.h", + "testsupport/trace_to_stderr.cc", + "testsupport/trace_to_stderr.h", + ] + + deps = [ + "//testing/gmock", + "//testing/gtest", + "../system_wrappers", + ] + + if (is_android) { + sources += [ "testsupport/android/root_path_android_chromium.cc" ] + deps += [ "//base:base" ] + } else { + sources += [ "testsupport/android/root_path_android.cc" ] + } + + if (is_clang) { + # Suppress warnings from Chrome's Clang plugins. + # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. + configs -= [ "//build/config/clang:find_bad_constructs" ] + } +} + +source_set("test_support_main") { + testonly = true + + sources = [ + "run_all_unittests.cc", + "test_suite.cc", + "test_suite.h", + ] + + deps = [ + ":field_trial", + ":test_support", + "//testing/gmock", + "//testing/gtest", + "//third_party/gflags", + ] + + if (is_clang) { + # Suppress warnings from Chrome's Clang plugins. + # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. + configs -= [ "//build/config/clang:find_bad_constructs" ] + } +} diff --git a/webrtc/tools/BUILD.gn b/webrtc/tools/BUILD.gn new file mode 100644 index 0000000000..f66d8d5d5e --- /dev/null +++ b/webrtc/tools/BUILD.gn @@ -0,0 +1,40 @@ +# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. +# +# Use of this source code is governed by a BSD-style license +# that can be found in the LICENSE file in the root of the source +# tree. An additional intellectual property rights grant can be found +# in the file PATENTS. All contributing project authors may +# be found in the AUTHORS file in the root of the source tree. + +import("../build/webrtc.gni") + +source_set("tools") { + deps = [ + ":command_line_parser", + ] +} + +source_set("command_line_parser") { + sources = [ + "simple_command_line_parser.h", + "simple_command_line_parser.cc", + ] +} + +# TODO(kjellander): Convert all of tools.gyp into GN here. + +if (!build_with_chromium) { + executable("tools_unittests") { + testonly = true + + sources = [ + "simple_command_line_parser_unittest.cc", + ] + + deps = [ + ":command_line_parser", + "../test:test_support_main", + "//testing/gtest", + ] + } +}