[Chromium] ImageDiff should be build for host on Android
[WebKit-https.git] / Tools / DumpRenderTree / DumpRenderTree.gyp / DumpRenderTree.gyp
1 #
2 # Copyright (C) 2011 Google Inc. All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
6 # met:
7 #
8 #         * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 #         * Redistributions in binary form must reproduce the above
11 # copyright notice, this list of conditions and the following disclaimer
12 # in the documentation and/or other materials provided with the
13 # distribution.
14 #         * Neither the name of Google Inc. nor the names of its
15 # contributors may be used to endorse or promote products derived from
16 # this software without specific prior written permission.
17 #
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #
30
31 {
32     'variables': {
33         'ahem_path': '../../DumpRenderTree/qt/fonts/AHEM____.TTF',
34         'tools_dir': '../..',
35         'source_dir': '../../../Source',
36         'conditions': [
37             # Location of the chromium src directory and target type is different
38             # if webkit is built inside chromium or as standalone project.
39             ['inside_chromium_build==0', {
40                 # Webkit is being built outside of the full chromium project.
41                 # e.g. via build-webkit --chromium
42                 'chromium_src_dir': '<(source_dir)/WebKit/chromium',
43             },{
44                 # WebKit is checked out in src/chromium/third_party/WebKit
45                 'chromium_src_dir': '<(tools_dir)/../../..',
46             }],
47         ],
48     },
49     'includes': [
50         '../DumpRenderTree.gypi',
51         '../../../Source/WebKit/chromium/features.gypi',
52     ],
53     'targets': [
54         {
55             'target_name': 'ImageDiff',
56             'type': 'executable',
57             'dependencies': [
58                 '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support_gfx',
59                 '<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf',
60             ],
61             'include_dirs': [
62                 '<(source_dir)/JavaScriptCore',
63                 '<(DEPTH)',
64             ],
65             'sources': [
66                 '<(tools_dir)/DumpRenderTree/chromium/ImageDiff.cpp',
67             ],
68             'conditions': [
69                 ['OS=="android"', {
70                     # The Chromium Android port will compare images on host rather
71                     # than target (a device or emulator) for performance reasons.
72                     'toolsets': ['host'],
73                 }],
74             ],
75         },
76         {
77             'target_name': 'DumpRenderTree',
78             'type': 'executable',
79             'mac_bundle': 1,
80             'dependencies': [
81                 '<(source_dir)/WebKit/chromium/WebKit.gyp:inspector_resources',
82                 '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit',
83                 '<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf',
84                 '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl',
85                 '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc',
86                 '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8',
87                 '<(chromium_src_dir)/base/base.gyp:test_support_base',
88                 '<(chromium_src_dir)/webkit/support/webkit_support.gyp:blob',
89                 '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support',
90                 '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_user_agent',
91             ],
92             'include_dirs': [
93                 '<(chromium_src_dir)',
94                 '<(source_dir)/WebKit/chromium/public',
95                 '<(source_dir)/JavaScriptCore',
96                 '<(DEPTH)',
97             ],
98             'defines': [
99                 # Technically not a unit test but require functions available only to
100                 # unit tests.
101                 'UNIT_TEST',
102             ],
103             'sources': [
104                 '<@(drt_files)',
105             ],
106             'conditions': [
107                 ['OS=="win"', {
108                     'dependencies': [
109                         'LayoutTestHelper',
110                         '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:libEGL',
111                         '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:libGLESv2',
112                     ],
113
114                     'resource_include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/webkit'],
115                     'sources': [
116                         '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc',
117                         '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.rc',
118                         '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc',
119                         '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.rc',
120                     ],
121                     'conditions': [
122                         ['inside_chromium_build==1', {
123                             'configurations': {
124                                 'Debug_Base': {
125                                     'msvs_settings': {
126                                         'VCLinkerTool': {
127                                             'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
128                                         },
129                                     },
130                                 },
131                             },
132                         }],
133                     ],
134                     'copies': [{
135                         'destination': '<(PRODUCT_DIR)',
136                         'files': ['<(ahem_path)'],
137                     }],
138                 },{ # OS!="win"
139                     'sources/': [
140                         ['exclude', 'Win\\.cpp$'],
141                     ],
142                     'actions': [
143                         {
144                             'action_name': 'repack_locale',
145                             'variables': {
146                                 'repack_path': '<(chromium_src_dir)/tools/grit/grit/format/repack.py',
147                                 'pak_inputs': [
148                                     '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak',
149                                     '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.pak',
150                                     '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak',
151                                     '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.pak',
152                                     '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.pak',
153                             ]},
154                             'inputs': [
155                                 '<(repack_path)',
156                                 '<@(pak_inputs)',
157                             ],
158                             'outputs': [
159                                 '<(INTERMEDIATE_DIR)/repack/DumpRenderTree.pak',
160                             ],
161                             'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'],
162                             'process_outputs_as_mac_bundle_resources': 1,
163                         },
164                     ], # actions
165                 }],
166                 ['OS=="mac"', {
167                     'dependencies': [
168                         '<(source_dir)/WebKit/chromium/WebKit.gyp:copy_mesa',
169                         'LayoutTestHelper',
170                     ],
171                     'mac_bundle_resources': [
172                         '<(ahem_path)',
173                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf',
174                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf',
175                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf',
176                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher400.ttf',
177                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher500.ttf',
178                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher600.ttf',
179                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf',
180                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf',
181                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf',
182                         '<(SHARED_INTERMEDIATE_DIR)/webkit/textAreaResizeCorner.png',
183                     ],
184                 },{ # OS!="mac"
185                     'sources/': [
186                         # .mm is already excluded by common.gypi
187                         ['exclude', 'Mac\\.cpp$'],
188                     ],
189                 }],
190                 ['use_x11 == 1', {
191                     'dependencies': [
192                         '<(chromium_src_dir)/build/linux/system.gyp:fontconfig',
193                     ],
194                     'copies': [{
195                         'destination': '<(PRODUCT_DIR)',
196                         'files': [
197                             '<(ahem_path)',
198                             '<(tools_dir)/DumpRenderTree/chromium/fonts.conf',
199                             '<(INTERMEDIATE_DIR)/repack/DumpRenderTree.pak',
200                         ]
201                     }],
202                     'variables': {
203                         # FIXME: Enable warnings on other platforms.
204                         'chromium_code': 1,
205                     },
206                     'conditions': [
207                         ['linux_use_tcmalloc == 1', {
208                             'dependencies': [
209                                 '<(chromium_src_dir)/base/allocator/allocator.gyp:allocator',
210                             ],
211                         }],
212                     ],
213                 },{ # use_x11 != 1
214                     'sources/': [
215                         ['exclude', 'Linux\\.cpp$']
216                     ]
217                 }],
218                 ['toolkit_uses_gtk == 1', {
219                     'defines': [
220                         'WTF_USE_GTK=1',
221                     ],
222                     'dependencies': [
223                         '<(chromium_src_dir)/build/linux/system.gyp:gtk',
224                     ],
225                     'include_dirs': [
226                         '<(source_dir)/WebKit/chromium/public/gtk',
227                     ],
228                 },{ # toolkit_uses_gtk != 1
229                     'sources/': [
230                         ['exclude', 'Gtk\\.cpp$']
231                     ]
232                 }],
233                 ['OS=="android"', {
234                     'dependencies': [
235                         'ImageDiff#host',
236                     ],
237                     'sources/': [
238                         ['include', 'chromium/TestShellLinux\\.cpp$'],
239                     ],
240                 },{ # OS!="android"
241                     'sources/': [
242                         ['exclude', '(Android)\\.cpp$']
243                     ],
244                     'dependencies': [
245                         'ImageDiff',
246                         'copy_TestNetscapePlugIn',
247                         '<(chromium_src_dir)/third_party/mesa/mesa.gyp:osmesa',
248                     ],
249                 }],
250                 ['inside_chromium_build==1 and component=="shared_library"', {
251                     'sources': [
252                         '<(source_dir)/WebKit/chromium/src/ChromiumCurrentTime.cpp',
253                         '<(source_dir)/WebKit/chromium/src/ChromiumThreading.cpp',
254                     ],
255                     'include_dirs': [
256                         '<(source_dir)/WebKit/chromium/public',
257                     ],
258                     'dependencies': [
259                         '<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf',
260                     ],
261                 }],
262                 ['inside_chromium_build==0', {
263                     'dependencies': [
264                         '<(chromium_src_dir)/webkit/support/setup_third_party.gyp:third_party_headers',
265                     ]
266                 }],
267                 ['inside_chromium_build==0 or component!="shared_library"', {
268                     'dependencies': [
269                         '<(source_dir)/WebCore/WebCore.gyp/WebCore.gyp:webcore_test_support',
270                     ],
271                     'include_dirs': [
272                         # WARNING: Do not view this particular case as a precedent for
273                         # including WebCore headers in DumpRenderTree project.
274                         '<(source_dir)/WebCore/testing/v8', # for WebCoreTestSupport.h, needed to link in window.internals code.
275                     ],
276                     'sources': [
277                         '<(source_dir)/WebKit/chromium/src/WebTestingSupport.cpp',
278                         '<(source_dir)/WebKit/chromium/public/WebTestingSupport.h',
279                     ],
280                 }],
281             ],
282         },
283         {
284             'target_name': 'TestNetscapePlugIn',
285             'type': 'loadable_module',
286             'sources': [ '<@(test_plugin_files)' ],
287             'dependencies': [
288                 '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi',
289             ],
290             'include_dirs': [
291                 '<(chromium_src_dir)',
292                 '<(tools_dir)/DumpRenderTree/TestNetscapePlugIn',
293                 '<(tools_dir)/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders',
294             ],
295             'conditions': [
296                 ['OS=="mac"', {
297                     'mac_bundle': 1,
298                     'product_extension': 'plugin',
299                     'link_settings': {
300                         'libraries': [
301                             '$(SDKROOT)/System/Library/Frameworks/Carbon.framework',
302                             '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework',
303                             '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework',
304                         ]
305                     },
306                     'xcode_settings': {
307                         'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO',
308                         'INFOPLIST_FILE': '<(tools_dir)/DumpRenderTree/TestNetscapePlugIn/mac/Info.plist',
309                     },
310                 }],
311                 ['os_posix == 1 and OS != "mac"', {
312                     'cflags': [
313                         '-fvisibility=default',
314                     ],
315                 }],
316                 ['OS=="win"', {
317                     'defines': [
318                         # This seems like a hack, but this is what Safari Win does.
319                         'snprintf=_snprintf',
320                     ],
321                     'sources': [
322                         '<(tools_dir)/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.def',
323                         '<(tools_dir)/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc',
324                     ],
325                     # The .rc file requires that the name of the dll is npTestNetscapePlugIn.dll.
326                     'product_name': 'npTestNetscapePlugIn',
327                 }],
328             ],
329         },
330         {
331             'target_name': 'copy_TestNetscapePlugIn',
332             'type': 'none',
333             'dependencies': [
334                 'TestNetscapePlugIn',
335             ],
336             'conditions': [
337                 ['OS=="win"', {
338                     'copies': [{
339                         'destination': '<(PRODUCT_DIR)/plugins',
340                         'files': ['<(PRODUCT_DIR)/npTestNetscapePlugIn.dll'],
341                     }],
342                 }],
343                 ['OS=="mac"', {
344                     'dependencies': ['TestNetscapePlugIn'],
345                     'copies': [{
346                         'destination': '<(PRODUCT_DIR)/plugins/',
347                         'files': ['<(PRODUCT_DIR)/TestNetscapePlugIn.plugin/'],
348                     }],
349                 }],
350                 ['os_posix == 1 and OS != "mac"', {
351                     'copies': [{
352                         'destination': '<(PRODUCT_DIR)/plugins',
353                         'files': ['<(PRODUCT_DIR)/libTestNetscapePlugIn.so'],
354                     }],
355                 }],
356             ],
357         },
358     ], # targets
359     'conditions': [
360         ['OS=="win"', {
361             'targets': [{
362                 'target_name': 'LayoutTestHelper',
363                 'type': 'executable',
364                 'sources': ['<(tools_dir)/DumpRenderTree/chromium/LayoutTestHelperWin.cpp'],
365             }],
366         }],
367         ['OS=="mac"', {
368             'targets': [{
369                 'target_name': 'LayoutTestHelper',
370                 'type': 'executable',
371                 'sources': ['<(tools_dir)/DumpRenderTree/chromium/LayoutTestHelper.mm'],
372                 'link_settings': {
373                     'libraries': [
374                         '$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
375                     ],
376                 },
377             }],
378         }],
379         ['os_posix==1 and OS!="mac" and OS!="android" and gcc_version==46', {
380             'target_defaults': {
381                 # Disable warnings about c++0x compatibility, as some names (such
382                 # as nullptr) conflict with upcoming c++0x types.
383                 'cflags_cc': ['-Wno-c++0x-compat'],
384             },
385         }],
386     ], # conditions
387 }