Create GPU-less build of Skia.



git-svn-id: http://skia.googlecode.com/svn/trunk@4912 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gyp/SampleApp.gyp b/gyp/SampleApp.gyp
index 852d7f7..2db2a18 100644
--- a/gyp/SampleApp.gyp
+++ b/gyp/SampleApp.gyp
@@ -9,7 +9,6 @@
         '../src/core', # needed to get SkConcaveToTriangle, maybe this should be moved to include dir?
         '../gm',       # needed to pull gm.h
         '../samplecode', # To pull SampleApp.h and SampleCode.h
-        '../src/gpu', # To pull gl/GrGLUtil.h
         '../src/pipe/utils', # For TiledPipeController
       ],
       'includes': [
@@ -151,8 +150,6 @@
         'animator.gyp:animator',
         'xml.gyp:xml',
         'experimental.gyp:experimental',
-        'gpu.gyp:gr',
-        'gpu.gyp:skgr',
         'pdf.gyp:pdf',
         'views_animated.gyp:views_animated',
       ],
@@ -237,7 +234,6 @@
             '../experimental/iOSSampleApp/iPad',
             '../experimental/iOSSampleApp/iPhone',
             '../include/utils/ios',
-            '../../include/gpu',
           ],
           'xcode_config_file': '../experimental/iOSSampleApp/SkiOSSampleApp-Base.xcconfig',
           'mac_bundle_resources' : [
@@ -258,6 +254,15 @@
             'android_system.gyp:SampleAppAndroid',
           ],
         }],
+        [ 'skia_gpu == 1', {
+          'include_dirs': [
+            '../src/gpu', # To pull gl/GrGLUtil.h
+          ],
+          'dependencies': [
+            'gpu.gyp:gr',
+            'gpu.gyp:skgr',
+          ],
+        }],
       ],
       'msvs_settings': {
         'VCLinkerTool': {
diff --git a/gyp/bench.gyp b/gyp/bench.gyp
index dcf9b5f..44ebbf2 100644
--- a/gyp/bench.gyp
+++ b/gyp/bench.gyp
@@ -10,7 +10,6 @@
       'type': 'executable',
       'include_dirs' : [
         '../src/core',
-        '../src/gpu',
       ],
       'includes': [
         'bench.gypi'
@@ -18,13 +17,24 @@
       'dependencies': [
         'core.gyp:core',
         'effects.gyp:effects',
-        'gpu.gyp:gr',
-        'gpu.gyp:skgr',
         'images.gyp:images',
         'ports.gyp:ports',
         'utils.gyp:utils',
         'bench_timer',
       ],
+      'conditions': [
+        ['skia_gpu == 1',
+          {
+            'include_dirs' : [
+              '../src/gpu',
+            ],
+            'dependencies': [
+              'gpu.gyp:gr',
+              'gpu.gyp:skgr',
+            ],
+          },
+        ],
+      ],
     },
     {
       'target_name' : 'bench_timer',
@@ -38,8 +48,6 @@
         '../bench/BenchSysTimer_posix.cpp',
         '../bench/BenchSysTimer_windows.h',
         '../bench/BenchSysTimer_windows.cpp',
-        '../bench/BenchGpuTimer_gl.h',
-        '../bench/BenchGpuTimer_gl.cpp',
       ],
         'include_dirs': [
         '../src/core',
@@ -47,7 +55,6 @@
       ],
       'dependencies': [
         'core.gyp:core',
-        'gpu.gyp:gr',
       ],
       'conditions': [
         [ 'skia_os != "mac"', {
@@ -75,6 +82,15 @@
             '../bench/BenchSysTimer_windows.cpp',
           ],
         }],
+        ['skia_gpu == 1', {
+          'dependencies': [
+            'gpu.gyp:gr',
+          ],
+          'sources': [
+            '../bench/BenchGpuTimer_gl.h',
+            '../bench/BenchGpuTimer_gl.cpp',
+          ],
+        }],
       ],
     }
   ],
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index 6dcfd81..143e854 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -2,7 +2,17 @@
 #
 {
   'conditions' : [
-
+    ['skia_gpu == 1',
+      {
+        'defines': [
+          'SK_SUPPORT_GPU=1',
+        ],
+      }, {
+        'defines': [
+          'SK_SUPPORT_GPU=0',
+        ],
+      },
+    ],
     ['skia_os == "win"',
       {
         'defines': [
diff --git a/gyp/common_variables.gypi b/gyp/common_variables.gypi
index 88e710e..d46ec5e 100644
--- a/gyp/common_variables.gypi
+++ b/gyp/common_variables.gypi
@@ -67,6 +67,7 @@
       'skia_arch_type%': 'x86',
       'skia_arch_width%': 32,
       'android_make_apk%': 1,
+      'skia_gpu%': 1,
     },
 
     # Re-define all variables defined within the level-2 'variables' dict,
@@ -80,6 +81,7 @@
     'skia_arch_type%': '<(skia_arch_type)',
     'skia_arch_width%': '<(skia_arch_width)',
     'android_make_apk%': '<(android_make_apk)',
+    'skia_gpu%': '<(skia_gpu)',
   },
 }
 # Local Variables:
diff --git a/gyp/debugger.gyp b/gyp/debugger.gyp
index 34ff403..f2c3fe9 100644
--- a/gyp/debugger.gyp
+++ b/gyp/debugger.gyp
@@ -7,7 +7,6 @@
         '../src/core',
         '../debugger', # To pull SkDebugger.h
         '../debugger/QT', # For all the QT UI Goodies
-        '../include/gpu/',
         '../src/gpu', # To pull gl/GrGLUtil.h
       ],
       'sources': [
diff --git a/gyp/effects.gyp b/gyp/effects.gyp
index 28369ae..0a9e8d7 100644
--- a/gyp/effects.gyp
+++ b/gyp/effects.gyp
@@ -5,7 +5,6 @@
       'type': 'static_library',
       'include_dirs': [
         '../include/effects',
-        '../src/gpu',
       ],
       'sources': [
         '../include/effects/Sk1DPathEffect.h',
@@ -98,7 +97,16 @@
       },
       'dependencies': [
         'core.gyp:core',
-        'gpu.gyp:gr',
+      ],
+      'conditions': [
+        ['skia_gpu == 1', {
+          'include_dirs': [
+            '../src/gpu',
+          ],
+          'dependencies': [
+            'gpu.gyp:gr',
+          ],
+        }],
       ],
     },
   ],
diff --git a/gyp/gm.gyp b/gyp/gm.gyp
index 20fe09e..13f1976 100644
--- a/gyp/gm.gyp
+++ b/gyp/gm.gyp
@@ -10,7 +10,6 @@
       'include_dirs' : [
         '../src/core',
         '../src/pipe/utils/',
-        '../src/gpu',
       ],
       'includes': [
         'gmslides.gypi',
@@ -25,8 +24,6 @@
       'dependencies': [
         'core.gyp:core',
         'effects.gyp:effects',
-        'gpu.gyp:gr',
-        'gpu.gyp:skgr',
         'images.gyp:images',
         'pdf.gyp:pdf',
         'ports.gyp:ports',
@@ -52,7 +49,16 @@
             'xps.gyp:xps',
           ],
         }],
-      ],  
+        ['skia_gpu == 1', {
+          'include_dirs': [
+            '../src/gpu',
+          ],
+          'dependencies': [
+            'gpu.gyp:gr',
+            'gpu.gyp:skgr',
+          ],
+        }],
+      ],
     },
   ],
 }
diff --git a/gyp/gpu.gyp b/gyp/gpu.gyp
index 6a2445d..c9526ef 100644
--- a/gyp/gpu.gyp
+++ b/gyp/gpu.gyp
@@ -46,6 +46,31 @@
           'GR_WIN32_BUILD=1',
         ],
       }],
+      # nullify the targets in this gyp file if skia_gpu is 0
+      [ 'skia_gpu == 0', {
+        'sources/': [
+          ['exclude', '.*'],
+        ],
+        'defines/': [
+          ['exclude', '.*'],
+        ],
+        'include_dirs/': [
+           ['exclude', '.*'],
+        ],
+        'link_settings': {
+          'libraries/': [
+            ['exclude', '.*'],
+          ],
+        },
+        'direct_dependent_settings': {
+          'defines/': [
+            ['exclude', '.*'],
+          ],
+          'include_dirs/': [
+            ['exclude', '.*'],
+          ],
+        },
+      }],
     ],
     'direct_dependent_settings': {
       'conditions': [
diff --git a/gyp/shapeops_demo.gyp b/gyp/shapeops_demo.gyp
index 038b282..cb1b743 100644
--- a/gyp/shapeops_demo.gyp
+++ b/gyp/shapeops_demo.gyp
@@ -61,8 +61,6 @@
         'xml.gyp:xml',
         'svg.gyp:svg',
         'experimental.gyp:experimental',
-        'gpu.gyp:gr',
-        'gpu.gyp:skgr',
         'pdf.gyp:pdf',
       ],
       'conditions' : [
@@ -96,6 +94,12 @@
             '../experimental/Intersection/EdgeDemoApp.xib',
           ],
         }],
+        [ 'skia_gpu == 1', {
+          'dependencies': [
+            'gpu.gyp:gr',
+            'gpu.gyp:skgr',
+          ],
+        }],
       ],
       'msvs_settings': {
         'VCLinkerTool': {
diff --git a/gyp/shapeops_edge.gyp b/gyp/shapeops_edge.gyp
index a862c5d..55ec5fd 100644
--- a/gyp/shapeops_edge.gyp
+++ b/gyp/shapeops_edge.gyp
@@ -10,7 +10,6 @@
       'type': 'executable',
       'include_dirs' : [
         '../src/core',
-        '../src/gpu',
       ],
       'sources': [
         '../experimental/Intersection/ActiveEdge_Test.cpp',
@@ -100,13 +99,22 @@
         'core.gyp:core',
         'effects.gyp:effects',
         'experimental.gyp:experimental',
-        'gpu.gyp:gr',
-        'gpu.gyp:skgr',
         'images.gyp:images',
         'ports.gyp:ports',
         'pdf.gyp:pdf',
         'utils.gyp:utils',
       ],
+      'conditions': [
+        [ 'skia_gpu == 1', {
+          'include_dirs': [
+            '../src/gpu',
+          ],
+          'dependencies': [
+            'gpu.gyp:gr',
+            'gpu.gyp:skgr',
+          ],
+        }],
+      ],
     },
   ],
 }
diff --git a/gyp/tests.gyp b/gyp/tests.gyp
index b30a749..278dce7 100644
--- a/gyp/tests.gyp
+++ b/gyp/tests.gyp
@@ -10,7 +10,6 @@
       'include_dirs' : [
         '../src/core',
         '../src/effects',
-        '../src/gpu',
         '../src/pdf',
         '../src/utils',
         '../tools/',
@@ -96,14 +95,23 @@
         'core.gyp:core',
         'effects.gyp:effects',
         'experimental.gyp:experimental',
-        'gpu.gyp:gr',
-        'gpu.gyp:skgr',
         'images.gyp:images',
         'ports.gyp:ports',
         'pdf.gyp:pdf',
         'tools.gyp:picture_utils',
         'utils.gyp:utils',
       ],
+      'conditions': [
+        [ 'skia_gpu == 1', {
+          'include_dirs': [
+            '../src/gpu',
+          ],
+          'dependencies': [
+            'gpu.gyp:gr',
+            'gpu.gyp:skgr',
+          ],
+        }],
+      ],
     },
   ],
 }
diff --git a/gyp/views.gyp b/gyp/views.gyp
index fa0a29a..ec3fd79 100644
--- a/gyp/views.gyp
+++ b/gyp/views.gyp
@@ -18,7 +18,6 @@
         '../include/images',
         '../include/effects',
         '../include/views/unix',
-        '../include/gpu',
       ],
       'dependencies': [
         'angle.gyp:*',
@@ -112,6 +111,11 @@
             '../src/views/win/skia_win.cpp',
           ],
         }],
+        [ 'skia_gpu == 1', {
+          'include_dirs': [
+            '../include/gpu',
+          ],
+        }],
       ],
       'direct_dependent_settings': {
         'include_dirs': [