"Make Chrome your default browser" should now appear as a checkbox at the bottom...
[chromium-blink-merge.git] / base / SConscript
blob8b6eab2ead10b9b9813c420ebd41077b685e7734
1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 Import('env')
7 env = env.Clone()
8 env_tests = env.Clone()
10 env.Prepend(
11     CPPPATH = [
12         '$ICU38_DIR/public/common',
13         '$ICU38_DIR/public/i18n',
14         '..',
15     ],
16     CPPDEFINES = [
17         'U_STATIC_IMPLEMENTATION',
18     ],
21 if env['PLATFORM'] == 'win32':
22   env.Prepend(
23       CCFLAGS = [
24           '/TP',
25           '/Wp64',
26       ],
27   )
29 # These base files work on *all* platforms; files that don't work
30 # cross-platform live below.
31 input_files = [
32     'at_exit.cc',
33     'base_paths.cc',
34     'base_switches.cc',
35     'bzip2_error_handler.cc',
36     'command_line.cc',
37     'debug_util.cc',
38     'file_util.cc',
39     'histogram.cc',
40     'icu_util.cc',
41     'json_reader.cc',
42     'json_writer.cc',
43     'lazy_instance.cc',
44     'lock.cc',
45     'logging.cc',
46     'md5.cc',
47     'memory_debug.cc',
48     'message_loop.cc',
49     'message_pump_default.cc',
50     'non_thread_safe.cc',
51     'path_service.cc',
52     'pickle.cc',
53     'ref_counted.cc',
54     'revocable_store.cc',
55     'sha2.cc',
56     'simple_thread.cc',
57     'stats_table.cc',
58     'string_escape.cc',
59     'string_piece.cc',
60     'string_util.cc',
61     'string_util_icu.cc',
62     'system_monitor.cc',
63     'thread.cc',
64     'time.cc',
65     'time_format.cc',
66     'timer.cc',
67     'trace_event.cc',
68     'tracked.cc',
69     'tracked_objects.cc',
70     'values.cc',
71     'word_iterator.cc',
72     'third_party/nspr/prtime.cc',
73     'third_party/nss/sha512.cc',
76 if env['PLATFORM'] == 'win32':
77   # Some of these aren't really Windows-specific, they're just here until
78   # we have the port versions working.
79   # TODO: move all these files to either the cross-platform block above or
80   # a platform-specific block below.
81   input_files.extend([
82     'clipboard_util.cc',
83     'event_recorder.cc',
84     'file_version_info.cc',
86     # This group all depends on MessageLoop.
87     'idle_timer.cc',
88     'object_watcher.cc',
89     'shared_event.cc',   # Is this used?
90     'watchdog.cc',
92     'process.cc',
94     'resource_util.cc',  # Uses HMODULE, but may be abstractable.
95   ])
97 if env['PLATFORM'] == 'win32':
98   input_files.extend([
99       'base_drag_source.cc',
100       'base_drop_target.cc',
101       'base_paths_win.cc',
102       'clipboard_win.cc',
103       'condition_variable_win.cc',
104       'cpu.cc',
105       'debug_on_start.cc',
106       'debug_util_win.cc',
107       'file_util_win.cc',
108       'hmac_win.cc',
109       'iat_patch.cc',
110       'image_util.cc',
111       'lock_impl_win.cc',
112       'message_pump_win.cc',
113       'pe_image.cc',
114       'platform_thread_win.cc',
115       'process_util_win.cc',
116       'registry.cc',
117       'shared_memory_win.cc',
118       'sys_info_win.cc',
119       'sys_string_conversions_win.cc',
120       'system_monitor_win.cc',
121       'thread_local_storage_win.cc',
122       'thread_local_win.cc',
123       'time_win.cc',
124       'waitable_event_win.cc',
125       'win_util.cc',
126       'wmi_util.cc',
127       'worker_pool.cc',
128   ])
130 if env['PLATFORM'] in ('darwin', 'posix'):
131   input_files.extend([
132       'condition_variable_posix.cc',
133       'debug_util_posix.cc',
134       'file_util_posix.cc',
135       'lock_impl_posix.cc',
136       'message_pump_libevent.cc',
137       'platform_thread_posix.cc',
138       'process_util_posix.cc',
139       'shared_memory_posix.cc',
140       'string16.cc',
141       'sys_info_posix.cc',
142       'thread_local_storage_posix.cc',
143       'thread_local_posix.cc',
144       'time_posix.cc',
145       'waitable_event_generic.cc',
146   ])
148 if env['PLATFORM'] == 'darwin':
149   input_files.extend([
150       'base_paths_mac.mm',
151       'clipboard_mac.mm',
152       'file_util_mac.mm',
153       'file_version_info_mac.mm',
154       'hmac_mac.cc',
155       'message_pump_mac.mm',
156       'platform_thread_mac.mm',
157       'sys_string_conversions_mac.cc',
158       'worker_pool_mac.mm',
159   ])
161 if env['PLATFORM'] == 'posix':
162   input_files.extend([
163       'atomicops_internals_x86_gcc.cc',
164       'base_paths_linux.cc',
165       'file_util_linux.cc',
166       'hmac_nss.cc',
167       'nss_init.cc',
168       'sys_string_conversions_linux.cc',
169       'worker_pool.cc',
170   ])
172 env.ChromeStaticLibrary('base', input_files)
175 env_tests.Prepend(
176     CPPPATH = [
177         '$GTEST_DIR/include',
178         '$GTEST_DIR',
179         '$SKIA_DIR/include',
180         '$SKIA_DIR/include/corecg',
181         '$SKIA_DIR/platform',
182         '$ZLIB_DIR',
183         '$LIBPNG_DIR',
184         '$ICU38_DIR/public/common',
185         '$ICU38_DIR/public/i18n',
186         '..',
187     ],
188     CPPDEFINES = [
189         'UNIT_TEST',
190         'PNG_USER_CONFIG',
191         'CHROME_PNG_WRITE_SUPPORT',
192         'U_STATIC_IMPLEMENTATION',
193         'GOOGLE_CHROME_BUILD',
194     ],
195     LIBS = [
196         'base',
197         'base_gfx',
198         'gtest',
199         'icuuc',
200         'libpng',
201         'skia',
202         'zlib',
203     ]
206 env_tests.Append(
207     CPPPATH = [
208         '$GTEST_DIR/include',
209     ],
212 if env['PLATFORM'] == 'win32':
213   env_tests.Prepend(
214       CCFLAGS = [
215           '/TP',
216           '/WX',
217       ],
218       CPPDEFINES = [
219         '_WIN32_WINNT=0x0600',
220         'WINVER=0x0600',
221         '_HAS_EXCEPTIONS=0',
222       ],
223       LINKFLAGS = [
224           '/MANIFEST',
225           '/DELAYLOAD:"dwmapi.dll"',
226           '/DELAYLOAD:"uxtheme.dll"',
227           '/MACHINE:X86',
228           '/FIXED:No',
230           '/safeseh',
231           '/dynamicbase',
232           '/ignore:4199',
233           '/nxcompat',
234       ],
235   )
237 if env['PLATFORM'] in ('posix', 'darwin'):
238   env_tests.Append(
239       LIBS = [
240           'event',
241       ],
242   )
244 # These test files work on *all* platforms; tests that don't work
245 # cross-platform live below.
246 test_files = [
247     'at_exit_unittest.cc',
248     'atomicops_unittest.cc',
249     'command_line_unittest.cc',
250     'condition_variable_unittest.cc',
251     'file_util_unittest.cc',
252     'hmac_unittest.cc',
253     'histogram_unittest.cc',
254     'json_reader_unittest.cc',
255     'json_writer_unittest.cc',
256     'lazy_instance_unittest.cc',
257     'linked_ptr_unittest.cc',
258     'message_loop_unittest.cc',
259     'observer_list_unittest.cc',
260     'path_service_unittest.cc',
261     'pickle_unittest.cc',
262     'pr_time_unittest.cc',
263     'ref_counted_unittest.cc',
264     'run_all_unittests.cc',
265     'scoped_ptr_unittest.cc',
266     'sha2_unittest.cc',
267     'shared_memory_unittest.cc',
268     'simple_thread_unittest.cc',
269     'singleton_unittest.cc',
270     'stack_container_unittest.cc',
271     'string_escape_unittest.cc',
272     'string_piece_unittest.cc',
273     'string_tokenizer_unittest.cc',
274     'string_util_unittest.cc',
275     'sys_info_unittest.cc',
276     'thread_local_unittest.cc',
277     'thread_local_storage_unittest.cc',
278     'thread_unittest.cc',
279     'time_unittest.cc',
280     'timer_unittest.cc',
281     'tracked_objects_unittest.cc',
282     'tuple_unittest.cc',
283     'values_unittest.cc',
284     'waitable_event_unittest.cc',
285     'word_iterator_unittest.cc',
286     'worker_pool_unittest.cc',
287     'gfx/convolver_unittest.cc',
288     'gfx/image_operations_unittest.cc',
289     'gfx/png_codec_unittest.cc',
290     'gfx/rect_unittest.cc',
293 if env['PLATFORM'] == 'win32':
294   # These tests aren't really Windows-specific, they're just here until
295   # we have the port versions working.
296   env_tests.ChromeTestProgram('debug_message', ['debug_message.cc'])
298   test_files.extend([
299     'clipboard_unittest.cc',
300     'idletimer_unittest.cc',
301     'process_util_unittest.cc',
302     'shared_event_unittest.cc',
303     'stats_table_unittest.cc',
304     'watchdog_unittest.cc',
305     'gfx/native_theme_unittest.cc',
306     'gfx/uniscribe_unittest.cc',
307     'gfx/vector_canvas_unittest.cc',
308   ])
310 if env['PLATFORM'] == 'win32':
311   # Windows-specific tests.
312   test_files.extend([
313     'file_version_info_unittest.cc',
314     'object_watcher_unittest.cc',
315     'pe_image_unittest.cc',
316     'sys_string_conversions_win_unittest.cc',
317     'time_unittest_win.cc',
318     'win_util_unittest.cc',
319     'wmi_util_unittest.cc',
320     ])
322 if env['PLATFORM'] == 'darwin':
323   test_files.extend([
324       'platform_test_mac.mm',
325   ])
327 base_unittests = env_tests.ChromeTestProgram('base_unittests', test_files)
329 # Install up a level to allow unit test path assumptions to be valid.
330 installed_base_unittests = env.Install('$TARGET_ROOT', base_unittests)
333 sconscript_dirs = [
334     'gfx/SConscript',
337 SConscript(sconscript_dirs, exports=['env'])
340 env.Alias('base', ['.', installed_base_unittests])
342 # TODO(sgk) should this be moved into base.lib like everything else?  This will
343 # require updating a bunch of other SConscripts which link directly against
344 # this generated object file.
345 env_tests.StaticObject('perftimer.cc')
347 # Since run_all_perftests supplies a main, we cannot have it in base.lib
348 env_tests.StaticObject('run_all_perftests.cc')