Add a variable for deciding when to use openmax_dl.

Modifies the previous condition to additionally not use openmax_dl on
iOS. Remove the All target's direct dependency on it, as it is now
pulled in by the targets that need it.

Add gn support since an openmax_dl gn target is available.

BUG=chromium:415393, webrtc:3906
R=turaj@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7397 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/all.gyp b/all.gyp
index b43c3a17..2280c03 100644
--- a/all.gyp
+++ b/all.gyp
@@ -18,7 +18,6 @@
       'target_name': 'All',
       'type': 'none',
       'dependencies': [
-        'third_party/openmax_dl/dl/dl.gyp:*',
         'webrtc/webrtc.gyp:*',
         '<(libjingle_root)/talk/libjingle.gyp:*',
         '<(libjingle_root)/talk/libjingle_examples.gyp:*',
diff --git a/webrtc/build/common.gypi b/webrtc/build/common.gypi
index 64c2a6e..c5ba41f 100644
--- a/webrtc/build/common.gypi
+++ b/webrtc/build/common.gypi
@@ -155,6 +155,13 @@
       ['target_arch=="arm" or target_arch=="armv7"', {
         'prefer_fixed_point%': 1,
       }],
+      # TODO(ajm): Workaround until openmax_dl has non-Android ARM support.
+      # See: crbug.com/415393
+      ['OS!="ios" and (target_arch!="arm" or OS=="android")', {
+        'rtc_use_openmax_dl%': 1,
+      }, {
+        'rtc_use_openmax_dl%': 0,
+      }],
     ], # conditions
   },
   'target_defaults': {
diff --git a/webrtc/build/webrtc.gni b/webrtc/build/webrtc.gni
index 878b6ff..e0f6924 100644
--- a/webrtc/build/webrtc.gni
+++ b/webrtc/build/webrtc.gni
@@ -103,6 +103,14 @@
     rtc_prefer_fixed_point = true
   }
 
+  # TODO(ajm): Workaround until openmax_dl has non-Android ARM support.
+  # See: crbug.com/415393
+  if (!is_ios && (cpu_arch != "arm" || is_android)) {
+    rtc_use_openmax_dl = true
+  } else {
+    rtc_use_openmax_dl = false
+  }
+
   # WebRTC builds ARM v7 Neon instruction set optimized code for both iOS and
   # Android, which is why we currently cannot use the variables in
   # //build/config/arm.gni (since it disables Neon for Android).
diff --git a/webrtc/common_audio/BUILD.gn b/webrtc/common_audio/BUILD.gn
index 36740e8..9091c42 100644
--- a/webrtc/common_audio/BUILD.gn
+++ b/webrtc/common_audio/BUILD.gn
@@ -90,21 +90,16 @@
 
   deps = [ "../system_wrappers" ]
 
-  # TODO(ajm): Enable when GN support for openmax_dl is added.
-  # See: crbug.com/419206
-  # Not needed immediately, since nothing built by GN depends on these bits.
-  # TODO(ajm): Workaround until openmax_dl has non-Android ARM support.
-  # See: crbug.com/415393
-  #if (cpu_arch != "arm" or (cpu_arch == "arm" and is_android)) {
-  #  'sources' += [
-  #    'lapped_transform.cc',
-  #    'lapped_transform.h',
-  #    'real_fourier.cc',
-  #    'real_fourier.h',
-  #  ]
-  #
-  #  deps += [ "//third_party/openmax_dl/dl" ]
-  #}
+  if (rtc_use_openmax_dl) {
+    sources += [
+      "lapped_transform.cc",
+      "lapped_transform.h",
+      "real_fourier.cc",
+      "real_fourier.h",
+    ]
+
+    deps += [ "//third_party/openmax_dl/dl" ]
+  }
 
   if (cpu_arch == "arm") {
     sources += [
diff --git a/webrtc/common_audio/common_audio.gyp b/webrtc/common_audio/common_audio.gyp
index 4581f58..9378f72 100644
--- a/webrtc/common_audio/common_audio.gyp
+++ b/webrtc/common_audio/common_audio.gyp
@@ -102,9 +102,7 @@
         'window_generator.h',
       ],
       'conditions': [
-        # TODO(ajm): Workaround until openmax_dl has non-Android ARM support.
-        # See: crbug.com/415393
-        ['target_arch!="arm" or (target_arch=="arm" and OS=="android")', {
+        ['rtc_use_openmax_dl==1', {
           'sources': [
             'lapped_transform.cc',
             'lapped_transform.h',
@@ -247,9 +245,7 @@
             'window_generator_unittest.cc',
           ],
           'conditions': [
-            # TODO(ajm): Workaround until openmax_dl has non-Android ARM
-            # support. See: crbug.com/415393
-            ['target_arch!="arm" or (target_arch=="arm" and OS=="android")', {
+            ['rtc_use_openmax_dl==1', {
               'sources': [
                 'lapped_transform_unittest.cc',
                 'real_fourier_unittest.cc',