common.gypi 4.71 KB
Newer Older
1
# Copyright 2011 The Android Open Source Project
2
#
3 4
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
5
{
6 7 8 9 10 11 12 13 14 15 16 17
  # 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)',

18 19
  'target_defaults': {

20 21 22
    # Validate the 'skia_os' setting against 'OS', because only certain
    # combinations work.  You should only override 'skia_os' for certain
    # situations, like building for iOS on a Mac.
23
    'variables': {
24 25 26 27
      'conditions': [
        ['skia_os != OS and not (skia_os == "ios" and OS == "mac")',
          {'error': '<!(Cannot build with skia_os=<(skia_os) on OS=<(OS))'}],
      ],
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
    },

    '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
          ],
        }
      ],

61
      ['skia_os == "win"',
62 63 64 65 66
        {
          'defines': [
            'SK_BUILD_FOR_WIN32',
            'SK_IGNORE_STDINT_DOT_H',
          ],
67 68 69 70 71 72 73 74
          'msvs_cygwin_shell': 0,
          'msvs_settings': {
            'VCCLCompilerTool': {
              'WarningLevel': '1',
              'WarnAsError': 'false',
              'DebugInformationFormat': '3',
              'AdditionalOptions': '/MP',
            },
75 76 77 78 79 80
            'VCLinkerTool': {
              'AdditionalDependencies': [
                'OpenGL32.lib',
                'usp10.lib',
              ],
            },
81 82 83 84 85
          },
          'configurations': {
            'Debug': {
              'msvs_settings': {
                'VCCLCompilerTool': {
86 87
                  'DebugInformationFormat': '1', # debugOldStyleInfo (/Z7)
                  'Optimization': '0',           # optimizeDisabled (/Od)
88
                  'PreprocessorDefinitions': ['_DEBUG'],
89
                  'RuntimeLibrary': '3',         # rtMultiThreadedDebugDLL (/MDd)
90 91 92 93 94 95 96 97 98
                },
                'VCLinkerTool': {
                  'GenerateDebugInformation': 'true',
                },
              },
            },
            'Release': {
              'msvs_settings': {
                'VCCLCompilerTool': {
99 100
                  'DebugInformationFormat': '0', # debugDisabled
                  'Optimization': '2',           # optimizeMaxSpeed (/O2)
101
                  'PreprocessorDefinitions': ['NDEBUG'],
102
                  'RuntimeLibrary': '2',         # rtMultiThreadedDLL (/MD)
103 104 105 106 107 108 109 110
                },
                'VCLinkerTool': {
                  'GenerateDebugInformation': 'false',
                },
              },
            },
          },
        },
111 112
      ],

113
      ['skia_os in ["linux", "freebsd", "openbsd", "solaris"]',
114 115 116 117 118
        {
          'defines': [
            'SK_SAMPLES_FOR_X',
            'SK_BUILD_FOR_UNIX',
          ],
119 120 121 122 123 124 125 126
          'configurations': {
            'Debug': {
              'cflags': ['-g']
            },
            'Release': {
              'cflags': ['-O2']
            },
          },
127 128 129 130
          'cflags': [ '-Wall', '-Wextra', '-Wno-unused' ],
          'include_dirs' : [
            '/usr/include/freetype2',
          ],
131
        },
132 133
      ],

134
      ['skia_os == "mac"', 
135 136 137 138
        {
          'defines': [
            'SK_BUILD_FOR_MAC',
          ],
139 140 141 142 143 144 145 146
          'configurations': {
            'Debug': {
              'cflags': ['-g']
            },
            'Release': {
              'cflags': ['-O2']
            },
          },
147 148 149
          'xcode_settings': {
            'SYMROOT': '<(DEPTH)/xcodebuild',
          },
150
        },
151 152
      ],

153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
      ['skia_os == "ios"', 
        {
          'defines': [
            'SK_BUILD_FOR_IOS',
          ],
          'configurations': {
            'Debug': {
              'cflags': ['-g']
            },
            'Release': {
              'cflags': ['-O2']
            },
          },
          'xcode_settings': {
            'SYMROOT': '<(DEPTH)/xcodebuild',
          },
        },
      ],

172 173
    ], # end 'conditions'
  }, # end 'target_defaults'
174 175 176 177 178 179
}
# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2: