1# conditions used in both common.gypi and skia.gyp in chromium
2#
3{
4  'conditions' : [
5
6    ['skia_os == "win"',
7      {
8        'defines': [
9          'SK_BUILD_FOR_WIN32',
10          'SK_IGNORE_STDINT_DOT_H',
11          '_CRT_SECURE_NO_WARNINGS',
12        ],
13        'msvs_cygwin_shell': 0,
14        'msvs_settings': {
15          'VCCLCompilerTool': {
16            'WarningLevel': '1',
17            'WarnAsError': 'false',
18            'DebugInformationFormat': '3',
19            'AdditionalOptions': [ '/MP' ],
20          },
21          'VCLinkerTool': {
22            'AdditionalDependencies': [
23              'OpenGL32.lib',
24              'usp10.lib',
25            ],
26          },
27        },
28        'configurations': {
29          'Debug': {
30            'msvs_settings': {
31              'VCCLCompilerTool': {
32                'DebugInformationFormat': '4', # editAndContiue (/ZI)
33                'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
34                'Optimization': '0',           # optimizeDisabled (/Od)
35                'PreprocessorDefinitions': ['_DEBUG'],
36                'RuntimeLibrary': '3',         # rtMultiThreadedDebugDLL (/MDd)
37                'ExceptionHandling': '0',
38                'RuntimeTypeInfo': 'false',      # /GR-
39                'WarningLevel': '3',             # level3 (/W3)
40              },
41              'VCLinkerTool': {
42                'GenerateDebugInformation': 'true', # /DEBUG
43                'LinkIncremental': '2',             # /INCREMENTAL
44              },
45            },
46          },
47          'Release': {
48            'msvs_settings': {
49              'VCCLCompilerTool': {
50                'DebugInformationFormat': '3',   # programDatabase (/Zi)
51                'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
52                'Optimization': '3',             # full (/Ox)
53                'WholeProgramOptimization': 'true', #/GL
54               # Changing the floating point model requires rebaseling gm images
55               #'FloatingPointModel': '2',       # fast (/fp:fast)
56                'FavorSizeOrSpeed': '1',         # speed (/Ot)
57                'PreprocessorDefinitions': ['NDEBUG'],
58                'RuntimeLibrary': '2',           # rtMultiThreadedDLL (/MD)
59                'ExceptionHandling': '0',
60                'RuntimeTypeInfo': 'false',      # /GR-
61                'WarningLevel': '3',             # level3 (/W3)
62              },
63              'VCLinkerTool': {
64                'GenerateDebugInformation': 'true', # /DEBUG
65                'LinkTimeCodeGeneration': '1',      # useLinkTimeCodeGeneration /LTCG
66              },
67              'VCLibrarianTool': {
68                'LinkTimeCodeGeneration': 'true',   # useLinkTimeCodeGeneration /LTCG
69              },
70            },
71          },
72        },
73      },
74    ],
75
76    ['skia_os in ["linux", "freebsd", "openbsd", "solaris"]',
77      {
78        'defines': [
79          'SK_SAMPLES_FOR_X',
80          'SK_BUILD_FOR_UNIX',
81          'SK_USE_COLOR_LUMINANCE',
82          'SK_GAMMA_APPLY_TO_A8',
83        ],
84        'configurations': {
85          'Debug': {
86            'cflags': ['-g']
87          },
88          'Release': {
89            'cflags': ['-O2'],
90            'defines': [ 'NDEBUG' ],
91          },
92        },
93        'cflags': [
94          # TODO(tony): Enable -Werror once all the strict-aliasing problems
95          # are fixed.
96          #'-Werror',
97          '-Wall',
98          '-Wextra',
99          '-Wno-unused',
100          # suppressions below here were added for clang
101          '-Wno-unused-parameter',
102          '-Wno-c++11-extensions'
103        ],
104        'include_dirs' : [
105          '/usr/include/freetype2',
106        ],
107      },
108    ],
109
110    ['skia_os == "mac"', 
111      {
112        'defines': [
113          'SK_BUILD_FOR_MAC',
114        ],
115        'configurations': {
116          'Debug': {
117            'xcode_settings': {
118              'GCC_OPTIMIZATION_LEVEL': '0',
119            },
120          },
121          'Release': {
122            'xcode_settings': {
123              'GCC_OPTIMIZATION_LEVEL': '3',
124            },
125            'defines': [ 'NDEBUG' ],
126          },
127        },
128        'xcode_settings': {
129          'SYMROOT': '<(DEPTH)/xcodebuild',
130          'SDKROOT': 'macosx10.6',
131# trying to get this to work, but it needs clang I think...
132#          'WARNING_CFLAGS': '-Wexit-time-destructors',
133          'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
134        },
135      },
136    ],
137
138    ['skia_os == "ios"', 
139      {
140        'defines': [
141          'SK_BUILD_FOR_IOS',
142        ],
143        'configurations': {
144          'Debug': {
145            'xcode_settings': {
146              'GCC_OPTIMIZATION_LEVEL': '0',
147            },
148          },
149        },
150        'xcode_settings': {
151          'SYMROOT': '<(DEPTH)/xcodebuild',
152        },
153      },
154    ],
155    
156    ['skia_os == "android"', 
157      {
158        'defines': [
159          'SK_BUILD_FOR_ANDROID',
160          'SK_BUILD_FOR_ANDROID_NDK',
161          'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0',
162        ],
163        'configurations': {
164          'Debug': {
165            'cflags': ['-g']
166          },
167          'Release': {
168            'cflags': ['-O2'],
169            'defines': [ 'NDEBUG' ],
170          },
171        },
172        'libraries': [
173          '-lstdc++',
174          '-lm',
175          '-llog',
176        ],
177        'cflags': [
178          '-fno-exceptions',
179          '-fno-rtti',
180        ],
181        'conditions': [
182          [ 'skia_target_arch == "arm"', {
183            'ldflags': [
184              '-Wl',
185              '--fix-cortex-a8',
186            ],
187          }],
188          [ 'skia_target_arch == "arm" and arm_thumb == 1', {
189            'cflags': [
190              '-mthumb',
191            ],
192          }],
193          [ 'skia_target_arch == "arm" and armv7 == 1', {
194            'defines': [
195              '__ARM_ARCH__=7',
196            ],
197            'cflags': [
198              '-march=armv7-a',
199              '-mfloat-abi=softfp',
200            ],
201            'conditions': [
202              [ 'arm_neon == 1', {
203                'defines': [
204                  '__ARM_HAVE_NEON',
205                ],
206                'cflags': [
207                  '-mfpu=neon',
208                ],
209             }],
210            ],
211         }],
212        ], 
213      },
214    ],
215
216    # We can POD-style initialization of static mutexes to avoid generating
217    # static initializers if we're using a pthread-compatible thread interface.
218    [ 'skia_os != "win"', {
219      'defines': [
220        'SK_USE_POSIX_THREADS'
221      ],
222    }],
223
224  ], # end 'conditions'
225}
226
227# Local Variables:
228# tab-width:2
229# indent-tabs-mode:nil
230# End:
231# vim: set expandtab tabstop=2 shiftwidth=2:
232