common_conditions.gypi 11.7 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
          },
          'VCLinkerTool': {
            'AdditionalDependencies': [
              'OpenGL32.lib',
              'usp10.lib',
41 42 43 44 45 46 47 48 49 50 51 52 53 54

              # Prior to gyp r1584, the following were included automatically.
              'kernel32.lib',
              'gdi32.lib',
              'winspool.lib',
              'comdlg32.lib',
              'advapi32.lib',
              'shell32.lib',
              'ole32.lib',
              'oleaut32.lib',
              'user32.lib',
              'uuid.lib',
              'odbc32.lib',
              'odbccp32.lib',
55 56 57 58 59 60 61
            ],
          },
        },
        'configurations': {
          'Debug': {
            'msvs_settings': {
              'VCCLCompilerTool': {
62
                'DebugInformationFormat': '4', # editAndContiue (/ZI)
63 64 65
                'Optimization': '0',           # optimizeDisabled (/Od)
                'PreprocessorDefinitions': ['_DEBUG'],
                'RuntimeLibrary': '3',         # rtMultiThreadedDebugDLL (/MDd)
66
                'RuntimeTypeInfo': 'false',      # /GR-
67 68
              },
              'VCLinkerTool': {
69 70
                'GenerateDebugInformation': 'true', # /DEBUG
                'LinkIncremental': '2',             # /INCREMENTAL
71 72 73 74 75 76
              },
            },
          },
          'Release': {
            'msvs_settings': {
              'VCCLCompilerTool': {
77 78
                'DebugInformationFormat': '3',      # programDatabase (/Zi)
                'Optimization': '3',                # full (/Ox)
79
                'WholeProgramOptimization': 'true', #/GL
80
               # Changing the floating point model requires rebaseling gm images
81 82
               #'FloatingPointModel': '2',          # fast (/fp:fast)
                'FavorSizeOrSpeed': '1',            # speed (/Ot)
83
                'PreprocessorDefinitions': ['NDEBUG'],
84 85 86
                'RuntimeLibrary': '2',              # rtMultiThreadedDLL (/MD)
                'EnableEnhancedInstructionSet': '2',# /arch:SSE2
                'RuntimeTypeInfo': 'false',         # /GR-
87 88
              },
              'VCLinkerTool': {
89
                'GenerateDebugInformation': 'true', # /DEBUG
90
                'LinkTimeCodeGeneration': '1',      # useLinkTimeCodeGeneration /LTCG
91
              },
92
              'VCLibrarianTool': {
93
                'LinkTimeCodeGeneration': 'true',   # useLinkTimeCodeGeneration /LTCG
94
              },
95 96 97
            },
          },
        },
98
        'conditions' : [
99
          [ 'skia_arch_width == 64', {
100
            'msvs_configuration_platform': 'x64',
101 102 103 104 105
          }],
          [ 'skia_arch_width == 32', {
            'msvs_configuration_platform': 'Win32',
          }],
          [ 'skia_warnings_as_errors', {
106 107
            'msvs_settings': {
              'VCCLCompilerTool': {
108 109 110 111
                'WarnAsError': 'true',
                'AdditionalOptions': [
                  '/we4189', # initialized but unused var warning
                ],
112 113
              },
            },
114 115
          }],
        ],
116 117 118
      },
    ],

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

184
    [ 'skia_os == "mac"',
185
      {
186 187 188
        'variables': {
          'mac_sdk%': '<!(python <(DEPTH)/tools/find_mac_sdk.py 10.6)',
        },
189 190 191
        'defines': [
          'SK_BUILD_FOR_MAC',
        ],
192
        'conditions' : [
193
          [ 'skia_arch_width == 64', {
194
            'xcode_settings': {
195
              'ARCHS': ['x86_64'],
196 197
            },
          }],
198
          [ 'skia_arch_width == 32', {
199
            'xcode_settings': {
200
              'ARCHS': ['i386'],
201 202 203 204
            },
          }],
          [ 'skia_warnings_as_errors', {
            'xcode_settings': {
humper@google.com's avatar
humper@google.com committed
205 206 207
              'OTHER_CPLUSPLUSFLAGS': [
                '-Werror',
              ],
208 209 210
            },
          }],
        ],
211 212 213 214 215 216
        'configurations': {
          'Debug': {
            'xcode_settings': {
              'GCC_OPTIMIZATION_LEVEL': '0',
            },
          },
217 218 219 220
          'Release': {
            'xcode_settings': {
              'GCC_OPTIMIZATION_LEVEL': '3',
            },
221
            'defines': [ 'NDEBUG' ],
222
          },
223 224
        },
        'xcode_settings': {
225
          'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO',
226
          'conditions': [
227
            [ 'skia_osx_sdkroot==""', {
228 229 230 231 232
              'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot
            }, {
              'SDKROOT': '<(skia_osx_sdkroot)',  # -isysroot
            }],
           ],
233 234
# trying to get this to work, but it needs clang I think...
#          'WARNING_CFLAGS': '-Wexit-time-destructors',
235
          'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
          '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',
254 255 256 257 258
          'OTHER_CPLUSPLUSFLAGS': [
            '-mssse3',
            '-fvisibility=hidden',
            '-fvisibility-inlines-hidden',
          ],
259 260 261 262
        },
      },
    ],

263
    [ 'skia_os == "ios"',
264 265 266 267
      {
        'defines': [
          'SK_BUILD_FOR_IOS',
        ],
268 269 270 271 272 273 274 275 276
        'conditions' : [
          [ 'skia_warnings_as_errors', {
            'xcode_settings': {
              'OTHER_CPLUSPLUSFLAGS': [
                '-Werror',
              ],
            },
          }],
        ],
277 278 279 280 281 282
        'configurations': {
          'Debug': {
            'xcode_settings': {
              'GCC_OPTIMIZATION_LEVEL': '0',
            },
          },
283 284 285 286 287 288
          'Release': {
            'xcode_settings': {
              'GCC_OPTIMIZATION_LEVEL': '3',
            },
            'defines': [ 'NDEBUG' ],
          },
289 290
        },
        'xcode_settings': {
291
          'ARCHS': ['armv6', 'armv7'],
292 293
          'CODE_SIGNING_REQUIRED': 'NO',
          'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
294
          'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
295
          'SDKROOT': 'iphoneos',
296
          'TARGETED_DEVICE_FAMILY': '1,2',
297 298 299 300
          'OTHER_CPLUSPLUSFLAGS': [
            '-fvisibility=hidden',
            '-fvisibility-inlines-hidden',
          ],
301
          'GCC_THUMB_SUPPORT': 'NO',
302 303 304
        },
      },
    ],
chudy@google.com's avatar
chudy@google.com committed
305

306
    [ 'skia_os == "android"',
307 308 309 310 311 312 313 314 315
      {
        'defines': [
          'SK_BUILD_FOR_ANDROID',
        ],
        'configurations': {
          'Debug': {
            'cflags': ['-g']
          },
          'Release': {
djsollen@google.com's avatar
djsollen@google.com committed
316
            'cflags': ['-O2'],
317
            'defines': [ 'NDEBUG' ],
318 319 320 321 322
          },
        },
        'libraries': [
          '-lstdc++',
          '-lm',
323
          '-llog',
324
        ],
325
        'cflags': [
326
          '-Wall',
327
          '-fno-exceptions',
328
          '-fstrict-aliasing',
329
          '-fuse-ld=gold',
330
        ],
331 332 333
        'cflags_cc': [
          '-fno-rtti',
        ],
334
        'conditions': [
335
          [ 'skia_warnings_as_errors', {
336 337 338 339
            'cflags': [
              '-Werror',
            ],
          }],
340 341 342
          [ 'skia_profile_enabled == 1', {
            'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
          }],
343 344 345 346 347 348 349 350 351 352 353
          [ 'skia_shared_lib', {
            'cflags': [
              '-fPIC',
            ],
            'defines': [
              'GR_DLL=1',
              'GR_IMPLEMENTATION=1',
              'SKIA_DLL',
              'SKIA_IMPLEMENTATION=1',
            ],
          }],
354
          [ 'skia_arch_type == "arm" and arm_thumb == 1', {
355 356 357 358
            'cflags': [
              '-mthumb',
            ],
          }],
359
          [ 'skia_arch_type == "arm" and armv7 == 1', {
360 361 362
            'variables': {
              'arm_neon_optional%': 0,
            },
363 364 365 366 367
            'defines': [
              '__ARM_ARCH__=7',
            ],
            'cflags': [
              '-march=armv7-a',
368
              '-mfloat-abi=softfp',
369 370 371 372 373 374 375 376 377
            ],
            'conditions': [
              [ 'arm_neon == 1', {
                'defines': [
                  '__ARM_HAVE_NEON',
                ],
                'cflags': [
                  '-mfpu=neon',
                ],
378 379 380 381
                'ldflags': [
                  '-march=armv7-a',
                  '-Wl,--fix-cortex-a8',
                ],
382 383 384 385 386 387
              }],
              [ 'arm_neon_optional == 1', {
                'defines': [
                  '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
                ],
              }],
388 389
            ],
         }],
chudy@google.com's avatar
chudy@google.com committed
390
        ],
391 392
      },
    ],
393

394 395 396 397
    # 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
398
        'SK_USE_POSIX_THREADS',
399 400
      ],
    }],
401
  ], # end 'conditions'
402 403 404 405
  # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
  'xcode_settings': {
    'SYMROOT': '<(DEPTH)/xcodebuild',
  },
406 407 408 409 410 411 412
}

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