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

    ['skia_os in ["linux", "freebsd", "openbsd", "solaris"]',
      {
        'defines': [
          'SK_SAMPLES_FOR_X',
          'SK_BUILD_FOR_UNIX',
        ],
        'configurations': {
          'Debug': {
            'cflags': ['-g']
          },
          'Release': {
bungeman@google.com's avatar
bungeman@google.com committed
99
            'cflags': ['-O3 -g'],
100
            'defines': [ 'NDEBUG' ],
101 102
          },
        },
103 104 105 106
        'cflags': [
          # TODO(tony): Enable -Werror once all the strict-aliasing problems
          # are fixed.
          #'-Werror',
bsalomon@google.com's avatar
bsalomon@google.com committed
107 108 109 110 111 112 113
          '-Wall',
          '-Wextra',
          '-Wno-unused',
          # suppressions below here were added for clang
          '-Wno-unused-parameter',
          '-Wno-c++11-extensions'
        ],
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
        'conditions' : [
          ['skia_arch_width == 64', {
            'cflags': [
              '-m64',
            ],
            'ldflags': [
              '-m64',
            ],
          }],
          ['skia_arch_width == 32', {
            'cflags': [
              '-m32',
            ],
            'ldflags': [
              '-m32',
            ],
          }],
        ],
132 133 134 135 136 137 138 139 140 141 142
        'include_dirs' : [
          '/usr/include/freetype2',
        ],
      },
    ],

    ['skia_os == "mac"', 
      {
        'defines': [
          'SK_BUILD_FOR_MAC',
        ],
143 144 145 146 147 148 149 150 151 152 153 154
        'conditions' : [
          ['skia_arch_width == 64', {
            'xcode_settings': {
              'ARCHS': 'x86_64',
            },
          }],
          ['skia_arch_width == 32', {
            'xcode_settings': {
              'ARCHS': 'i386',
            },
          }],
        ],
155 156 157 158 159 160
        'configurations': {
          'Debug': {
            'xcode_settings': {
              'GCC_OPTIMIZATION_LEVEL': '0',
            },
          },
161 162 163 164
          'Release': {
            'xcode_settings': {
              'GCC_OPTIMIZATION_LEVEL': '3',
            },
165
            'defines': [ 'NDEBUG' ],
166
          },
167 168
        },
        'xcode_settings': {
169
          'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO',
170
          'SYMROOT': '<(DEPTH)/xcodebuild',
171
          'SDKROOT': 'macosx10.6',
172 173
# trying to get this to work, but it needs clang I think...
#          'WARNING_CFLAGS': '-Wexit-time-destructors',
174
          'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
          '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',
caryclark@google.com's avatar
caryclark@google.com committed
193
          'OTHER_CPLUSPLUSFLAGS': '-mssse3 -fvisibility=hidden -fvisibility-inlines-hidden',
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
        },
      },
    ],

    ['skia_os == "ios"', 
      {
        'defines': [
          'SK_BUILD_FOR_IOS',
        ],
        'configurations': {
          'Debug': {
            'xcode_settings': {
              'GCC_OPTIMIZATION_LEVEL': '0',
            },
          },
        },
        'xcode_settings': {
          'SYMROOT': '<(DEPTH)/xcodebuild',
        },
      },
    ],
215 216 217 218 219 220
    
    ['skia_os == "android"', 
      {
        'defines': [
          'SK_BUILD_FOR_ANDROID',
          'SK_BUILD_FOR_ANDROID_NDK',
221
          'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0',
222 223 224 225 226 227
        ],
        'configurations': {
          'Debug': {
            'cflags': ['-g']
          },
          'Release': {
228 229
            'cflags': ['-O2'],
            'defines': [ 'NDEBUG' ],
230 231 232 233 234
          },
        },
        'libraries': [
          '-lstdc++',
          '-lm',
235
          '-llog',
236
        ],
237 238 239
        'cflags': [
          '-fno-exceptions',
          '-fno-rtti',
240 241 242 243 244 245 246 247 248
          '-fuse-ld=gold',
          '--sysroot=<(android_base)/toolchains/<(android_toolchain)/sysroot',
        ],
        'include_dirs' : [
          '<(android_base)/toolchains/<(android_toolchain)/lib/gcc/arm-linux-androideabi/4.6.x-google/include',
          '<(android_base)/toolchains/<(android_toolchain)/lib/gcc/arm-linux-androideabi/4.6.x-google/include-fixed',
          '<(android_base)/toolchains/<(android_toolchain)/arm-linux-androideabi/include/c++/4.6',
          '<(android_base)/toolchains/<(android_toolchain)/arm-linux-androideabi/include/c++/4.6/arm-linux-androideabi',
          '<(android_base)/toolchains/<(android_toolchain)/sysroot/usr/include',
249
        ],
250
        'conditions': [
251
          [ 'skia_arch_type == "arm"', {
252 253 254 255
            'ldflags': [
              '-Wl',
            ],
          }],
256
          [ 'skia_arch_type == "arm" and arm_thumb == 1', {
257 258 259 260
            'cflags': [
              '-mthumb',
            ],
          }],
261
          [ 'skia_arch_type == "arm" and armv7 == 1', {
262 263 264
            'variables': {
              'arm_neon_optional%': 0,
            },
265 266 267 268 269
            'defines': [
              '__ARM_ARCH__=7',
            ],
            'cflags': [
              '-march=armv7-a',
270
              '-mfloat-abi=softfp',
271 272 273 274 275 276 277 278 279
            ],
            'conditions': [
              [ 'arm_neon == 1', {
                'defines': [
                  '__ARM_HAVE_NEON',
                ],
                'cflags': [
                  '-mfpu=neon',
                ],
280 281 282 283 284 285
              }],
              [ 'arm_neon_optional == 1', {
                'defines': [
                  '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
                ],
              }],
286 287 288 289 290
            ],
         }],
        ], 
      },
    ],
291

292 293 294 295 296 297 298 299
    # 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': [
        'SK_USE_POSIX_THREADS'
      ],
    }],

300 301 302 303 304 305 306 307
  ], # end 'conditions'
}

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