| OLD | NEW |
| 1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 __doc__ = """ |
| 6 Configuration for building base.lib / libbase.a. |
| 7 """ |
| 8 |
| 5 Import('env') | 9 Import('env') |
| 6 | 10 |
| 7 env = env.Clone() | 11 env = env.Clone() |
| 8 env_tests = env.Clone() | 12 |
| 13 env.SConscript([ |
| 14 '$ICU38_DIR/using_icu38.scons', |
| 15 ], {'env':env}) |
| 9 | 16 |
| 10 env.Prepend( | 17 env.Prepend( |
| 11 CPPPATH = [ | 18 CPPPATH = [ |
| 12 '$ICU38_DIR/public/common', | 19 '$ROOT_DIR', |
| 13 '$ICU38_DIR/public/i18n', | |
| 14 '..', | |
| 15 ], | |
| 16 CPPDEFINES = [ | |
| 17 'U_STATIC_IMPLEMENTATION', | |
| 18 ], | 20 ], |
| 19 ) | 21 ) |
| 20 | 22 |
| 21 if env['PLATFORM'] == 'win32': | 23 if env['PLATFORM'] == 'win32': |
| 22 env.Prepend( | 24 env.Prepend( |
| 23 CCFLAGS = [ | 25 CCFLAGS = [ |
| 24 '/TP', | 26 '/TP', |
| 25 '/Wp64', | 27 '/Wp64', |
| 26 ], | 28 ], |
| 27 ) | 29 ) |
| 28 | 30 |
| 29 # These base files work on *all* platforms; files that don't work | 31 # These base files work on *all* platforms; files that don't work |
| 30 # cross-platform live below. | 32 # cross-platform live below. |
| 31 input_files = [ | 33 input_files = [ |
| 32 'at_exit.cc', | 34 'at_exit.cc', |
| 33 'base_paths.cc', | 35 'base_paths.cc', |
| 34 'base_switches.cc', | 36 'base_switches.cc', |
| 35 'bzip2_error_handler.cc', | 37 'bzip2_error_handler.cc', |
| 38 'clipboard_util.cc', |
| 36 'command_line.cc', | 39 'command_line.cc', |
| 37 'debug_util.cc', | 40 'debug_util.cc', |
| 38 'field_trial.cc', | 41 'event_recorder.cc', |
| 39 'file_path.cc', | 42 'file_path.cc', |
| 40 'file_util.cc', | 43 'file_util.cc', |
| 44 'file_version_info.cc', |
| 41 'histogram.cc', | 45 'histogram.cc', |
| 42 'icu_util.cc', | 46 'icu_util.cc', |
| 47 'idle_timer.cc', |
| 43 'json_reader.cc', | 48 'json_reader.cc', |
| 44 'json_writer.cc', | 49 'json_writer.cc', |
| 45 'lazy_instance.cc', | 50 'lazy_instance.cc', |
| 46 'lock.cc', | 51 'lock.cc', |
| 47 'logging.cc', | 52 'logging.cc', |
| 48 'md5.cc', | 53 'md5.cc', |
| 49 'memory_debug.cc', | 54 'memory_debug.cc', |
| 50 'message_loop.cc', | 55 'message_loop.cc', |
| 51 'message_pump_default.cc', | 56 'message_pump_default.cc', |
| 52 'non_thread_safe.cc', | 57 'non_thread_safe.cc', |
| 58 'object_watcher.cc', |
| 53 'path_service.cc', | 59 'path_service.cc', |
| 54 'pickle.cc', | 60 'pickle.cc', |
| 55 'rand_util.cc', | 61 'rand_util.cc', |
| 56 'ref_counted.cc', | 62 'ref_counted.cc', |
| 63 'resource_util.cc', |
| 57 'revocable_store.cc', | 64 'revocable_store.cc', |
| 58 'sha2.cc', | 65 'sha2.cc', |
| 59 'simple_thread.cc', | 66 'simple_thread.cc', |
| 60 'stats_table.cc', | 67 'stats_table.cc', |
| 61 'string_escape.cc', | 68 'string_escape.cc', |
| 62 'string_piece.cc', | 69 'string_piece.cc', |
| 63 'string_util.cc', | 70 'string_util.cc', |
| 64 'string_util_icu.cc', | 71 'string_util_icu.cc', |
| 65 'system_monitor.cc', | 72 'system_monitor.cc', |
| 73 'third_party/nspr/prtime.cc', |
| 74 'third_party/nss/sha512.cc', |
| 66 'thread.cc', | 75 'thread.cc', |
| 67 'time.cc', | 76 'time.cc', |
| 68 'time_format.cc', | 77 'time_format.cc', |
| 69 'timer.cc', | 78 'timer.cc', |
| 70 'trace_event.cc', | 79 'trace_event.cc', |
| 71 'tracked.cc', | 80 'tracked.cc', |
| 72 'tracked_objects.cc', | 81 'tracked_objects.cc', |
| 73 'values.cc', | 82 'values.cc', |
| 83 'watchdog.cc', |
| 74 'word_iterator.cc', | 84 'word_iterator.cc', |
| 75 'third_party/nspr/prtime.cc', | |
| 76 'third_party/nss/sha512.cc', | |
| 77 ] | 85 ] |
| 78 | 86 |
| 79 if env['PLATFORM'] == 'win32': | 87 if env['PLATFORM'] in ('posix', 'darwin'): |
| 80 # Some of these aren't really Windows-specific, they're just here until | 88 # Remove files that still need to be ported from the input_files list. |
| 81 # we have the port versions working. | 89 # TODO(port): delete files from this list as they get ported. |
| 82 # TODO: move all these files to either the cross-platform block above or | 90 to_be_ported_files = [ |
| 83 # a platform-specific block below. | |
| 84 input_files.extend([ | |
| 85 'clipboard_util.cc', | 91 'clipboard_util.cc', |
| 86 'event_recorder.cc', | 92 'event_recorder.cc', |
| 87 'file_version_info.cc', | 93 'file_version_info.cc', |
| 88 | 94 |
| 89 # This group all depends on MessageLoop. | 95 # This group all depends on MessageLoop. |
| 90 'idle_timer.cc', | 96 'idle_timer.cc', |
| 91 'object_watcher.cc', | 97 'object_watcher.cc', |
| 92 'watchdog.cc', | 98 'watchdog.cc', |
| 93 | 99 |
| 94 'resource_util.cc', # Uses HMODULE, but may be abstractable. | 100 'resource_util.cc', # Uses HMODULE, but may be abstractable. |
| 95 ]) | 101 ] |
| 102 for remove in to_be_ported_files: |
| 103 input_files.remove(remove) |
| 96 | 104 |
| 97 if env['PLATFORM'] == 'win32': | 105 if env['PLATFORM'] == 'win32': |
| 98 input_files.extend([ | 106 input_files.extend([ |
| 99 'base_drag_source.cc', | 107 'base_drag_source.cc', |
| 100 'base_drop_target.cc', | 108 'base_drop_target.cc', |
| 101 'base_paths_win.cc', | 109 'base_paths_win.cc', |
| 102 'clipboard_win.cc', | 110 'clipboard_win.cc', |
| 103 'condition_variable_win.cc', | 111 'condition_variable_win.cc', |
| 104 'cpu.cc', | 112 'cpu.cc', |
| 105 'debug_on_start.cc', | 113 'debug_on_start.cc', |
| 106 'debug_util_win.cc', | 114 'debug_util_win.cc', |
| 107 'directory_watcher_win.cc', | |
| 108 'file_util_win.cc', | 115 'file_util_win.cc', |
| 109 'hmac_win.cc', | 116 'hmac_win.cc', |
| 110 'iat_patch.cc', | 117 'iat_patch.cc', |
| 111 'image_util.cc', | 118 'image_util.cc', |
| 112 'lock_impl_win.cc', | 119 'lock_impl_win.cc', |
| 113 'message_pump_win.cc', | 120 'message_pump_win.cc', |
| 114 'pe_image.cc', | 121 'pe_image.cc', |
| 115 'platform_thread_win.cc', | 122 'platform_thread_win.cc', |
| 116 'process_util_win.cc', | 123 'process_util_win.cc', |
| 117 'process_win.cc', | 124 'process_win.cc', |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 'platform_thread_mac.mm', | 167 'platform_thread_mac.mm', |
| 161 'scoped_nsautorelease_pool.mm', | 168 'scoped_nsautorelease_pool.mm', |
| 162 'sys_string_conversions_mac.mm', | 169 'sys_string_conversions_mac.mm', |
| 163 'worker_pool_mac.mm', | 170 'worker_pool_mac.mm', |
| 164 ]) | 171 ]) |
| 165 | 172 |
| 166 if env['PLATFORM'] == 'posix': | 173 if env['PLATFORM'] == 'posix': |
| 167 input_files.extend([ | 174 input_files.extend([ |
| 168 'atomicops_internals_x86_gcc.cc', | 175 'atomicops_internals_x86_gcc.cc', |
| 169 'base_paths_linux.cc', | 176 'base_paths_linux.cc', |
| 170 'clipboard_linux.cc', | |
| 171 'file_util_linux.cc', | 177 'file_util_linux.cc', |
| 172 'hmac_nss.cc', | 178 'hmac_nss.cc', |
| 173 'message_pump_glib.cc', | 179 'message_pump_glib.cc', |
| 174 'nss_init.cc', | 180 'nss_init.cc', |
| 175 'process_posix.cc', | 181 'process_posix.cc', |
| 176 'process_util_linux.cc', | 182 'process_util_linux.cc', |
| 177 'sys_string_conversions_linux.cc', | 183 'sys_string_conversions_linux.cc', |
| 178 'worker_pool.cc', | 184 'worker_pool.cc', |
| 179 ]) | 185 ]) |
| 180 | 186 |
| 181 env.ChromeStaticLibrary('base', input_files) | 187 base_lib = env.ChromeStaticLibrary('base', input_files) |
| 182 | 188 env.Alias('base', base_lib) |
| 183 | |
| 184 env_tests.Prepend( | |
| 185 CPPPATH = [ | |
| 186 '$GTEST_DIR/include', | |
| 187 '$GTEST_DIR', | |
| 188 '$SKIA_DIR/include', | |
| 189 '$SKIA_DIR/include/corecg', | |
| 190 '$SKIA_DIR/platform', | |
| 191 '$ZLIB_DIR', | |
| 192 '$LIBPNG_DIR', | |
| 193 '$ICU38_DIR/public/common', | |
| 194 '$ICU38_DIR/public/i18n', | |
| 195 '..', | |
| 196 ], | |
| 197 CPPDEFINES = [ | |
| 198 'UNIT_TEST', | |
| 199 'PNG_USER_CONFIG', | |
| 200 'CHROME_PNG_WRITE_SUPPORT', | |
| 201 'U_STATIC_IMPLEMENTATION', | |
| 202 'GOOGLE_CHROME_BUILD', | |
| 203 ], | |
| 204 LIBS = [ | |
| 205 'base', | |
| 206 'base_gfx', | |
| 207 'gtest', | |
| 208 env_tests['ICU_LIBS'], # TODO(sgk): '$ICU_LIBS' when scons is fixed | |
| 209 'libpng', | |
| 210 'skia', | |
| 211 'zlib', | |
| 212 ] | |
| 213 ) | |
| 214 | |
| 215 env_tests.Append( | |
| 216 CPPPATH = [ | |
| 217 '$GTEST_DIR/include', | |
| 218 ], | |
| 219 ) | |
| 220 | |
| 221 if env['PLATFORM'] == 'win32': | |
| 222 env_tests.Prepend( | |
| 223 CCFLAGS = [ | |
| 224 '/TP', | |
| 225 '/WX', | |
| 226 ], | |
| 227 CPPDEFINES = [ | |
| 228 '_WIN32_WINNT=0x0600', | |
| 229 'WINVER=0x0600', | |
| 230 '_HAS_EXCEPTIONS=0', | |
| 231 ], | |
| 232 LINKFLAGS = [ | |
| 233 '/MANIFEST', | |
| 234 '/DELAYLOAD:"dwmapi.dll"', | |
| 235 '/DELAYLOAD:"uxtheme.dll"', | |
| 236 '/MACHINE:X86', | |
| 237 '/FIXED:No', | |
| 238 | |
| 239 '/safeseh', | |
| 240 '/dynamicbase', | |
| 241 '/ignore:4199', | |
| 242 '/nxcompat', | |
| 243 ], | |
| 244 ) | |
| 245 | |
| 246 if env['PLATFORM'] in ('posix', 'darwin'): | |
| 247 env_tests.Append( | |
| 248 LIBS = [ | |
| 249 'event', | |
| 250 ], | |
| 251 ) | |
| 252 | |
| 253 # These test files work on *all* platforms; tests that don't work | |
| 254 # cross-platform live below. | |
| 255 test_files = [ | |
| 256 'at_exit_unittest.cc', | |
| 257 'atomicops_unittest.cc', | |
| 258 'clipboard_unittest.cc', | |
| 259 'command_line_unittest.cc', | |
| 260 'condition_variable_unittest.cc', | |
| 261 'field_trial_unittest.cc', | |
| 262 'file_path_unittest.cc', | |
| 263 'file_util_unittest.cc', | |
| 264 'hmac_unittest.cc', | |
| 265 'histogram_unittest.cc', | |
| 266 'json_reader_unittest.cc', | |
| 267 'json_writer_unittest.cc', | |
| 268 'lazy_instance_unittest.cc', | |
| 269 'linked_ptr_unittest.cc', | |
| 270 'message_loop_unittest.cc', | |
| 271 'observer_list_unittest.cc', | |
| 272 'path_service_unittest.cc', | |
| 273 'pickle_unittest.cc', | |
| 274 'pr_time_unittest.cc', | |
| 275 'rand_util_unittest.cc', | |
| 276 'ref_counted_unittest.cc', | |
| 277 'run_all_unittests.cc', | |
| 278 'scoped_ptr_unittest.cc', | |
| 279 'sha2_unittest.cc', | |
| 280 'shared_memory_unittest.cc', | |
| 281 'simple_thread_unittest.cc', | |
| 282 'singleton_unittest.cc', | |
| 283 'stack_container_unittest.cc', | |
| 284 'string_escape_unittest.cc', | |
| 285 'string_piece_unittest.cc', | |
| 286 'string_tokenizer_unittest.cc', | |
| 287 'string_util_unittest.cc', | |
| 288 'sys_info_unittest.cc', | |
| 289 'thread_local_unittest.cc', | |
| 290 'thread_local_storage_unittest.cc', | |
| 291 'thread_unittest.cc', | |
| 292 'time_unittest.cc', | |
| 293 'timer_unittest.cc', | |
| 294 'tracked_objects_unittest.cc', | |
| 295 'tuple_unittest.cc', | |
| 296 'values_unittest.cc', | |
| 297 'waitable_event_unittest.cc', | |
| 298 'word_iterator_unittest.cc', | |
| 299 'worker_pool_unittest.cc', | |
| 300 'gfx/convolver_unittest.cc', | |
| 301 'gfx/image_operations_unittest.cc', | |
| 302 'gfx/png_codec_unittest.cc', | |
| 303 'gfx/rect_unittest.cc', | |
| 304 ] | |
| 305 | |
| 306 if env['PLATFORM'] == 'win32': | |
| 307 # These tests aren't really Windows-specific, they're just here until | |
| 308 # we have the port versions working. | |
| 309 env_tests.ChromeTestProgram('debug_message', ['debug_message.cc']) | |
| 310 | |
| 311 test_files.extend([ | |
| 312 'directory_watcher_unittest.cc', | |
| 313 'idletimer_unittest.cc', | |
| 314 'process_util_unittest.cc', | |
| 315 'stats_table_unittest.cc', | |
| 316 'watchdog_unittest.cc', | |
| 317 'gfx/native_theme_unittest.cc', | |
| 318 'gfx/uniscribe_unittest.cc', | |
| 319 'gfx/vector_canvas_unittest.cc', | |
| 320 ]) | |
| 321 | |
| 322 if env['PLATFORM'] == 'win32': | |
| 323 # Windows-specific tests. | |
| 324 test_files.extend([ | |
| 325 'file_version_info_unittest.cc', | |
| 326 'object_watcher_unittest.cc', | |
| 327 'pe_image_unittest.cc', | |
| 328 'sys_string_conversions_win_unittest.cc', | |
| 329 'time_unittest_win.cc', | |
| 330 'win_util_unittest.cc', | |
| 331 'wmi_util_unittest.cc', | |
| 332 ]) | |
| 333 | |
| 334 if env['PLATFORM'] == 'darwin': | |
| 335 test_files.extend([ | |
| 336 'platform_test_mac.mm', | |
| 337 ]) | |
| 338 | |
| 339 base_unittests = env_tests.ChromeTestProgram('base_unittests', test_files) | |
| 340 | |
| 341 # Install up a level to allow unit test path assumptions to be valid. | |
| 342 installed_base_unittests = env.Install('$TARGET_ROOT', base_unittests) | |
| 343 | |
| 344 | |
| 345 sconscript_dirs = [ | |
| 346 'gfx/SConscript', | |
| 347 ] | |
| 348 | |
| 349 SConscript(sconscript_dirs, exports=['env']) | |
| 350 | |
| 351 | |
| 352 env.Alias('base', ['.', installed_base_unittests]) | |
| 353 | |
| 354 # TODO(sgk) should this be moved into base.lib like everything else? This will | |
| 355 # require updating a bunch of other SConscripts which link directly against | |
| 356 # this generated object file. | |
| 357 env_tests.StaticObject('perftimer.cc') | |
| 358 | |
| 359 # Since run_all_perftests supplies a main, we cannot have it in base.lib | |
| 360 env_tests.StaticObject('run_all_perftests.cc') | |
| OLD | NEW |