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 import os | 5 import os |
6 import shutil | 6 import shutil |
7 import sys | 7 import sys |
8 | 8 |
9 | 9 |
10 p = ARGUMENTS.get('PROGRESS') | 10 p = ARGUMENTS.get('PROGRESS') |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 root_env = Environment( | 29 root_env = Environment( |
30 tools = ['component_setup'], | 30 tools = ['component_setup'], |
31 | 31 |
32 # Requested list of system (shared) libraries, from the comma separated | 32 # Requested list of system (shared) libraries, from the comma separated |
33 # SYSTEM_LIBS command-line argument | 33 # SYSTEM_LIBS command-line argument |
34 req_system_libs = [], | 34 req_system_libs = [], |
35 # All supported system libraries, for the help message | 35 # All supported system libraries, for the help message |
36 all_system_libs = [], | 36 all_system_libs = [], |
37 | 37 |
| 38 CHROME_BUILD_TYPE = os.environ.get('CHROME_BUILD_TYPE', ''), |
| 39 CHROMIUM_BUILD = os.environ.get('CHROMIUM_BUILD', ''), |
| 40 |
38 CHROME_SRC_DIR = '$MAIN_DIR/..', | 41 CHROME_SRC_DIR = '$MAIN_DIR/..', |
39 DESTINATION_ROOT = '$MAIN_DIR/Hammer', | 42 DESTINATION_ROOT = '$MAIN_DIR/Hammer', |
40 | 43 |
41 # Where ComponentTestProgram() will build test executables. | 44 # Where ComponentTestProgram() will build test executables. |
42 TESTS_DIR = '$DESTINATION_ROOT', | 45 TESTS_DIR = '$DESTINATION_ROOT', |
43 | 46 |
44 # Where ComponentProgram() will build program executables. | 47 # Where ComponentProgram() will build program executables. |
45 STAGING_DIR = '$DESTINATION_ROOT', | 48 STAGING_DIR = '$DESTINATION_ROOT', |
46 | 49 |
47 # Where ComponentLibrary() will build libraries. | 50 # Where ComponentLibrary() will build libraries. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 root_env['CXXCOMSTR'] = 'Compiling $TARGET ...' | 156 root_env['CXXCOMSTR'] = 'Compiling $TARGET ...' |
154 root_env['SHCCCOMSTR'] = 'Compiling $TARGET ...' | 157 root_env['SHCCCOMSTR'] = 'Compiling $TARGET ...' |
155 root_env['SHCXXCOMSTR'] = 'Compiling $TARGET ...' | 158 root_env['SHCXXCOMSTR'] = 'Compiling $TARGET ...' |
156 root_env['ARCOMSTR'] = 'Archiving $TARGET ...' | 159 root_env['ARCOMSTR'] = 'Archiving $TARGET ...' |
157 root_env['LINKCOMSTR'] = 'Linking $TARGET ...' | 160 root_env['LINKCOMSTR'] = 'Linking $TARGET ...' |
158 root_env['BINDINGSCOMSTR'] = 'Building bindings in $TARGET ...' | 161 root_env['BINDINGSCOMSTR'] = 'Building bindings in $TARGET ...' |
159 | 162 |
160 # Use timestamps change, followed by MD5 for speed | 163 # Use timestamps change, followed by MD5 for speed |
161 root_env.Decider('MD5-timestamp') | 164 root_env.Decider('MD5-timestamp') |
162 | 165 |
| 166 # Incorporate settings that should apply globally (primarily to provide |
| 167 # an obvious place for developmental experimentation). |
| 168 root_env.ApplySConscript(['$CHROME_SRC_DIR/build/common.scons']) |
163 | 169 |
164 # The list of all leaf (fully described) environments. | 170 # The list of all leaf (fully described) environments. |
165 environment_list = [] | 171 environment_list = [] |
166 | 172 |
167 | 173 |
168 # -------------------------------------------------------------------------- | 174 # -------------------------------------------------------------------------- |
169 # Decide which things to load. | 175 # Decide which things to load. |
170 # Don't put anything platform depended here, this is just to gate things | 176 # Don't put anything platform depended here, this is just to gate things |
171 # in or out for speed. | 177 # in or out for speed. |
172 | 178 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 272 |
267 # Add the final list into the root environment to be build in BuildComponents. | 273 # Add the final list into the root environment to be build in BuildComponents. |
268 root_env.Append(BUILD_SCONSCRIPTS = sconscripts) | 274 root_env.Append(BUILD_SCONSCRIPTS = sconscripts) |
269 | 275 |
270 | 276 |
271 | 277 |
272 # -------------------------------------------------------------------------- | 278 # -------------------------------------------------------------------------- |
273 # Windows specific | 279 # Windows specific |
274 | 280 |
275 windows_env = root_env.Clone() | 281 windows_env = root_env.Clone() |
276 environment_list.append(windows_env) | |
277 windows_env.Tool('target_platform_windows') | 282 windows_env.Tool('target_platform_windows') |
278 windows_env.Tool('target_debug') | |
279 windows_env.Tool('component_targets_msvs') # Per target project support. | 283 windows_env.Tool('component_targets_msvs') # Per target project support. |
280 windows_env.Tool('midl') | 284 windows_env.Tool('midl') |
281 windows_env.Replace( | |
282 BUILD_TYPE = 'debug-windows', | |
283 BUILD_TYPE_DESCRIPTION = 'Windows debug build', | |
284 ) | |
285 windows_env.Append(BUILD_GROUPS = ['default']) | |
286 | 285 |
287 # TODO(bradnelson): this is needed for now because target_platform_windows | 286 # TODO(bradnelson): target_platform_windows defines a whole bunch of |
288 # has OS_WINDOWS defined in a weird way. | 287 # flags that we don't care about, including defining OS_WINDOWS in a |
289 windows_env.FilterOut(CPPDEFINES = ['OS_WINDOWS=OS_WINDOWS']) | 288 # way that we don't want, and (most especially) adding *_DEBUG and |
| 289 # *_OPTIMIZED constructionv variables that add magic values to |
| 290 # CCFLAGS. We override the normal variables (CPPDEFINES, CCFLAGS, |
| 291 # LINKFLAGS, ARFLAGS) below, but get rid of the special Hammer ones |
| 292 # here, until Hammer can be made a little nicer about htis. |
| 293 |
| 294 del windows_env['CCFLAGS_DEBUG'] |
| 295 del windows_env['LINKFLAGS_DEBUG'] |
| 296 del windows_env['CCFLAGS_OPTIMIZED'] |
290 | 297 |
291 windows_env['PDB'] = '${TARGET.base}.pdb' | 298 windows_env['PDB'] = '${TARGET.base}.pdb' |
292 | 299 |
293 | |
294 # TODO(bradnelson): this should not need to be gated on host platform. | 300 # TODO(bradnelson): this should not need to be gated on host platform. |
295 if root_env['PLATFORM'] in ['win32', 'cygwin']: | 301 if root_env['PLATFORM'] in ['win32', 'cygwin']: |
296 msvs_env = Environment(tools=['msvc', 'mslink', 'msvs'])['ENV'] | 302 msvs_env = Environment(tools=['msvc', 'mslink', 'msvs'])['ENV'] |
297 msvs_drive = msvs_env['PATH'][0] | 303 msvs_drive = msvs_env['PATH'][0] |
298 else: | 304 else: |
299 msvs_env = {'PATH': '', 'INCLUDE': '', 'LIB': ''} | 305 msvs_env = {'PATH': '', 'INCLUDE': '', 'LIB': ''} |
300 msvs_drive = 'C' | 306 msvs_drive = 'C' |
301 | 307 |
302 # Use the absolute path for MSVC because it might not be on the same drive | 308 # Use the absolute path for MSVC because it might not be on the same drive |
303 # as our source checkout. | 309 # as our source checkout. |
304 visual_studio_path = msvs_drive + ':/Program Files/Microsoft Visual Studio 8' | 310 visual_studio_path = msvs_drive + ':/Program Files/Microsoft Visual Studio 8' |
305 | 311 |
306 windows_env.Replace( | 312 windows_env.Replace( |
307 CSCRIPT = 'c:\\Windows\\System32\\cscript', | 313 CSCRIPT = 'c:\\Windows\\System32\\cscript', |
308 | 314 |
309 PLATFORMSDK_VISTA_REL = '../third_party/platformsdk_vista_6_0', | 315 PLATFORMSDK_VISTA_REL = '../third_party/platformsdk_vista_6_0', |
310 PLATFORMSDK_VISTA = '$CHROME_SRC_DIR/third_party/platformsdk_vista_6_0', | 316 PLATFORMSDK_VISTA = '$CHROME_SRC_DIR/third_party/platformsdk_vista_6_0', |
311 VISUAL_STUDIO = visual_studio_path, | 317 VISUAL_STUDIO = visual_studio_path, |
312 | 318 |
313 CYGWIN_DIR = windows_env.Dir('$CHROME_SRC_DIR/third_party/cygwin'), | 319 CYGWIN_DIR = windows_env.Dir('$CHROME_SRC_DIR/third_party/cygwin'), |
314 CYGWIN_BIN_DIR = '$CYGWIN_DIR/bin', | 320 CYGWIN_BIN_DIR = '$CYGWIN_DIR/bin', |
315 | 321 |
316 PERL = '$CYGWIN_BIN_DIR/perl.exe', | 322 PERL = '$CYGWIN_BIN_DIR/perl.exe', |
317 | 323 |
318 MSVS_ENV = msvs_env, | 324 MSVS_ENV = msvs_env, |
319 | 325 |
320 YACC = '$CYGWIN_BIN_DIR/bison.exe', | 326 YACC = '$CYGWIN_BIN_DIR/bison.exe', |
321 ) | |
322 | 327 |
323 windows_env.Append( | |
324 ARFLAGS = [ | 328 ARFLAGS = [ |
325 '/nologo', | 329 '/nologo', |
326 ], | 330 ], |
327 | 331 |
328 CCFLAGS = [ | 332 CCFLAGS = [ |
329 '/nologo', | 333 '/nologo', |
330 | |
331 '/Od', # no optimization | |
332 | |
333 '/RTC1', | |
334 '/MTd', # static link to crt, and debug version | |
335 '/Gy', | |
336 '/GR-', | |
337 | |
338 '/W3', | |
339 | |
340 '/Z7', | |
341 | |
342 '/errorReport:prompt', | 334 '/errorReport:prompt', |
343 | |
344 '/wd4503', | |
345 '/wd4819', | |
346 ], | 335 ], |
347 | 336 |
348 CPPDEFINES = [ | 337 CPPDEFINES = [ |
349 '_CRT_SECURE_NO_DEPRECATE', | |
350 '_CRT_NONSTDC_NO_WARNINGS', | |
351 '_CRT_NONSTDC_NO_DEPRECATE', | |
352 '_SCL_SECURE_NO_DEPRECATE', | |
353 | |
354 '_DEBUG', | |
355 | |
356 '_CRT_RAND_S', | |
357 ('_WIN32_WINNT', '0x0600'), | |
358 ('WINVER', '0x0600'), | |
359 'WIN32', | |
360 '_WINDOWS', | |
361 ('_HAS_EXCEPTIONS', 0), | |
362 'NOMINMAX', | |
363 '_UNICODE', | 338 '_UNICODE', |
364 'UNICODE', | 339 'UNICODE', |
365 | |
366 'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS', | |
367 'WIN32_LEAN_AND_MEAN', | |
368 ], | 340 ], |
369 | 341 |
370 CPPPATH = [ | |
371 '$PLATFORMSDK_VISTA/files/Include', | |
372 '$PLATFORMSDK_VISTA/files/VC/INCLUDE', | |
373 '$VISUAL_STUDIO/VC/atlmfc/include', | |
374 ], | |
375 | 342 |
376 LIBS = [ | 343 LIBS = [ |
377 'advapi32.lib', | 344 'advapi32.lib', |
378 'comdlg32.lib', | 345 'comdlg32.lib', |
379 'gdi32.lib', | 346 'gdi32.lib', |
380 'kernel32.lib', | 347 'kernel32.lib', |
381 'msimg32.lib', | |
382 'odbc32.lib', | 348 'odbc32.lib', |
383 'odbccp32.lib', | 349 'odbccp32.lib', |
384 'ole32.lib', | 350 'ole32.lib', |
385 'oleaut32.lib', | 351 'oleaut32.lib', |
386 'psapi.lib', | |
387 'shell32.lib', | 352 'shell32.lib', |
388 'user32.lib', | 353 'user32.lib', |
389 'usp10.lib', | |
390 'uuid.lib', | 354 'uuid.lib', |
391 'version.lib', | |
392 'wininet.lib', | |
393 'winspool.lib', | 355 'winspool.lib', |
394 'ws2_32.lib', | |
395 | 356 |
396 'DelayImp.lib', | 357 'DelayImp.lib', |
397 ], | 358 ], |
398 | 359 |
399 LINKFLAGS = [ | 360 LINKFLAGS = [ |
400 '/nologo', | 361 '/nologo', |
401 '/DEBUG', | |
402 ], | 362 ], |
403 | 363 |
404 ICU_LIBS = ['icu'], | 364 ICU_LIBS = ['icu'], |
405 ) | 365 ) |
406 | 366 |
407 windows_env.Append( | |
408 LIBPATH = [ | |
409 '$PLATFORMSDK_VISTA/files/Lib', | |
410 '$PLATFORMSDK_VISTA/files/VC/LIB', | |
411 '$VISUAL_STUDIO/VC/atlmfc/lib', | |
412 ], | |
413 ) | |
414 | |
415 # TODO(sgk): remove once we upgrade to SCons 0.98.4 | |
416 for var in ['INCLUDE', 'LIB', 'PATH']: | |
417 msvs_env[var] = msvs_env[var].split('|', 1)[0] | |
418 windows_env['ENV'][var] = windows_env['ENV'][var].split('|', 1)[0] | |
419 | |
420 # Force scons to handle long include lines correctly. | 367 # Force scons to handle long include lines correctly. |
421 pchcom_fixed = windows_env['PCHCOM'] | 368 pchcom_fixed = windows_env['PCHCOM'] |
422 pchcom_fixed = pchcom_fixed.replace('${TARGETS[0]}', '$TARGET') | 369 pchcom_fixed = pchcom_fixed.replace('${TARGETS[0]}', '$TARGET') |
423 pchcom_fixed = pchcom_fixed.replace('${TARGETS[1]}', '$TARGETS1') | 370 pchcom_fixed = pchcom_fixed.replace('${TARGETS[1]}', '$TARGETS1') |
424 | 371 |
| 372 # Below, we'll redefine $CXXFLAGS so its expansion doesn't include |
| 373 # $CCFLAGS. Modify $PCHCOM, which was relying on this fact, so |
| 374 # that $CCFLAGS still shows up in precompiled header compilations. |
| 375 pchcom_fixed = pchcom_fixed.replace('$CXXFLAGS', '$CXXFLAGS $CCFLAGS') |
| 376 |
425 windows_env.Replace( | 377 windows_env.Replace( |
426 CCCOM = "${TEMPFILE('%s')}" % windows_env['CCCOM'], | 378 CCCOM = "${TEMPFILE('%s')}" % windows_env['CCCOM'], |
427 CXXCOM = "${TEMPFILE('%s')}" % windows_env['CXXCOM'], | 379 CXXCOM = "${TEMPFILE('%s')}" % windows_env['CXXCOM'], |
428 SHCCCOM = "${TEMPFILE('%s')}" % windows_env['SHCCCOM'], | 380 SHCCCOM = "${TEMPFILE('%s')}" % windows_env['SHCCCOM'], |
429 SHCXXCOM = "${TEMPFILE('%s')}" % windows_env['SHCXXCOM'], | 381 SHCXXCOM = "${TEMPFILE('%s')}" % windows_env['SHCXXCOM'], |
430 PCHCOM = "${TEMPFILE('%s')}" % pchcom_fixed, | 382 PCHCOM = "${TEMPFILE('%s')}" % pchcom_fixed, |
431 TARGETS1 = '${TARGETS[1]}', | 383 TARGETS1 = '${TARGETS[1]}', |
| 384 |
| 385 # The SCons default for $CXXFLAGS contains $CCFLAGS, which is |
| 386 # also on the $CCCOM command line string separately. Redefine |
| 387 # $CXXFLAGS to avoid the duplication |
| 388 CXXFLAGS = '$( /TP $)', |
432 ) | 389 ) |
433 | 390 |
434 windows_env['ENV']['PROGRAMFILES'] = os.environ.get('PROGRAMFILES', '') | 391 windows_env['ENV']['PROGRAMFILES'] = os.environ.get('PROGRAMFILES', '') |
435 windows_env['ENV']['SystemDrive'] = os.environ.get('SystemDrive', '') | 392 windows_env['ENV']['SystemDrive'] = os.environ.get('SystemDrive', '') |
436 windows_env['ENV']['USERPROFILE'] = os.environ.get('USERPROFILE', '') | 393 windows_env['ENV']['USERPROFILE'] = os.environ.get('USERPROFILE', '') |
437 | 394 |
438 windows_env.AppendENVPath('PATH', ';C:\\WINDOWS\\system32') | 395 windows_env.AppendENVPath('PATH', ';C:\\WINDOWS\\system32') |
439 | 396 |
| 397 windows_dbg = windows_env.Clone() |
| 398 environment_list.append(windows_dbg) |
| 399 windows_dbg.Replace( |
| 400 BUILD_TYPE = 'dbg', |
| 401 BUILD_TYPE_DESCRIPTION = 'Windows debug build', |
| 402 ) |
| 403 windows_dbg.Tool('target_debug') |
| 404 windows_dbg.ApplySConscript(['$CHROME_SRC_DIR/build/debug.scons']) |
| 405 windows_dbg.Append(BUILD_GROUPS = ['default']) |
| 406 |
| 407 windows_opt = windows_env.Clone() |
| 408 environment_list.append(windows_opt) |
| 409 windows_opt.Replace( |
| 410 BUILD_TYPE = 'opt', |
| 411 BUILD_TYPE_DESCRIPTION = 'Windows optimized build', |
| 412 ) |
| 413 windows_opt.Tool('target_optimized') |
| 414 windows_opt.ApplySConscript(['$CHROME_SRC_DIR/build/release.scons']) |
440 | 415 |
441 # -------------------------------------------------------------------------- | 416 # -------------------------------------------------------------------------- |
442 # Linux specific | 417 # Linux specific |
443 | 418 |
444 linux_env = root_env.Clone() | 419 linux_env = root_env.Clone() |
445 linux_env.Tool('target_platform_linux') | 420 linux_env.Tool('target_platform_linux') |
446 linux_env.Tool('yacc') | 421 linux_env.Tool('yacc') |
447 | 422 |
448 # TODO(bradnelson): this is needed for now because target_platform_linux has | 423 # TODO(bradnelson): this is needed for now because target_platform_linux has |
449 # OS_LINUX defined in a weird way. | 424 # OS_LINUX defined in a weird way. |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 'all_libraries', | 764 'all_libraries', |
790 'all_languages', | 765 'all_languages', |
791 'all_programs', | 766 'all_programs', |
792 'all_test_programs', | 767 'all_test_programs', |
793 ], projects = [p], | 768 ], projects = [p], |
794 COMPONENT_VS_PROJECT_SCRIPT_PATH=( | 769 COMPONENT_VS_PROJECT_SCRIPT_PATH=( |
795 'cd $$(ProjectDir)/$VS_PROJECT_TO_MAIN_DIR && hammer.bat'), | 770 'cd $$(ProjectDir)/$VS_PROJECT_TO_MAIN_DIR && hammer.bat'), |
796 ) | 771 ) |
797 | 772 |
798 # ------------------------------------------------------------------------- | 773 # ------------------------------------------------------------------------- |
OLD | NEW |