Refactor the bench and common gyp/gypi files to allow for building bench within
authorseanpaul@google.com <seanpaul@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 15 Sep 2011 14:24:33 +0000 (14:24 +0000)
committerseanpaul@google.com <seanpaul@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 15 Sep 2011 14:24:33 +0000 (14:24 +0000)
a chromium checkout (using chromium build configuration).

BUG=362
TEST=Build bench from within the chromium and skia source tree, ensured it built
     and ran successfully.
Review URL: http://codereview.appspot.com/5023042

git-svn-id: http://skia.googlecode.com/svn/trunk@2270 2bbb7eff-a529-9590-31e7-b0007b416f81

gyp/bench.gyp
gyp/bench.gypi [new file with mode: 0644]
gyp/common.gypi
gyp/common_conditions.gypi [new file with mode: 0644]
gyp/common_variables.gypi [new file with mode: 0644]

index bae46f8d60acd6cf8ca47cf2077fadf52b685d63..73472a57a0ebe91764d834eb13add374627221bf 100644 (file)
@@ -9,36 +9,8 @@
     {
       'target_name': 'bench',
       'type': 'executable',
-      'sources': [
-        '../bench/benchmain.cpp',
-        '../bench/BenchTimer.h',
-        '../bench/BenchTimer.cpp',
-        '../bench/BenchSysTimer_mach.h',
-        '../bench/BenchSysTimer_mach.cpp',
-        '../bench/BenchSysTimer_posix.h',
-        '../bench/BenchSysTimer_posix.cpp',
-        '../bench/BenchSysTimer_windows.h',
-        '../bench/BenchSysTimer_windows.cpp',
-        '../bench/BenchGpuTimer_gl.h',
-        '../bench/BenchGpuTimer_gl.cpp',
-        '../bench/BenchGpuTimer_none.h',
-        '../bench/BenchGpuTimer_none.cpp',
-        
-        '../bench/SkBenchmark.h',
-        '../bench/SkBenchmark.cpp',
-        
-        '../bench/BitmapBench.cpp',
-        '../bench/BlurBench.cpp',
-        '../bench/DecodeBench.cpp',
-        '../bench/FPSBench.cpp',
-        '../bench/GradientBench.cpp',
-        '../bench/MathBench.cpp',
-        '../bench/MatrixBench.cpp',
-        '../bench/PathBench.cpp',
-        '../bench/RectBench.cpp',
-        '../bench/RepeatTileBench.cpp',
-        '../bench/ScalarBench.cpp',
-        '../bench/TextBench.cpp',
+      'includes': [
+       'bench.gypi'
       ],
       'dependencies': [
         'core.gyp:core',
         'images.gyp:images',
         'utils.gyp:utils',
       ],
-      'conditions': [
-        [ 'skia_os != "mac"', {
-          'sources!': [
-            '../bench/BenchSysTimer_mach.h',
-            '../bench/BenchSysTimer_mach.cpp',
-          ],
-        }],
-        [ 'skia_os not in ["linux", "freebsd", "openbsd", "solaris"]', {
-          'sources!': [
-            '../bench/BenchSysTimer_posix.h',
-            '../bench/BenchSysTimer_posix.cpp',
-          ],
-        },{
-          'link_settings': {
-            'libraries': [
-              '-lrt',
-            ],
-          },
-        }],
-        [ 'skia_os != "win"', {
-          'sources!': [
-            '../bench/BenchSysTimer_windows.h',
-            '../bench/BenchSysTimer_windows.cpp',
-          ],
-        }],
-        [ 'skia_os in ["win", "mac", "linux", "freebsd", "openbsd", "solaris"]', {
-          'sources!': [
-            '../bench/BenchGpuTimer_none.h',
-            '../bench/BenchGpuTimer_none.cpp',
-          ],
-        },{
-          'sources!': [
-            '../bench/BenchGpuTimer_gl.h',
-            '../bench/BenchGpuTimer_gl.cpp',
-          ],
-        }],
-      ],
     },
   ],
 }
diff --git a/gyp/bench.gypi b/gyp/bench.gypi
new file mode 100644 (file)
index 0000000..e84b6ba
--- /dev/null
@@ -0,0 +1,78 @@
+# sources and conditions used in skia's bench.gyp and chromium's skia.gyp
+#
+{
+  'sources': [
+    '../bench/benchmain.cpp',
+    '../bench/BenchTimer.h',
+    '../bench/BenchTimer.cpp',
+    '../bench/BenchSysTimer_mach.h',
+    '../bench/BenchSysTimer_mach.cpp',
+    '../bench/BenchSysTimer_posix.h',
+    '../bench/BenchSysTimer_posix.cpp',
+    '../bench/BenchSysTimer_windows.h',
+    '../bench/BenchSysTimer_windows.cpp',
+    '../bench/BenchGpuTimer_gl.h',
+    '../bench/BenchGpuTimer_gl.cpp',
+    '../bench/BenchGpuTimer_none.h',
+    '../bench/BenchGpuTimer_none.cpp',
+
+    '../bench/SkBenchmark.h',
+    '../bench/SkBenchmark.cpp',
+
+    '../bench/BitmapBench.cpp',
+    '../bench/BlurBench.cpp',
+    '../bench/DecodeBench.cpp',
+    '../bench/FPSBench.cpp',
+    '../bench/GradientBench.cpp',
+    '../bench/MathBench.cpp',
+    '../bench/MatrixBench.cpp',
+    '../bench/PathBench.cpp',
+    '../bench/RectBench.cpp',
+    '../bench/RepeatTileBench.cpp',
+    '../bench/ScalarBench.cpp',
+    '../bench/TextBench.cpp',
+  ],
+  'conditions': [
+    [ 'skia_os != "mac"', {
+      'sources!': [
+        '../bench/BenchSysTimer_mach.h',
+        '../bench/BenchSysTimer_mach.cpp',
+      ],
+    }],
+    [ 'skia_os not in ["linux", "freebsd", "openbsd", "solaris"]', {
+      'sources!': [
+        '../bench/BenchSysTimer_posix.h',
+        '../bench/BenchSysTimer_posix.cpp',
+      ],
+    },{
+      'link_settings': {
+        'libraries': [
+          '-lrt',
+        ],
+      },
+    }],
+    [ 'skia_os != "win"', {
+      'sources!': [
+        '../bench/BenchSysTimer_windows.h',
+        '../bench/BenchSysTimer_windows.cpp',
+      ],
+    }],
+    [ 'skia_os in ["win", "mac", "linux", "freebsd", "openbsd", "solaris"]', {
+      'sources!': [
+        '../bench/BenchGpuTimer_none.h',
+        '../bench/BenchGpuTimer_none.cpp',
+      ],
+    },{
+      'sources!': [
+        '../bench/BenchGpuTimer_gl.h',
+        '../bench/BenchGpuTimer_gl.cpp',
+      ],
+    }],
+  ],
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
index 64d54ba6ca76f556833be57375c97bb9fb6f8250..51d68e877800da793b7fd0bd1f370df34573bbaf 100644 (file)
@@ -3,18 +3,9 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 {
-  # Define all variables, allowing for override in GYP_DEFINES.
-  #
-  # One such variable is 'skia_os', which we use instead of 'OS' throughout
-  # our gyp files.  We set it automatically based on 'OS', but allow the
-  # user to override it via GYP_DEFINES if they like.
-  'variables': {
-    'skia_scalar%': 'float',
-    'skia_os%': '<(OS)',
-  },
-  'skia_scalar%': '<(skia_scalar)',
-  'skia_os': '<(skia_os)',
-
+  'includes': [
+    'common_variables.gypi',
+  ],
   'target_defaults': {
 
     # Validate the 'skia_os' setting against 'OS', because only certain
           {'error': '<!(Cannot build with skia_os=<(skia_os) on OS=<(OS))'}],
       ],
     },
-
+    'includes': [
+      'common_conditions.gypi'
+    ],
+    '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
+          ],
+        }
+      ],
+    ],
     'configurations': {
       'Debug': {
         'defines': [
         ],
       },
     },
-
-    '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
-          ],
-        }
-      ],
-
-      ['skia_os == "win"',
-        {
-          'defines': [
-            'SK_BUILD_FOR_WIN32',
-            'SK_IGNORE_STDINT_DOT_H',
-          ],
-          'msvs_cygwin_shell': 0,
-          'msvs_settings': {
-            'VCCLCompilerTool': {
-              'WarningLevel': '1',
-              'WarnAsError': 'false',
-              'DebugInformationFormat': '3',
-              'AdditionalOptions': ['/MP',],
-            },
-            'VCLinkerTool': {
-              'AdditionalDependencies': [
-                'OpenGL32.lib',
-                'usp10.lib',
-              ],
-            },
-          },
-          'configurations': {
-            'Debug': {
-              'msvs_settings': {
-                'VCCLCompilerTool': {
-                  'DebugInformationFormat': '1', # debugOldStyleInfo (/Z7)
-                  'Optimization': '0',           # optimizeDisabled (/Od)
-                  'PreprocessorDefinitions': ['_DEBUG'],
-                  'RuntimeLibrary': '3',         # rtMultiThreadedDebugDLL (/MDd)
-                },
-                'VCLinkerTool': {
-                  'GenerateDebugInformation': 'true',
-                },
-              },
-            },
-            'Release': {
-              'msvs_settings': {
-                'VCCLCompilerTool': {
-                  'DebugInformationFormat': '0', # debugDisabled
-                  'Optimization': '2',           # optimizeMaxSpeed (/O2)
-                  'PreprocessorDefinitions': ['NDEBUG'],
-                  'RuntimeLibrary': '2',         # rtMultiThreadedDLL (/MD)
-                },
-                'VCLinkerTool': {
-                  'GenerateDebugInformation': 'false',
-                },
-              },
-            },
-          },
-        },
-      ],
-
-      ['skia_os in ["linux", "freebsd", "openbsd", "solaris"]',
-        {
-          'defines': [
-            'SK_SAMPLES_FOR_X',
-            'SK_BUILD_FOR_UNIX',
-          ],
-          'configurations': {
-            'Debug': {
-              'cflags': ['-g']
-            },
-            'Release': {
-              'cflags': ['-O2']
-            },
-          },
-          'cflags': [ '-Wall', '-Wextra', '-Wno-unused' ],
-          'include_dirs' : [
-            '/usr/include/freetype2',
-          ],
-        },
-      ],
-
-      ['skia_os == "mac"', 
-        {
-          'defines': [
-            'SK_BUILD_FOR_MAC',
-          ],
-          'configurations': {
-            'Debug': {
-              'xcode_settings': {
-                'GCC_OPTIMIZATION_LEVEL': '0',
-              },
-            },
-          },
-          'xcode_settings': {
-            'SYMROOT': '<(DEPTH)/xcodebuild',
-          },
-        },
-      ],
-
-      ['skia_os == "ios"', 
-        {
-          'defines': [
-            'SK_BUILD_FOR_IOS',
-          ],
-          'configurations': {
-            'Debug': {
-              'xcode_settings': {
-                'GCC_OPTIMIZATION_LEVEL': '0',
-              },
-            },
-          },
-          'xcode_settings': {
-            'SYMROOT': '<(DEPTH)/xcodebuild',
-          },
-        },
-      ],
-
-    ], # end 'conditions'
   }, # end 'target_defaults'
 }
 # Local Variables:
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
new file mode 100644 (file)
index 0000000..2a49556
--- /dev/null
@@ -0,0 +1,122 @@
+# conditions used in both common.gypi and skia.gyp in chromium
+#
+{
+  'conditions' : [
+
+    ['skia_os == "win"',
+      {
+        'defines': [
+          'SK_BUILD_FOR_WIN32',
+          'SK_IGNORE_STDINT_DOT_H',
+        ],
+        'msvs_cygwin_shell': 0,
+        'msvs_settings': {
+          'VCCLCompilerTool': {
+            'WarningLevel': '1',
+            'WarnAsError': 'false',
+            'DebugInformationFormat': '3',
+            'AdditionalOptions': '/MP',
+          },
+          'VCLinkerTool': {
+            'AdditionalDependencies': [
+              'OpenGL32.lib',
+              'usp10.lib',
+            ],
+          },
+        },
+        'configurations': {
+          'Debug': {
+            'msvs_settings': {
+              'VCCLCompilerTool': {
+                'DebugInformationFormat': '1', # debugOldStyleInfo (/Z7)
+                'Optimization': '0',           # optimizeDisabled (/Od)
+                'PreprocessorDefinitions': ['_DEBUG'],
+                'RuntimeLibrary': '3',         # rtMultiThreadedDebugDLL (/MDd)
+              },
+              'VCLinkerTool': {
+                'GenerateDebugInformation': 'true',
+              },
+            },
+          },
+          'Release': {
+            'msvs_settings': {
+              'VCCLCompilerTool': {
+                'DebugInformationFormat': '0', # debugDisabled
+                'Optimization': '2',           # optimizeMaxSpeed (/O2)
+                'PreprocessorDefinitions': ['NDEBUG'],
+                'RuntimeLibrary': '2',         # rtMultiThreadedDLL (/MD)
+              },
+              'VCLinkerTool': {
+                'GenerateDebugInformation': 'false',
+              },
+            },
+          },
+        },
+      },
+    ],
+
+    ['skia_os in ["linux", "freebsd", "openbsd", "solaris"]',
+      {
+        'defines': [
+          'SK_SAMPLES_FOR_X',
+          'SK_BUILD_FOR_UNIX',
+        ],
+        'configurations': {
+          'Debug': {
+            'cflags': ['-g']
+          },
+          'Release': {
+            'cflags': ['-O2']
+          },
+        },
+        'cflags': [ '-Wall', '-Wextra', '-Wno-unused' ],
+        'include_dirs' : [
+          '/usr/include/freetype2',
+        ],
+      },
+    ],
+
+    ['skia_os == "mac"', 
+      {
+        'defines': [
+          'SK_BUILD_FOR_MAC',
+        ],
+        'configurations': {
+          'Debug': {
+            'xcode_settings': {
+              'GCC_OPTIMIZATION_LEVEL': '0',
+            },
+          },
+        },
+        'xcode_settings': {
+          'SYMROOT': '<(DEPTH)/xcodebuild',
+        },
+      },
+    ],
+
+    ['skia_os == "ios"', 
+      {
+        'defines': [
+          'SK_BUILD_FOR_IOS',
+        ],
+        'configurations': {
+          'Debug': {
+            'xcode_settings': {
+              'GCC_OPTIMIZATION_LEVEL': '0',
+            },
+          },
+        },
+        'xcode_settings': {
+          'SYMROOT': '<(DEPTH)/xcodebuild',
+        },
+      },
+    ],
+
+  ], # end 'conditions'
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/gyp/common_variables.gypi b/gyp/common_variables.gypi
new file mode 100644 (file)
index 0000000..5c27cc3
--- /dev/null
@@ -0,0 +1,21 @@
+# variables used in both common.gypi and skia.gyp in chromium
+#
+{
+  # Define all variables, allowing for override in GYP_DEFINES.
+  #
+  # One such variable is 'skia_os', which we use instead of 'OS' throughout
+  # our gyp files.  We set it automatically based on 'OS', but allow the
+  # user to override it via GYP_DEFINES if they like.
+  'variables': {
+    'skia_scalar%': 'float',
+    'skia_os%': '<(OS)',
+  },
+  'skia_scalar%': '<(skia_scalar)',
+  'skia_os': '<(skia_os)',
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2: