OLD | NEW |
1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python2.4 |
2 # Copyright 2009, Google Inc. | 2 # Copyright 2009, Google Inc. |
3 # All rights reserved. | 3 # All rights reserved. |
4 # | 4 # |
5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
7 # met: | 7 # met: |
8 # | 8 # |
9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 WaitForWritable([env.File(dest)], None, env) | 254 WaitForWritable([env.File(dest)], None, env) |
255 env.Execute('$COVERAGE_VSINSTR /COVERAGE "%s"' % dest) | 255 env.Execute('$COVERAGE_VSINSTR /COVERAGE "%s"' % dest) |
256 else: | 256 else: |
257 env['PRECOVERAGE_INSTALL'](dest, source, env) | 257 env['PRECOVERAGE_INSTALL'](dest, source, env) |
258 | 258 |
259 | 259 |
260 def generate(env): | 260 def generate(env): |
261 # NOTE: SCons requires the use of this name, which fails gpylint. | 261 # NOTE: SCons requires the use of this name, which fails gpylint. |
262 """SCons entry point for this tool.""" | 262 """SCons entry point for this tool.""" |
263 | 263 |
264 # TODO(ncbray): Several sections here are gated out on to prevent failure on | 264 # TODO: Several sections here are gated out on the mac to prevent failure. |
265 # non-windows platforms. This appears to be SCons issue 1720 manifesting | 265 # This appears to be SCons issue 1720 manifesting itself on Mac when using |
266 # itself. A more principled fix would be nice. | 266 # windows tools like msvs or msvc. |
267 | |
268 use_msvc_tools = env['PLATFORM'] in ('win32', 'cygwin') | |
269 | 267 |
270 # Preserve some variables that get blown away by the tools. | 268 # Preserve some variables that get blown away by the tools. |
271 saved = dict() | 269 saved = dict() |
272 for k in ['CFLAGS', 'CCFLAGS', 'CXXFLAGS', 'LINKFLAGS', 'LIBS']: | 270 for k in ['CFLAGS', 'CCFLAGS', 'CXXFLAGS', 'LINKFLAGS', 'LIBS']: |
273 saved[k] = env.get(k, []) | 271 saved[k] = env.get(k, []) |
274 env[k] = [] | 272 env[k] = [] |
275 | 273 |
276 # Bring in the outside PATH, INCLUDE, and LIB if not blocked. | 274 # Bring in the outside PATH, INCLUDE, and LIB if not blocked. |
277 if not env.get('MSVC_BLOCK_ENVIRONMENT_CHANGES'): | 275 if not env.get('MSVC_BLOCK_ENVIRONMENT_CHANGES'): |
278 env.AppendENVPath('PATH', os.environ.get('PATH', '[]')) | 276 env.AppendENVPath('PATH', os.environ.get('PATH', '[]')) |
279 env.AppendENVPath('INCLUDE', os.environ.get('INCLUDE', '[]')) | 277 env.AppendENVPath('INCLUDE', os.environ.get('INCLUDE', '[]')) |
280 env.AppendENVPath('LIB', os.environ.get('LIB', '[]')) | 278 env.AppendENVPath('LIB', os.environ.get('LIB', '[]')) |
281 | 279 |
282 # Load various Visual Studio related tools. | 280 # Load various Visual Studio related tools. |
283 if use_msvc_tools: | 281 if env['PLATFORM'] != 'darwin': |
284 env.Tool('as') | 282 env.Tool('as') |
285 env.Tool('msvs') | 283 env.Tool('msvs') |
286 env.Tool('windows_hard_link') | 284 env.Tool('windows_hard_link') |
287 | 285 |
288 pre_msvc_env = env['ENV'].copy() | 286 pre_msvc_env = env['ENV'].copy() |
289 | 287 |
290 if use_msvc_tools: | 288 if env['PLATFORM'] != 'darwin': |
291 env.Tool('msvc') | 289 env.Tool('msvc') |
292 env.Tool('mslib') | 290 env.Tool('mslib') |
293 env.Tool('mslink') | 291 env.Tool('mslink') |
294 | 292 |
295 # Find VC80_DIR if it isn't already set. | 293 # Find VC80_DIR if it isn't already set. |
296 if not env.get('VC80_DIR'): | 294 if not env.get('VC80_DIR'): |
297 # Look in each directory in the path for cl.exe. | 295 # Look in each directory in the path for cl.exe. |
298 for p in env['ENV']['PATH'].split(os.pathsep): | 296 for p in env['ENV']['PATH'].split(os.pathsep): |
299 # Use the directory two layers up if it exists. | 297 # Use the directory two layers up if it exists. |
300 if os.path.exists(os.path.join(p, 'cl.exe')): | 298 if os.path.exists(os.path.join(p, 'cl.exe')): |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 LINKFLAGS_OPTIMIZED=['/PDBALTPATH:%_PDB%'], | 407 LINKFLAGS_OPTIMIZED=['/PDBALTPATH:%_PDB%'], |
410 | 408 |
411 # Settings for component_builders | 409 # Settings for component_builders |
412 COMPONENT_LIBRARY_LINK_SUFFIXES=['.lib'], | 410 COMPONENT_LIBRARY_LINK_SUFFIXES=['.lib'], |
413 COMPONENT_LIBRARY_DEBUG_SUFFIXES=['.pdb'], | 411 COMPONENT_LIBRARY_DEBUG_SUFFIXES=['.pdb'], |
414 ) | 412 ) |
415 | 413 |
416 # TODO: mslink.py creates a shlibLinkAction which doesn't specify | 414 # TODO: mslink.py creates a shlibLinkAction which doesn't specify |
417 # '$SHLINKCOMSTR' as its command string. This breaks --brief. For now, | 415 # '$SHLINKCOMSTR' as its command string. This breaks --brief. For now, |
418 # hack into the existing action and override its command string. | 416 # hack into the existing action and override its command string. |
419 if use_msvc_tools: | 417 if env['PLATFORM'] != 'darwin': |
420 env['SHLINKCOM'].list[0].cmdstr = '$SHLINKCOMSTR' | 418 env['SHLINKCOM'].list[0].cmdstr = '$SHLINKCOMSTR' |
421 | 419 |
422 # Restore saved flags. | 420 # Restore saved flags. |
423 env.Append(**saved) | 421 env.Append(**saved) |
OLD | NEW |