common_conditions.gypi 10.9 KB
Newer Older
1 2 3
# conditions used in both common.gypi and skia.gyp in chromium
#
{
chudy@google.com's avatar
chudy@google.com committed
4 5
  'defines': [
    'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=<(skia_static_initializers)',
6
#    'SK_SUPPORT_HINTING_SCALE_FACTOR',
chudy@google.com's avatar
chudy@google.com committed
7
  ],
8
  'conditions' : [
9
    [ 'skia_gpu == 1',
10 11 12 13 14 15 16 17 18 19
      {
        'defines': [
          'SK_SUPPORT_GPU=1',
        ],
      }, {
        'defines': [
          'SK_SUPPORT_GPU=0',
        ],
      },
    ],
20
    [ 'skia_os == "win"',
21 22 23 24
      {
        'defines': [
          'SK_BUILD_FOR_WIN32',
          'SK_IGNORE_STDINT_DOT_H',
25
          '_CRT_SECURE_NO_WARNINGS',
26
          'GR_GL_FUNCTION_TYPE=__stdcall',
27 28 29 30
        ],
        'msvs_cygwin_shell': 0,
        'msvs_settings': {
          'VCCLCompilerTool': {
31 32
            'WarningLevel': '3',
            'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
33
            'DebugInformationFormat': '3',
34 35
            'ExceptionHandling': '0',
            'AdditionalOptions': [ '/MP', ],
36 37 38 39 40 41 42 43 44 45 46 47
          },
          'VCLinkerTool': {
            'AdditionalDependencies': [
              'OpenGL32.lib',
              'usp10.lib',
            ],
          },
        },
        'configurations': {
          'Debug': {
            'msvs_settings': {
              'VCCLCompilerTool': {
48
                'DebugInformationFormat': '4', # editAndContiue (/ZI)
49 50 51
                'Optimization': '0',           # optimizeDisabled (/Od)
                'PreprocessorDefinitions': ['_DEBUG'],
                'RuntimeLibrary': '3',         # rtMultiThreadedDebugDLL (/MDd)
52
                'RuntimeTypeInfo': 'false',      # /GR-
53 54
              },
              'VCLinkerTool': {
55 56
                'GenerateDebugInformation': 'true', # /DEBUG
                'LinkIncremental': '2',             # /INCREMENTAL
57 58 59 60 61 62
              },
            },
          },
          'Release': {
            'msvs_settings': {
              'VCCLCompilerTool': {
63 64
                'DebugInformationFormat': '3',      # programDatabase (/Zi)
                'Optimization': '3',                # full (/Ox)
65
#'WholeProgramOptimization': 'true', #/GL
66
               # Changing the floating point model requires rebaseling gm images
67 68
               #'FloatingPointModel': '2',          # fast (/fp:fast)
                'FavorSizeOrSpeed': '1',            # speed (/Ot)
69
                'PreprocessorDefinitions': ['NDEBUG'],
70 71 72
                'RuntimeLibrary': '2',              # rtMultiThreadedDLL (/MD)
                'EnableEnhancedInstructionSet': '2',# /arch:SSE2
                'RuntimeTypeInfo': 'false',         # /GR-
73 74
              },
              'VCLinkerTool': {
75
                'GenerateDebugInformation': 'true', # /DEBUG
76
#'LinkTimeCodeGeneration': '1',      # useLinkTimeCodeGeneration /LTCG
77
              },
78
              'VCLibrarianTool': {
79
#                'LinkTimeCodeGeneration': 'true',   # useLinkTimeCodeGeneration /LTCG
80
              },
81 82 83
            },
          },
        },
84
        'conditions' : [
85
          [ 'skia_arch_width == 64', {
86
            'msvs_configuration_platform': 'x64',
87 88 89 90 91
          }],
          [ 'skia_arch_width == 32', {
            'msvs_configuration_platform': 'Win32',
          }],
          [ 'skia_warnings_as_errors', {
92 93
            'msvs_settings': {
              'VCCLCompilerTool': {
94 95 96 97
                'WarnAsError': 'true',
                'AdditionalOptions': [
                  '/we4189', # initialized but unused var warning
                ],
98 99
              },
            },
100 101
          }],
        ],
102 103 104
      },
    ],

105
    [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl"]',
106 107 108 109 110 111 112 113 114 115
      {
        'defines': [
          'SK_SAMPLES_FOR_X',
          'SK_BUILD_FOR_UNIX',
        ],
        'configurations': {
          'Debug': {
            'cflags': ['-g']
          },
          'Release': {
bungeman@google.com's avatar
bungeman@google.com committed
116
            'cflags': ['-O3 -g'],
117
            'defines': [ 'NDEBUG' ],
118 119
          },
        },
120
        'cflags': [
bsalomon@google.com's avatar
bsalomon@google.com committed
121 122 123 124 125 126
          '-Wall',
          '-Wextra',
          # suppressions below here were added for clang
          '-Wno-unused-parameter',
          '-Wno-c++11-extensions'
        ],
127
        'conditions' : [
128
          [ 'skia_warnings_as_errors', {
129 130 131 132
            'cflags': [
              '-Werror',
            ],
          }],
133
          [ 'skia_arch_width == 64', {
134 135 136 137 138 139 140
            'cflags': [
              '-m64',
            ],
            'ldflags': [
              '-m64',
            ],
          }],
141
          [ 'skia_arch_width == 32', {
142 143 144 145 146 147 148
            'cflags': [
              '-m32',
            ],
            'ldflags': [
              '-m32',
            ],
          }],
borenet@google.com's avatar
borenet@google.com committed
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
          [ 'skia_os == "nacl"', {
            'defines': [
              'SK_BUILD_FOR_NACL',
            ],
            'link_settings': {
              'libraries': [
                '-lppapi',
                '-lppapi_cpp',
                '-lnosys',
                '-pthread',
              ],
            },
          }, { # skia_os != "nacl"
            'include_dirs' : [
              '/usr/include/freetype2',
            ],
          }],
166 167 168 169
        ],
      },
    ],

170
    [ 'skia_os == "mac"',
171
      {
172 173 174
        'variables': {
          'mac_sdk%': '<!(python <(DEPTH)/tools/find_mac_sdk.py 10.6)',
        },
175 176 177
        'defines': [
          'SK_BUILD_FOR_MAC',
        ],
178
        'conditions' : [
179
          [ 'skia_arch_width == 64', {
180 181 182 183
            'xcode_settings': {
              'ARCHS': 'x86_64',
            },
          }],
184
          [ 'skia_arch_width == 32', {
185 186
            'xcode_settings': {
              'ARCHS': 'i386',
187 188 189 190
            },
          }],
          [ 'skia_warnings_as_errors', {
            'xcode_settings': {
humper@google.com's avatar
humper@google.com committed
191 192 193
              'OTHER_CPLUSPLUSFLAGS': [
                '-Werror',
              ],
194 195 196
            },
          }],
        ],
197 198 199 200 201 202
        'configurations': {
          'Debug': {
            'xcode_settings': {
              'GCC_OPTIMIZATION_LEVEL': '0',
            },
          },
203 204 205 206
          'Release': {
            'xcode_settings': {
              'GCC_OPTIMIZATION_LEVEL': '3',
            },
207
            'defines': [ 'NDEBUG' ],
208
          },
209 210
        },
        'xcode_settings': {
211
          'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO',
212
          'conditions': [
213
            [ 'skia_osx_sdkroot==""', {
214 215 216 217 218
              'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot
            }, {
              'SDKROOT': '<(skia_osx_sdkroot)',  # -isysroot
            }],
           ],
219 220
# trying to get this to work, but it needs clang I think...
#          'WARNING_CFLAGS': '-Wexit-time-destructors',
221
          'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
          'GCC_WARN_64_TO_32_BIT_CONVERSION': 'YES',
          'GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS': 'YES',
          'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'YES',
          'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',
          'GCC_WARN_ABOUT_MISSING_PROTOTYPES': 'YES',
          'GCC_WARN_ABOUT_POINTER_SIGNEDNESS': 'YES',
          'GCC_WARN_ABOUT_RETURN_TYPE': 'YES',
          'GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL': 'YES',
          'GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED': 'YES',
          'GCC_WARN_MISSING_PARENTHESES': 'YES',
          'GCC_WARN_PROTOTYPE_CONVERSION': 'YES',
          'GCC_WARN_SIGN_COMPARE': 'YES',
          'GCC_WARN_TYPECHECK_CALLS_TO_PRINTF': 'YES',
          'GCC_WARN_UNKNOWN_PRAGMAS': 'YES',
          'GCC_WARN_UNUSED_FUNCTION': 'YES',
          'GCC_WARN_UNUSED_LABEL': 'YES',
          'GCC_WARN_UNUSED_VALUE': 'YES',
          'GCC_WARN_UNUSED_VARIABLE': 'YES',
240 241 242 243 244
          'OTHER_CPLUSPLUSFLAGS': [
            '-mssse3',
            '-fvisibility=hidden',
            '-fvisibility-inlines-hidden',
          ],
245 246 247 248
        },
      },
    ],

249
    [ 'skia_os == "ios"',
250 251 252 253
      {
        'defines': [
          'SK_BUILD_FOR_IOS',
        ],
254 255 256 257 258 259 260 261 262
        'conditions' : [
          [ 'skia_warnings_as_errors', {
            'xcode_settings': {
              'OTHER_CPLUSPLUSFLAGS': [
                '-Werror',
              ],
            },
          }],
        ],
263 264 265 266 267 268
        'configurations': {
          'Debug': {
            'xcode_settings': {
              'GCC_OPTIMIZATION_LEVEL': '0',
            },
          },
269 270 271 272 273 274
          'Release': {
            'xcode_settings': {
              'GCC_OPTIMIZATION_LEVEL': '3',
            },
            'defines': [ 'NDEBUG' ],
          },
275 276
        },
        'xcode_settings': {
277
          'ARCHS': 'armv6 armv7',
278 279
          'CODE_SIGNING_REQUIRED': 'NO',
          'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
280
          'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
281
          'SDKROOT': 'iphoneos',
282
          'TARGETED_DEVICE_FAMILY': '1,2',
283 284 285 286
          'OTHER_CPLUSPLUSFLAGS': [
            '-fvisibility=hidden',
            '-fvisibility-inlines-hidden',
          ],
287
          'GCC_THUMB_SUPPORT': 'NO',
288 289 290
        },
      },
    ],
chudy@google.com's avatar
chudy@google.com committed
291

292
    [ 'skia_os == "android"',
293 294 295 296 297 298 299 300 301
      {
        'defines': [
          'SK_BUILD_FOR_ANDROID',
        ],
        'configurations': {
          'Debug': {
            'cflags': ['-g']
          },
          'Release': {
djsollen@google.com's avatar
djsollen@google.com committed
302
            'cflags': ['-O2'],
303
            'defines': [ 'NDEBUG' ],
304 305 306 307 308
          },
        },
        'libraries': [
          '-lstdc++',
          '-lm',
309
          '-llog',
310
        ],
311
        'cflags': [
312
          '-Wall',
313 314
          '-fno-exceptions',
          '-fno-rtti',
315
          '-fstrict-aliasing',
316
          '-fuse-ld=gold',
317
        ],
318
        'conditions': [
319
          [ 'skia_warnings_as_errors', {
320 321 322 323
            'cflags': [
              '-Werror',
            ],
          }],
324 325 326
          [ 'skia_profile_enabled == 1', {
            'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
          }],
327
          [ 'skia_arch_type == "arm" and arm_thumb == 1', {
328 329 330 331
            'cflags': [
              '-mthumb',
            ],
          }],
332
          [ 'skia_arch_type == "arm" and armv7 == 1', {
333 334 335
            'variables': {
              'arm_neon_optional%': 0,
            },
336 337 338 339 340
            'defines': [
              '__ARM_ARCH__=7',
            ],
            'cflags': [
              '-march=armv7-a',
341
              '-mfloat-abi=softfp',
342 343 344 345 346 347 348 349 350
            ],
            'conditions': [
              [ 'arm_neon == 1', {
                'defines': [
                  '__ARM_HAVE_NEON',
                ],
                'cflags': [
                  '-mfpu=neon',
                ],
351 352 353 354
                'ldflags': [
                  '-march=armv7-a',
                  '-Wl,--fix-cortex-a8',
                ],
355 356 357 358 359 360
              }],
              [ 'arm_neon_optional == 1', {
                'defines': [
                  '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
                ],
              }],
361 362
            ],
         }],
chudy@google.com's avatar
chudy@google.com committed
363
        ],
364 365
      },
    ],
366

367 368 369 370
    # We can POD-style initialization of static mutexes to avoid generating
    # static initializers if we're using a pthread-compatible thread interface.
    [ 'skia_os != "win"', {
      'defines': [
borenet@google.com's avatar
borenet@google.com committed
371
        'SK_USE_POSIX_THREADS',
372 373
      ],
    }],
374
  ], # end 'conditions'
375 376 377 378
  # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
  'xcode_settings': {
    'SYMROOT': '<(DEPTH)/xcodebuild',
  },
379 380 381 382 383 384 385
}

# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2: