combine target_defaults.gypi into common.gypi
http://codereview.appspot.com/4654080



git-svn-id: http://skia.googlecode.com/svn/trunk@1780 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gyp/CocoaDebuggerApp.gyp b/gyp/CocoaDebuggerApp.gyp
index 904563c..1960a67 100644
--- a/gyp/CocoaDebuggerApp.gyp
+++ b/gyp/CocoaDebuggerApp.gyp
@@ -1,6 +1,6 @@
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/FileReaderApp.gyp b/gyp/FileReaderApp.gyp
index 2ada993..2db992f 100644
--- a/gyp/FileReaderApp.gyp
+++ b/gyp/FileReaderApp.gyp
@@ -1,6 +1,6 @@
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/SampleApp.gyp b/gyp/SampleApp.gyp
index 50baa62..4e01526 100644
--- a/gyp/SampleApp.gyp
+++ b/gyp/SampleApp.gyp
@@ -1,6 +1,6 @@
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
@@ -158,9 +158,7 @@
         'VCLinkerTool': {
           'SubSystem': '2',
           'AdditionalDependencies': [
-              'OpenGL32.lib',
-              'usp10.lib',
-              'd3d9.lib',
+            'd3d9.lib',
           ],
         },
       },
diff --git a/gyp/SimpleCocoaApp.gyp b/gyp/SimpleCocoaApp.gyp
index 68caa05..9f415e4 100644
--- a/gyp/SimpleCocoaApp.gyp
+++ b/gyp/SimpleCocoaApp.gyp
@@ -1,6 +1,6 @@
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/animator.gyp b/gyp/animator.gyp
index d0d54aa..fc61e71 100644
--- a/gyp/animator.gyp
+++ b/gyp/animator.gyp
@@ -1,6 +1,6 @@
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/apptype_console.gypi b/gyp/apptype_console.gypi
index b686fa7..8980ce8 100644
--- a/gyp/apptype_console.gypi
+++ b/gyp/apptype_console.gypi
@@ -10,11 +10,6 @@
 
         #Console app, use main/wmain
         'EntryPointSymbol': 'mainCRTStartup',
-
-        'AdditionalDependencies': [
-          'OpenGL32.lib',
-          'usp10.lib',
-        ],
       },
     },
   },
diff --git a/gyp/bench.gyp b/gyp/bench.gyp
index d5a4fcf..11f0461 100644
--- a/gyp/bench.gyp
+++ b/gyp/bench.gyp
@@ -9,7 +9,7 @@
 {
   'includes': [
     'apptype_console.gypi',
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/common.gypi b/gyp/common.gypi
index 78482a0..d1f23d5 100644
--- a/gyp/common.gypi
+++ b/gyp/common.gypi
@@ -12,10 +12,51 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 {
-  'conditions' : [
-    ['OS == "win"',
-      {
-        'target_defaults': {
+  'target_defaults': {
+
+    # Define variables, and allow for override in GYP_DEFINES environment var.
+    'variables': {
+      'skia_scalar%': 'float',
+    },
+    'skia_scalar%': '<(skia_scalar)',
+
+    'configurations': {
+      'Debug': {
+        'defines': [
+          'SK_DEBUG',
+          'GR_DEBUG=1',
+        ],
+      },
+      'Release': {
+        'defines': [
+          'SK_RELEASE',
+          'GR_RELEASE=1',
+        ],
+      },
+    },
+
+    'conditions' : [
+
+      [ 'skia_scalar == "float"',
+        {
+          'defines': [
+            'SK_SCALAR_IS_FLOAT',
+            'SK_CAN_USE_FLOAT',
+          ],
+        }, { # else, skia_scalar != "float"
+          'defines': [
+            'SK_SCALAR_IS_FIXED',
+            'SK_CAN_USE_FLOAT',  # we can still use floats along the way
+          ],
+        }
+      ],
+
+      ['OS == "win"',
+        {
+          'defines': [
+            'SK_BUILD_FOR_WIN32',
+            'SK_IGNORE_STDINT_DOT_H',
+          ],
           'msvs_cygwin_shell': 0,
           'msvs_settings': {
             'VCCLCompilerTool': {
@@ -24,6 +65,12 @@
               'DebugInformationFormat': '3',
               'AdditionalOptions': '/MP',
             },
+            'VCLinkerTool': {
+              'AdditionalDependencies': [
+                'OpenGL32.lib',
+                'usp10.lib',
+              ],
+            },
           },
           'configurations': {
             'Debug': {
@@ -52,11 +99,14 @@
             },
           },
         },
-      },
-    ],
-    ['OS == "linux"', 
-      {
-        'target_defaults': {
+      ],
+
+      ['OS == "linux" or OS == "freebsd" or OS == "openbsd" or OS == "solaris"', 
+        {
+          'defines': [
+            'SK_SAMPLES_FOR_X',
+            'SK_BUILD_FOR_UNIX',
+          ],
           'configurations': {
             'Debug': {
               'cflags': ['-g']
@@ -65,13 +115,18 @@
               'cflags': ['-O2']
             },
           },
-          'cflags': [ '-Wall', '-Wextra', '-Wno-unused' ]
+          'cflags': [ '-Wall', '-Wextra', '-Wno-unused' ],
+          'include_dirs' : [
+            '/usr/include/freetype2',
+          ],
         },
-      },
-    ],
-    ['OS == "mac"', 
-      {
-        'target_defaults': {
+      ],
+
+      ['OS == "mac"', 
+        {
+          'defines': [
+            'SK_BUILD_FOR_MAC',
+          ],
           'configurations': {
             'Debug': {
               'cflags': ['-g']
@@ -80,13 +135,14 @@
               'cflags': ['-O2']
             },
           },
+          'xcode_settings': {
+            'SYMROOT': '<(DEPTH)/xcodebuild',
+          },
         },
-        'xcode_settings': {
-          'SYMROOT': '<(DEPTH)/xcodebuild',
-        },
-      },
-    ],
-  ],
+      ],
+
+    ], # end 'conditions'
+  }, # end 'target_defaults'
 }
 # Local Variables:
 # tab-width:2
diff --git a/gyp/core.gyp b/gyp/core.gyp
index aa4877e..34d05c3 100644
--- a/gyp/core.gyp
+++ b/gyp/core.gyp
@@ -1,7 +1,7 @@
 # Core Skia library code.
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/effects.gyp b/gyp/effects.gyp
index b6c253f..3b67838 100644
--- a/gyp/effects.gyp
+++ b/gyp/effects.gyp
@@ -1,6 +1,6 @@
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/experimental.gyp b/gyp/experimental.gyp
index 171f4c8..c5b8c5e 100644
--- a/gyp/experimental.gyp
+++ b/gyp/experimental.gyp
@@ -1,6 +1,6 @@
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/gm.gyp b/gyp/gm.gyp
index 2d66891..1219995 100644
--- a/gyp/gm.gyp
+++ b/gyp/gm.gyp
@@ -2,7 +2,7 @@
 {
   'includes': [
     'apptype_console.gypi',
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/gpu.gyp b/gyp/gpu.gyp
index dc157c5..787e0fc 100644
--- a/gyp/gpu.gyp
+++ b/gyp/gpu.gyp
@@ -1,6 +1,6 @@
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/images.gyp b/gyp/images.gyp
index 3608375..9627d3f 100644
--- a/gyp/images.gyp
+++ b/gyp/images.gyp
@@ -1,6 +1,6 @@
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/libtess.gyp b/gyp/libtess.gyp
index 6ea27d8..4a776c3 100644
--- a/gyp/libtess.gyp
+++ b/gyp/libtess.gyp
@@ -1,6 +1,6 @@
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/opts.gyp b/gyp/opts.gyp
index a93bf44..42fb8ae 100644
--- a/gyp/opts.gyp
+++ b/gyp/opts.gyp
@@ -1,6 +1,6 @@
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     # Due to an unfortunate intersection of lameness between gcc and gyp,
diff --git a/gyp/pdf.gyp b/gyp/pdf.gyp
index eb1dea0..3957e48 100644
--- a/gyp/pdf.gyp
+++ b/gyp/pdf.gyp
@@ -1,6 +1,6 @@
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/svg.gyp b/gyp/svg.gyp
index 273ddec..c72b99f 100644
--- a/gyp/svg.gyp
+++ b/gyp/svg.gyp
@@ -1,6 +1,6 @@
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/target_defaults.gypi b/gyp/target_defaults.gypi
deleted file mode 100644
index 865f8a3..0000000
--- a/gyp/target_defaults.gypi
+++ /dev/null
@@ -1,95 +0,0 @@
-{
-  'target_defaults': {
-    'defines': [
-      'SK_CAN_USE_FLOAT',
-    ],
-
-    'variables': {
-      'skia_scalar%': 'float',
-    },
-    # Allow override in GYP_DEFINES environment variable.
-    'skia_scalar%': '<(skia_scalar)',
-
-    'configurations': {
-      'Debug': {
-        'defines': [
-          'SK_DEBUG',
-          'GR_DEBUG=1',
-        ],
-        'msvs_settings': {
-           'VCLinkerTool': {
-             'GenerateDebugInformation': 'true',
-           },
-           'VCCLCompilerTool': {
-             #0 Disabled (/Od)
-             #1 Minimize Size (/O1)
-             #2 Maximize Speed (/O2)
-             #3 Full Optimization (/Ox)
-             'Optimization': '0',
-           },
-         },
-      },
-      'Release': {
-        'defines': [
-          'SK_RELEASE',
-          'GR_RELEASE=1',
-        ],
-      },
-    },
-    'conditions': [
-      [ 'skia_scalar == "float"',
-        {
-          'defines': [
-            'SK_SCALAR_IS_FLOAT',
-          ],
-        }, { # else, skia_scalar != "float"
-          'defines': [
-            'SK_SCALAR_IS_FIXED',
-          ],
-        }
-      ],
-      [ 'OS == "linux" or OS == "freebsd" or OS == "openbsd" or OS == "solaris"', {
-        'include_dirs' : [
-          '/usr/include/freetype2',
-        ],
-      }],
-      [ 'OS == "mac"', {
-        'defines': [
-          'SK_BUILD_FOR_MAC',
-        ],
-      }],
-      [ 'OS == "win"', {
-        'defines': [
-          'SK_BUILD_FOR_WIN32',
-          'SK_IGNORE_STDINT_DOT_H',
-        ],
-      }],
-      [ 'OS == "linux"', {
-        'defines': [
-          'SK_SAMPLES_FOR_X',
-          'SK_BUILD_FOR_UNIX',
-        ],
-      }],
-    ],
-    'direct_dependent_settings': {
-      'conditions': [
-        [ 'OS == "mac"', {
-          'defines': [
-            'SK_BUILD_FOR_MAC',
-          ],
-        }],
-        [ 'OS == "win"', {
-          'defines': [
-            'SK_BUILD_FOR_WIN32',
-          ],
-        }],
-      ],
-    },
-  },
-}
-
-# Local Variables:
-# tab-width:2
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/gyp/tests.gyp b/gyp/tests.gyp
index d78a65a..d4cafd2 100644
--- a/gyp/tests.gyp
+++ b/gyp/tests.gyp
@@ -2,7 +2,7 @@
 {
   'includes': [
     'apptype_console.gypi',
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/tools.gyp b/gyp/tools.gyp
index 939b32a..e0c04b4 100644
--- a/gyp/tools.gyp
+++ b/gyp/tools.gyp
@@ -8,7 +8,7 @@
 {
   'includes': [
     'apptype_console.gypi',
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/utils.gyp b/gyp/utils.gyp
index f0dcda9..950f803 100644
--- a/gyp/utils.gyp
+++ b/gyp/utils.gyp
@@ -1,6 +1,6 @@
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/views.gyp b/gyp/views.gyp
index 6ba42bf..4afa2af 100644
--- a/gyp/views.gyp
+++ b/gyp/views.gyp
@@ -1,6 +1,6 @@
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/xml.gyp b/gyp/xml.gyp
index 8e825ad..464a2a5 100644
--- a/gyp/xml.gyp
+++ b/gyp/xml.gyp
@@ -1,6 +1,6 @@
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/zlib.gyp b/gyp/zlib.gyp
index d47a13e..44a8d2a 100644
--- a/gyp/zlib.gyp
+++ b/gyp/zlib.gyp
@@ -1,6 +1,6 @@
 {
   'includes': [
-    'target_defaults.gypi',
+    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp_skia b/gyp_skia
index 6a28773..ee8c17c 100755
--- a/gyp_skia
+++ b/gyp_skia
@@ -53,9 +53,6 @@
     if os.path.realpath(path) not in specified_includes:
       result.append(path)
 
-  # Always include common.gypi
-  AddInclude(os.path.join(gyp_config_dir, 'common.gypi'))
-
   return result
 
 if __name__ == '__main__':