| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 Import('env') | |
| 6 | |
| 7 env = env.Clone() | |
| 8 env_tests = env.Clone() | |
| 9 | |
| 10 env.Prepend( | |
| 11 CPPPATH = [ | |
| 12 '$ICU38_DIR/public/common', | |
| 13 '$ICU38_DIR/public/i18n', | |
| 14 '..', | |
| 15 ], | |
| 16 CPPDEFINES = [ | |
| 17 'U_STATIC_IMPLEMENTATION', | |
| 18 ], | |
| 19 ) | |
| 20 | |
| 21 if env['PLATFORM'] == 'win32': | |
| 22 env.Prepend( | |
| 23 CCFLAGS = [ | |
| 24 '/TP', | |
| 25 '/Wp64', | |
| 26 ], | |
| 27 ) | |
| 28 | |
| 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 'field_trial.cc', | |
| 39 'file_path.cc', | |
| 40 'file_util.cc', | |
| 41 'histogram.cc', | |
| 42 'icu_util.cc', | |
| 43 'json_reader.cc', | |
| 44 'json_writer.cc', | |
| 45 'lazy_instance.cc', | |
| 46 'lock.cc', | |
| 47 'logging.cc', | |
| 48 'md5.cc', | |
| 49 'memory_debug.cc', | |
| 50 'message_loop.cc', | |
| 51 'message_pump_default.cc', | |
| 52 'non_thread_safe.cc', | |
| 53 'path_service.cc', | |
| 54 'pickle.cc', | |
| 55 'rand_util.cc', | |
| 56 'ref_counted.cc', | |
| 57 'revocable_store.cc', | |
| 58 'sha2.cc', | |
| 59 'simple_thread.cc', | |
| 60 'stats_table.cc', | |
| 61 'string_escape.cc', | |
| 62 'string_piece.cc', | |
| 63 'string_util.cc', | |
| 64 'string_util_icu.cc', | |
| 65 'system_monitor.cc', | |
| 66 'thread.cc', | |
| 67 'time.cc', | |
| 68 'time_format.cc', | |
| 69 'timer.cc', | |
| 70 'trace_event.cc', | |
| 71 'tracked.cc', | |
| 72 'tracked_objects.cc', | |
| 73 'values.cc', | |
| 74 'word_iterator.cc', | |
| 75 'third_party/nspr/prtime.cc', | |
| 76 'third_party/nss/sha512.cc', | |
| 77 ] | |
| 78 | |
| 79 if env['PLATFORM'] == 'win32': | |
| 80 # Some of these aren't really Windows-specific, they're just here until | |
| 81 # we have the port versions working. | |
| 82 # TODO: move all these files to either the cross-platform block above or | |
| 83 # a platform-specific block below. | |
| 84 input_files.extend([ | |
| 85 'clipboard_util.cc', | |
| 86 'event_recorder.cc', | |
| 87 'file_version_info.cc', | |
| 88 | |
| 89 # This group all depends on MessageLoop. | |
| 90 'idle_timer.cc', | |
| 91 'object_watcher.cc', | |
| 92 'watchdog.cc', | |
| 93 | |
| 94 'resource_util.cc', # Uses HMODULE, but may be abstractable. | |
| 95 ]) | |
| 96 | |
| 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 'directory_watcher_win.cc', | |
| 108 'file_util_win.cc', | |
| 109 'hmac_win.cc', | |
| 110 'iat_patch.cc', | |
| 111 'image_util.cc', | |
| 112 'lock_impl_win.cc', | |
| 113 'message_pump_win.cc', | |
| 114 'pe_image.cc', | |
| 115 'platform_thread_win.cc', | |
| 116 'process_util_win.cc', | |
| 117 'process_win.cc', | |
| 118 'rand_util_win.cc', | |
| 119 'registry.cc', | |
| 120 'shared_memory_win.cc', | |
| 121 'sys_info_win.cc', | |
| 122 'sys_string_conversions_win.cc', | |
| 123 'system_monitor_win.cc', | |
| 124 'thread_local_storage_win.cc', | |
| 125 'thread_local_win.cc', | |
| 126 'time_win.cc', | |
| 127 'waitable_event_win.cc', | |
| 128 'win_util.cc', | |
| 129 'wmi_util.cc', | |
| 130 'worker_pool.cc', | |
| 131 ]) | |
| 132 | |
| 133 if env['PLATFORM'] in ('darwin', 'posix'): | |
| 134 input_files.extend([ | |
| 135 'condition_variable_posix.cc', | |
| 136 'debug_util_posix.cc', | |
| 137 'file_util_posix.cc', | |
| 138 'lock_impl_posix.cc', | |
| 139 'message_pump_libevent.cc', | |
| 140 'platform_thread_posix.cc', | |
| 141 'process_util_posix.cc', | |
| 142 'rand_util_posix.cc', | |
| 143 'shared_memory_posix.cc', | |
| 144 'string16.cc', | |
| 145 'sys_info_posix.cc', | |
| 146 'thread_local_storage_posix.cc', | |
| 147 'thread_local_posix.cc', | |
| 148 'time_posix.cc', | |
| 149 'waitable_event_generic.cc', | |
| 150 ]) | |
| 151 | |
| 152 if env['PLATFORM'] == 'darwin': | |
| 153 input_files.extend([ | |
| 154 'base_paths_mac.mm', | |
| 155 'clipboard_mac.mm', | |
| 156 'file_util_mac.mm', | |
| 157 'file_version_info_mac.mm', | |
| 158 'hmac_mac.cc', | |
| 159 'message_pump_mac.mm', | |
| 160 'platform_thread_mac.mm', | |
| 161 'scoped_nsautorelease_pool.mm', | |
| 162 'sys_string_conversions_mac.mm', | |
| 163 'worker_pool_mac.mm', | |
| 164 ]) | |
| 165 | |
| 166 if env['PLATFORM'] == 'posix': | |
| 167 input_files.extend([ | |
| 168 'atomicops_internals_x86_gcc.cc', | |
| 169 'base_paths_linux.cc', | |
| 170 'clipboard_linux.cc', | |
| 171 'file_util_linux.cc', | |
| 172 'hmac_nss.cc', | |
| 173 'message_pump_glib.cc', | |
| 174 'nss_init.cc', | |
| 175 'process_posix.cc', | |
| 176 'process_util_linux.cc', | |
| 177 'sys_string_conversions_linux.cc', | |
| 178 'worker_pool.cc', | |
| 179 ]) | |
| 180 | |
| 181 env.ChromeStaticLibrary('base', input_files) | |
| 182 | |
| 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 |