WinCairo build fails to link.
[WebKit-https.git] / Source / WebKit / chromium / WebKitUnitTests.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     'includes': [
33         'features.gypi',
34         'WebKit.gypi',
35     ],
36     'variables': {
37         'conditions': [
38             # Location of the chromium src directory and target type is different
39             # if webkit is built inside chromium or as standalone project.
40             ['inside_chromium_build==0', {
41                 # Webkit is being built outside of the full chromium project.
42                 # e.g. via build-webkit --chromium
43                 'chromium_src_dir': '../../WebKit/chromium',
44             },{
45                 # WebKit is checked out in src/chromium/third_party/WebKit
46                 'chromium_src_dir': '../../../../..',
47             }],
48         ],
49     },
50     'targets': [
51         {
52             'target_name': 'webkit_unit_tests',
53             'type': 'executable',
54             'variables': { 'enable_wexit_time_destructors': 1, },
55             'msvs_guid': '7CEFE800-8403-418A-AD6A-2D52C6FC3EAD',
56             'dependencies': [
57                 'WebKit.gyp:webkit',
58                 '../../../Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp:DumpRenderTree_resources',
59                 '<(chromium_src_dir)/base/base.gyp:base',
60                 '<(chromium_src_dir)/base/base.gyp:base_i18n',
61                 '<(chromium_src_dir)/base/base.gyp:test_support_base',
62                 '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl',
63                 '<(chromium_src_dir)/testing/gmock.gyp:gmock',
64                 '<(chromium_src_dir)/testing/gtest.gyp:gtest',
65                 '<(chromium_src_dir)/third_party/zlib/zlib.gyp:zlib',
66                 '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8',
67                 '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support',
68             ],
69             'sources': [
70                 'tests/RunAllTests.cpp',
71             ],
72             'include_dirs': [
73                 'public',
74                 'src',
75                 # WebKit unit tests are allowed to include WebKit and WebCore header files, which may include headers in the
76                 # Platform API as <public/WebFoo.h>. Thus we need to have the Platform API include path, but we can't depend
77                 # directly on Platform.gyp:webkit_platform since platform cannot link as a separate library. Instead, we just
78                 # add the include path directly.
79                 '../../Platform/chromium',
80             ],
81             'conditions': [
82                 ['inside_chromium_build==1 and component=="shared_library"', {
83                     'defines': [
84                         'WEBKIT_DLL_UNITTEST',
85                     ],
86                 }, {
87                     'dependencies': [
88                         '../../WebCore/WebCore.gyp/WebCore.gyp:webcore',
89                     ],
90                     'defines': [
91                         'WEBKIT_IMPLEMENTATION=1',
92                     ],
93                     'sources': [
94                         '<@(webkit_unittest_files)',
95                     ],
96                     'conditions': [
97                         ['toolkit_uses_gtk == 1', {
98                             'include_dirs': [
99                                 'public/gtk',
100                             ],
101                             'variables': {
102                             # FIXME: Enable warnings on other platforms.
103                             'chromium_code': 1,
104                             },
105                         }],
106                     ],
107                 }],
108                 ['inside_chromium_build==1 and OS=="win" and component!="shared_library"', {
109                     'configurations': {
110                         'Debug_Base': {
111                             'msvs_settings': {
112                                 'VCLinkerTool': {
113                                     'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
114                                 },
115                             },
116                         },
117                     },
118                 }],
119                 ['OS=="android" and gtest_target_type == "shared_library"', {
120                     'type': 'shared_library',
121                     'dependencies': [
122                         '<(chromium_src_dir)/testing/android/native_test.gyp:native_test_native_code',
123                         '<(chromium_src_dir)/tools/android/forwarder2/forwarder.gyp:forwarder2',
124                     ],
125                 }],
126                 ['OS=="mac"', {
127                     'include_dirs': [
128                         'public/mac',
129                     ],
130                 }],
131                 [ 'os_posix==1 and OS!="mac" and OS!="android" and OS!="ios" and linux_use_tcmalloc==1', {
132                     'dependencies': [
133                         '<(chromium_src_dir)/base/allocator/allocator.gyp:allocator',
134                     ],
135                 }],
136             ],
137         }                
138     ], # targets
139     'conditions': [
140         ['os_posix==1 and OS!="mac" and gcc_version>=46', {
141             'target_defaults': {
142                 # Disable warnings about c++0x compatibility, as some names (such
143                 # as nullptr) conflict with upcoming c++0x types.
144                 'cflags_cc': ['-Wno-c++0x-compat'],
145             },
146         }],
147         ['OS=="android" and android_webview_build==0 and gtest_target_type == "shared_library"', {
148             # Wrap libwebkit_unit_tests.so into an android apk for execution.
149             'targets': [{
150                 'target_name': 'webkit_unit_tests_apk',
151                 'type': 'none',
152                 'dependencies': [
153                     '<(chromium_src_dir)/base/base.gyp:base_java',
154                     '<(chromium_src_dir)/net/net.gyp:net_java',
155                     'webkit_unit_tests',
156                 ],
157                 'variables': {
158                     'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)webkit_unit_tests<(SHARED_LIB_SUFFIX)',
159                     'conditions': [
160                         ['inside_chromium_build==1', {
161                             'ant_build_to_chromium_src': '<(ant_build_out)/../../',
162                         }, {
163                             'ant_build_to_chromium_src': '<(ant_build_out)/../../Source/WebKit/chromium',
164                         }],
165                     ],
166                 },
167                 # Part of the following was copied from <(chromium_src_dir)/build/apk_test.gpyi.
168                 # Not including it because gyp include doesn't support variable in path or under
169                 # conditions. And we also have some different requirements.
170                 'actions': [{
171                     'action_name': 'apk_webkit_unit_tests',
172                     'message': 'Building webkit_unit_tests test apk.',
173                     'inputs': [
174                         '<(chromium_src_dir)/testing/android/AndroidManifest.xml',
175                         '<(chromium_src_dir)/testing/android/generate_native_test.py',
176                         '<(input_shlib_path)',
177                         '>@(input_jars_paths)',
178                     ],
179                     'outputs': [
180                         '<(PRODUCT_DIR)/webkit_unit_tests_apk/webkit_unit_tests-debug.apk',
181                     ],
182                     'action': [
183                         '<(chromium_src_dir)/testing/android/generate_native_test.py',
184                         '--native_library',
185                         '<(input_shlib_path)',
186                         '--output',
187                         '<(PRODUCT_DIR)/webkit_unit_tests_apk',
188                         '--strip-binary=<(android_strip)',
189                         '--ant-args',
190                         '-quiet',
191                         '--ant-args',
192                         '-DANDROID_SDK=<(android_sdk)',
193                         '--ant-args',
194                         '-DANDROID_SDK_ROOT=<(android_sdk_root)',
195                         '--ant-args',
196                         '-DANDROID_SDK_TOOLS=<(android_sdk_tools)',
197                         '--ant-args',
198                         '-DANDROID_SDK_VERSION=<(android_sdk_version)',
199                         '--ant-args',
200                         '-DANDROID_TOOLCHAIN=<(android_toolchain)',
201                         '--ant-args',
202                         '-DANDROID_GDBSERVER=<(android_gdbserver)',
203                         '--ant-args',
204                         '-DPRODUCT_DIR=<(ant_build_out)',
205                         '--ant-args',
206                         '-DCHROMIUM_SRC=<(ant_build_to_chromium_src)',
207                         '--ant-args',
208                         '-DINPUT_JARS_PATHS=>@(input_jars_paths)',
209                         '--app_abi',
210                         '<(android_app_abi)',
211                     ],
212                 }],
213             }],
214         }],
215         ['clang==1', {
216             'target_defaults': {
217                 'cflags': ['-Wunused-parameter'],
218                 'xcode_settings': {
219                     'WARNING_CFLAGS': ['-Wunused-parameter'],
220                 },
221             },
222         }],
223     ],
224 }