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': '../../Source/testing/data/fonts/AHEM____.TTF',
34        'source_dir': '../../Source',
35        'conditions': [
36            ['OS=="linux"', {
37                'use_custom_freetype%': 1,
38            }, {
39                'use_custom_freetype%': 0,
40            }],
41        ],
42    },
43    'includes': [
44        '../../Source/build/features.gypi',
45        '../../Source/testing/runner/runner.gypi',
46        '../../Source/testing/plugin/plugin.gypi',
47    ],
48    'targets': [
49        {
50            'target_name': 'TestRunner',
51            'type': '<(component)',
52            'defines': [
53                'WEBTESTRUNNER_IMPLEMENTATION=1',
54            ],
55            'dependencies': [
56                'TestRunner_resources',
57                '../config.gyp:unittest_config',
58                '../../public/blink.gyp:blink',
59                '<(source_dir)/web/web.gyp:webkit_test_support',
60            ],
61            'export_dependent_settings': [
62                '../../public/blink.gyp:blink',
63            ],
64            'direct_dependent_settings': {
65                'include_dirs': [
66                    '../..',
67                ],
68            },
69            'sources': [
70                '<@(test_runner_files)',
71            ],
72            'conditions': [
73                ['component=="shared_library"', {
74                    'defines': [
75                        'WEBTESTRUNNER_DLL',
76                        'WEBTESTRUNNER_IMPLEMENTATION=1',
77                    ],
78                    'dependencies': [
79                        '<(DEPTH)/base/base.gyp:base',
80                        '<(DEPTH)/skia/skia.gyp:skia',
81                        '<(DEPTH)/url/url.gyp:url_lib',
82                        '<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
83                    ],
84                    'direct_dependent_settings': {
85                        'defines': [
86                            'WEBTESTRUNNER_DLL',
87                        ],
88                    },
89                    'export_dependent_settings': [
90                        '<(DEPTH)/url/url.gyp:url_lib',
91                        '<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
92                    ],
93                    'msvs_settings': {
94                        'VCLinkerTool': {
95                            'conditions': [
96                                ['incremental_chrome_dll==1', {
97                                    'UseLibraryDependencyInputs': 'true',
98                                }],
99                            ],
100                        },
101                    },
102                }],
103                ['toolkit_uses_gtk == 1', {
104                    'dependencies': [
105                        '<(DEPTH)/build/linux/system.gyp:gtk',
106                    ],
107                    'include_dirs': [
108                        '../../../public/web/gtk',
109                    ],
110                }],
111                ['OS!="win"', {
112                    'sources/': [
113                        ['exclude', 'Win\\.cpp$'],
114                    ],
115                }],
116                ['OS=="mac"', {
117                  'link_settings': {
118                    'libraries': [
119                      '$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
120                      '$(SDKROOT)/System/Library/Frameworks/ApplicationServices.framework',
121                      '$(SDKROOT)/System/Library/Frameworks/Carbon.framework',
122                      '$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
123                    ],
124                  },
125                }],
126            ],
127            # Disable c4267 warnings until we fix size_t to int truncations.
128            'msvs_disabled_warnings': [ 4267, ],
129        },
130        {
131            'target_name': 'TestRunner_resources',
132            'type': 'none',
133            'dependencies': [
134                'copy_TestNetscapePlugIn',
135            ],
136            'conditions': [
137                ['OS=="win"', {
138                    'dependencies': [
139                        'LayoutTestHelper',
140                    ],
141                    'copies': [{
142                        'destination': '<(PRODUCT_DIR)',
143                        'files': ['<(ahem_path)'],
144                    }],
145                }],
146                ['OS=="mac"', {
147                    'dependencies': [
148                        'LayoutTestHelper',
149                    ],
150                    'all_dependent_settings': {
151                        'mac_bundle_resources': [
152                            '<(ahem_path)',
153                            '<(source_dir)/testing/data/fonts/WebKitWeightWatcher100.ttf',
154                            '<(source_dir)/testing/data/fonts/WebKitWeightWatcher200.ttf',
155                            '<(source_dir)/testing/data/fonts/WebKitWeightWatcher300.ttf',
156                            '<(source_dir)/testing/data/fonts/WebKitWeightWatcher400.ttf',
157                            '<(source_dir)/testing/data/fonts/WebKitWeightWatcher500.ttf',
158                            '<(source_dir)/testing/data/fonts/WebKitWeightWatcher600.ttf',
159                            '<(source_dir)/testing/data/fonts/WebKitWeightWatcher700.ttf',
160                            '<(source_dir)/testing/data/fonts/WebKitWeightWatcher800.ttf',
161                            '<(source_dir)/testing/data/fonts/WebKitWeightWatcher900.ttf',
162                            '<(SHARED_INTERMEDIATE_DIR)/webkit/missingImage.png',
163                            '<(SHARED_INTERMEDIATE_DIR)/webkit/textAreaResizeCorner.png',
164                        ],
165                    },
166                }],
167                # The test plugin relies on X11.
168                ['OS=="linux" and use_x11==0', {
169                    'dependencies!': [
170                        'copy_TestNetscapePlugIn',
171                    ],
172                }],
173                ['use_x11 == 1', {
174                    'dependencies': [
175                        '<(DEPTH)/tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
176                    ],
177                    'copies': [{
178                        'destination': '<(PRODUCT_DIR)',
179                        'files': [
180                            '<(ahem_path)',
181                            '<(source_dir)/testing/data/fonts/fonts.conf',
182                        ]
183                    }],
184                }],
185                ['OS=="android"', {
186                    'dependencies!': [
187                        'copy_TestNetscapePlugIn',
188                    ],
189                    'copies': [{
190                        'destination': '<(PRODUCT_DIR)',
191                        'files': [
192                            '<(ahem_path)',
193                            '<(source_dir)/testing/data/fonts/android_main_fonts.xml',
194                            '<(source_dir)/testing/data/fonts/android_fallback_fonts.xml',
195                        ]
196                    }],
197                }],
198            ],
199        },
200        {
201            'target_name': 'TestNetscapePlugIn',
202            'type': 'loadable_module',
203            'sources': [ '<@(test_plugin_files)' ],
204            'dependencies': [
205                '../config.gyp:unittest_config',
206                '<(DEPTH)/third_party/npapi/npapi.gyp:npapi',
207            ],
208            'include_dirs': [
209                '<(DEPTH)',
210                '<(source_dir)/testing/plugin/',
211            ],
212            'conditions': [
213                ['OS=="mac"', {
214                    'mac_bundle': 1,
215                    'product_extension': 'plugin',
216                    'link_settings': {
217                        'libraries': [
218                            '$(SDKROOT)/System/Library/Frameworks/Carbon.framework',
219                            '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework',
220                            '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework',
221                        ]
222                    },
223                    'xcode_settings': {
224                        'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO',
225                        'INFOPLIST_FILE': 'plugin/mac/Info.plist',
226                    },
227                }],
228                ['os_posix == 1 and OS != "mac"', {
229                    'cflags': [
230                        '-fvisibility=default',
231                    ],
232                }],
233                ['OS=="win"', {
234                    'defines': [
235                        # This seems like a hack, but this is what Safari Win does.
236                        'snprintf=_snprintf',
237                    ],
238                    'sources': [
239                        'plugin/win/TestNetscapePlugin.def',
240                        'plugin/win/TestNetscapePlugin.rc',
241                    ],
242                    # The .rc file requires that the name of the dll is npTestNetscapePlugIn.dll.
243                    'product_name': 'npTestNetscapePlugIn',
244                    # Disable c4267 warnings until we fix size_t to int truncations.
245                    'msvs_disabled_warnings': [ 4267, ],
246                }],
247            ],
248        },
249        {
250            'target_name': 'copy_TestNetscapePlugIn',
251            'type': 'none',
252            'dependencies': [
253                'TestNetscapePlugIn',
254            ],
255            'conditions': [
256                ['OS=="win"', {
257                    'copies': [{
258                        'destination': '<(PRODUCT_DIR)/plugins',
259                        'files': ['<(PRODUCT_DIR)/npTestNetscapePlugIn.dll'],
260                    }],
261                }],
262                ['OS=="mac"', {
263                    'dependencies': ['TestNetscapePlugIn'],
264                    'copies': [{
265                        'destination': '<(PRODUCT_DIR)/plugins/',
266                        'files': ['<(PRODUCT_DIR)/TestNetscapePlugIn.plugin/'],
267                    }],
268                }],
269                ['os_posix == 1 and OS != "mac"', {
270                    'copies': [{
271                        'destination': '<(PRODUCT_DIR)/plugins',
272                        'files': ['<(PRODUCT_DIR)/libTestNetscapePlugIn.so'],
273                    }],
274                }],
275            ],
276        },
277    ], # targets
278    'conditions': [
279        ['OS=="win"', {
280            'targets': [{
281                'target_name': 'LayoutTestHelper',
282                'type': 'executable',
283                'sources': ['helper/LayoutTestHelperWin.cpp'],
284            }],
285        }],
286        ['OS=="mac"', {
287            'targets': [{
288                'target_name': 'LayoutTestHelper',
289                'type': 'executable',
290                'sources': ['helper/LayoutTestHelperMac.mm'],
291                'link_settings': {
292                    'libraries': [
293                        '$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
294                    ],
295                },
296            }],
297        }],
298        ['gcc_version>=46', {
299            'target_defaults': {
300                # Disable warnings about c++0x compatibility, as some names (such
301                # as nullptr) conflict with upcoming c++0x types.
302                'cflags_cc': ['-Wno-c++0x-compat'],
303            },
304        }],
305        ['clang==1', {
306            'target_defaults': {
307                # FIXME: Add -Wglobal-constructors after fixing existing bugs.
308            },
309        }],
310    ], # conditions
311}
312