Make it easier to use external libyuv + cleanup GYP files.

It is now easier to use an external libyuv library.
Fix some GYP errors.
Remove the temporary webrtc_base target (depends on
https://codereview.chromium.org/865603002/ being landed
first).

BUG=4185
R=andresp@webrtc.org, andrew@webrtc.org, perkj@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/39579004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@8154 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/DEPS b/DEPS
index 135707a..8bbf65f 100644
--- a/DEPS
+++ b/DEPS
@@ -35,6 +35,7 @@
   '-base',
   '-chromium',
   '+gflags',
+  '+libyuv',
   '+net',
   '+talk',
   '+testing',
diff --git a/webrtc/BUILD.gn b/webrtc/BUILD.gn
index fdcfdaa..56531a7 100644
--- a/webrtc/BUILD.gn
+++ b/webrtc/BUILD.gn
@@ -235,8 +235,11 @@
 
 source_set("webrtc_common") {
   sources = [
+    "common_types.h",
     "config.h",
     "config.cc",
+    "engine_configurations.h",
+    "typedefs.h",
   ]
 
   if (is_clang) {
@@ -248,3 +251,9 @@
   configs += [ ":common_config" ]
   public_configs = [ ":common_inherited_config" ]
 }
+
+source_set("gtest_prod") {
+  sources = [
+    "test/testsupport/gtest_prod_util.h",
+  ]
+}
diff --git a/webrtc/base/base.gyp b/webrtc/base/base.gyp
index c837b87..16437be 100644
--- a/webrtc/base/base.gyp
+++ b/webrtc/base/base.gyp
@@ -25,16 +25,6 @@
   ],
   'targets': [
     {
-      # Temporary target until Chromium's
-      # src/third_party/libjingle/libjingle.gyp is updated to use rtc_base.
-      # TODO(kjellander): Remove when r7140 is rolled into Chromium's DEPS.
-      'target_name': 'webrtc_base',
-      'type': 'none',
-      'dependencies': [
-        'rtc_base',
-      ],
-    },
-    {
       # The subset of rtc_base approved for use outside of libjingle.
       'target_name': 'rtc_base_approved',
       'type': 'static_library',
diff --git a/webrtc/common.gyp b/webrtc/common.gyp
index b6b6354..af20655 100644
--- a/webrtc/common.gyp
+++ b/webrtc/common.gyp
@@ -12,8 +12,18 @@
       'target_name': 'webrtc_common',
       'type': 'static_library',
       'sources': [
+        'common_types.h',
         'config.h',
         'config.cc',
+        'engine_configurations.h',
+        'typedefs.h',
+      ],
+    },
+    {
+      'target_name': 'gtest_prod',
+      'type': 'static_library',
+      'sources': [
+        'test/testsupport/gtest_prod_util.h',
       ],
     },
   ],
diff --git a/webrtc/common_audio/common_audio.gyp b/webrtc/common_audio/common_audio.gyp
index 056013b..d50c2c5 100644
--- a/webrtc/common_audio/common_audio.gyp
+++ b/webrtc/common_audio/common_audio.gyp
@@ -32,7 +32,6 @@
         'audio_converter.cc',
         'audio_converter.h',
         'audio_util.cc',
-        'audio_util.h',
         'blocker.cc',
         'blocker.h',
         'fir_filter.cc',
diff --git a/webrtc/common_video/BUILD.gn b/webrtc/common_video/BUILD.gn
index d7f6dc2..8085bce 100644
--- a/webrtc/common_video/BUILD.gn
+++ b/webrtc/common_video/BUILD.gn
@@ -48,6 +48,7 @@
 
   if (rtc_build_libyuv) {
     deps += [ "//third_party/libyuv" ]
+    public_deps = [ "//third_party/libyuv" ]
   } else {
     # Need to add a directory normally exported by libyuv.
     include_dirs += [ "//third_party/libyuv/include" ]
diff --git a/webrtc/common_video/common_video.gyp b/webrtc/common_video/common_video.gyp
index 69e5eb3..c45113f 100644
--- a/webrtc/common_video/common_video.gyp
+++ b/webrtc/common_video/common_video.gyp
@@ -29,6 +29,9 @@
       'conditions': [
         ['build_libyuv==1', {
           'dependencies': ['<(DEPTH)/third_party/libyuv/libyuv.gyp:libyuv',],
+          'export_dependent_settings': [
+            '<(DEPTH)/third_party/libyuv/libyuv.gyp:libyuv',
+          ],
         }, {
           # Need to add a directory normally exported by libyuv.gyp.
           'include_dirs': ['<(libyuv_dir)/include',],
diff --git a/webrtc/libjingle/libjingle.gyp b/webrtc/libjingle/libjingle.gyp
index f1ed3ba..37e2511 100644
--- a/webrtc/libjingle/libjingle.gyp
+++ b/webrtc/libjingle/libjingle.gyp
@@ -30,7 +30,7 @@
       'type': 'static_library',
       'dependencies': [
         '<(talk_root)/libjingle.gyp:libjingle_media',
-        '<(webrtc_root)/base/base.gyp:webrtc_base',
+        '<(webrtc_root)/base/base.gyp:rtc_base',
         '<(webrtc_root)/libjingle/xmpp/xmpp.gyp:rtc_xmpp',
         '<(DEPTH)/third_party/expat/expat.gyp:expat',
       ],
diff --git a/webrtc/libjingle/xmpp/xmpp.gyp b/webrtc/libjingle/xmpp/xmpp.gyp
index 35755d6..b46c62c 100644
--- a/webrtc/libjingle/xmpp/xmpp.gyp
+++ b/webrtc/libjingle/xmpp/xmpp.gyp
@@ -13,7 +13,7 @@
       'target_name': 'rtc_xmpp',
       'type': 'static_library',
       'dependencies': [
-        '<(webrtc_root)/base/base.gyp:webrtc_base',
+        '<(webrtc_root)/base/base.gyp:rtc_base',
         '<(webrtc_root)/libjingle/xmllite/xmllite.gyp:rtc_xmllite',
         '<(DEPTH)/third_party/expat/expat.gyp:expat',
       ],
@@ -138,4 +138,4 @@
       ],
     }],
 }
-  
+
diff --git a/webrtc/modules/audio_device/BUILD.gn b/webrtc/modules/audio_device/BUILD.gn
index ce62ee4..1418bdc 100644
--- a/webrtc/modules/audio_device/BUILD.gn
+++ b/webrtc/modules/audio_device/BUILD.gn
@@ -141,6 +141,7 @@
       libs = [
         "AudioToolbox.framework",
         "AVFoundation.framework",
+        "Foundation.framework",
       ]
     }
     if (is_win) {
diff --git a/webrtc/modules/audio_device/audio_device.gypi b/webrtc/modules/audio_device/audio_device.gypi
index 76eb38a..1681fca 100644
--- a/webrtc/modules/audio_device/audio_device.gypi
+++ b/webrtc/modules/audio_device/audio_device.gypi
@@ -192,6 +192,7 @@
                   'OTHER_LDFLAGS': [
                     '-framework AudioToolbox',
                     '-framework AVFoundation',
+                    '-framework Foundation',
                   ],
                 },
               },
diff --git a/webrtc/modules/video_coding/BUILD.gn b/webrtc/modules/video_coding/BUILD.gn
index eaaeaa8..969ce8a 100644
--- a/webrtc/modules/video_coding/BUILD.gn
+++ b/webrtc/modules/video_coding/BUILD.gn
@@ -178,12 +178,6 @@
       "//third_party/libvpx",
     ]
   }
-  if (rtc_build_libyuv) {
-    deps += [ "//third_party/libyuv" ]
-  } else {
-    # Need to add a directory normally exported by libyuv.
-    include_dirs += [ "//third_party/libyuv/include" ]
-  }
 }
 
 source_set("webrtc_vp9") {
diff --git a/webrtc/modules/video_coding/codecs/vp8/vp8.gyp b/webrtc/modules/video_coding/codecs/vp8/vp8.gyp
index 504d4b8..63cc854 100644
--- a/webrtc/modules/video_coding/codecs/vp8/vp8.gyp
+++ b/webrtc/modules/video_coding/codecs/vp8/vp8.gyp
@@ -48,9 +48,6 @@
       'msvs_disabled_warnings': [
         4267,  # size_t to int truncation.
       ],
-      'include_dirs': [
-        '<(libyuv_dir)/include',
-      ],
     },
   ], # targets
   'conditions': [
diff --git a/webrtc/p2p/p2p.gyp b/webrtc/p2p/p2p.gyp
index 4de6b21..3f09376 100644
--- a/webrtc/p2p/p2p.gyp
+++ b/webrtc/p2p/p2p.gyp
@@ -13,7 +13,7 @@
       'target_name': 'rtc_p2p',
       'type': 'static_library',
       'dependencies': [
-        '<(webrtc_root)/base/base.gyp:webrtc_base',
+        '<(webrtc_root)/base/base.gyp:rtc_base',
       ],
       'cflags_cc!': [
         '-Wnon-virtual-dtor',
@@ -113,4 +113,4 @@
       ],
     }],
 }
-  
+
diff --git a/webrtc/tools/converter/converter.h b/webrtc/tools/converter/converter.h
index ce21c95..a23d5a1 100644
--- a/webrtc/tools/converter/converter.h
+++ b/webrtc/tools/converter/converter.h
@@ -13,8 +13,8 @@
 
 #include <string>
 
-#include "third_party/libyuv/include/libyuv/compare.h"
-#include "third_party/libyuv/include/libyuv/convert.h"
+#include "libyuv/compare.h"  // NOLINT
+#include "libyuv/convert.h"  // NOLINT
 
 namespace webrtc {
 namespace test {
diff --git a/webrtc/tools/frame_analyzer/video_quality_analysis.h b/webrtc/tools/frame_analyzer/video_quality_analysis.h
index 31064a2..4704a8c 100644
--- a/webrtc/tools/frame_analyzer/video_quality_analysis.h
+++ b/webrtc/tools/frame_analyzer/video_quality_analysis.h
@@ -14,8 +14,8 @@
 #include <string>
 #include <vector>
 
-#include "third_party/libyuv/include/libyuv/compare.h"
-#include "third_party/libyuv/include/libyuv/convert.h"
+#include "libyuv/compare.h"  // NOLINT
+#include "libyuv/convert.h"  // NOLINT
 
 namespace webrtc {
 namespace test {
diff --git a/webrtc/tools/tools.gyp b/webrtc/tools/tools.gyp
index 7e90511..0a3d531 100644
--- a/webrtc/tools/tools.gyp
+++ b/webrtc/tools/tools.gyp
@@ -15,10 +15,10 @@
       'target_name': 'video_quality_analysis',
       'type': 'static_library',
       'dependencies': [
-        '<(DEPTH)/third_party/libyuv/libyuv.gyp:libyuv',
+        '<(webrtc_root)/common_video/common_video.gyp:common_video',
       ],
       'export_dependent_settings': [
-        '<(DEPTH)/third_party/libyuv/libyuv.gyp:libyuv',
+        '<(webrtc_root)/common_video/common_video.gyp:common_video',
       ],
       'sources': [
         'frame_analyzer/video_quality_analysis.h',
@@ -51,8 +51,8 @@
       'target_name': 'rgba_to_i420_converter',
       'type': 'executable',
       'dependencies': [
+        '<(webrtc_root)/common_video/common_video.gyp:common_video',
         '<(webrtc_root)/tools/internal_tools.gyp:command_line_parser',
-        '<(DEPTH)/third_party/libyuv/libyuv.gyp:libyuv',
       ],
       'sources': [
         'converter/converter.h',
diff --git a/webrtc/voice_engine/BUILD.gn b/webrtc/voice_engine/BUILD.gn
index 3666bd5..54da9ad 100644
--- a/webrtc/voice_engine/BUILD.gn
+++ b/webrtc/voice_engine/BUILD.gn
@@ -11,9 +11,6 @@
 source_set("voice_engine") {
 
   sources = [
-    "../common_types.h",
-    "../engine_configurations.h",
-    "../typedefs.h",
     "include/voe_audio_processing.h",
     "include/voe_base.h",
     "include/voe_codec.h",
diff --git a/webrtc/voice_engine/voice_engine.gyp b/webrtc/voice_engine/voice_engine.gyp
index 13c4754..3ec870d 100644
--- a/webrtc/voice_engine/voice_engine.gyp
+++ b/webrtc/voice_engine/voice_engine.gyp
@@ -27,9 +27,6 @@
         '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
       ],
       'sources': [
-        '../common_types.h',
-        '../engine_configurations.h',
-        '../typedefs.h',
         'include/voe_audio_processing.h',
         'include/voe_base.h',
         'include/voe_codec.h',
diff --git a/webrtc/webrtc.gyp b/webrtc/webrtc.gyp
index 10bc3e7..a1ab827 100644
--- a/webrtc/webrtc.gyp
+++ b/webrtc/webrtc.gyp
@@ -31,6 +31,7 @@
       'modules/modules.gyp:*',
       'p2p/p2p.gyp:*',
       'system_wrappers/system_wrappers.gyp:*',
+      'tools/tools.gyp:*',
       'video_engine/video_engine.gyp:*',
       'voice_engine/voice_engine.gyp:*',
       '<(webrtc_vp8_dir)/vp8.gyp:*',
@@ -53,7 +54,6 @@
             'test/metrics.gyp:*',
             'test/test.gyp:*',
             'test/webrtc_test_common.gyp:webrtc_test_common_unittests',
-            'tools/tools.gyp:*',
             'webrtc_tests',
             'rtc_unittests',
           ],