Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: site_scons/site_tools/target_platform_windows.py

Issue 8117: Pulling in latest software construction toolkit. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « site_scons/site_tools/target_platform_mac.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python2.4 1 #!/usr/bin/python2.4
2 # Copyright 2008, Google Inc. 2 # Copyright 2008, 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 like: 96 like:
97 97
98 mt.exe : general error c101008d: Failed to write the updated manifest to 98 mt.exe : general error c101008d: Failed to write the updated manifest to
99 the resource of file "(name of exe)". Access is denied. 99 the resource of file "(name of exe)". Access is denied.
100 100
101 with mt.exe returning an errorlevel (return code) of 31. The workaround is 101 with mt.exe returning an errorlevel (return code) of 31. The workaround is
102 to retry running mt.exe after a short delay. 102 to retry running mt.exe after a short delay.
103 """ 103 """
104 104
105 cmdline = env.subst( 105 cmdline = env.subst(
106 'mt.exe -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;%d' 106 'mt.exe -nologo -manifest "$MANIFEST_FILE" -outputresource:"$TARGET";%d'
107 % resource_num, 107 % resource_num,
108 target=target, source=source) 108 target=target, source=source)
109 print cmdline 109 print cmdline
110 110
111 for retry in range(5): 111 for retry in range(5):
112 # If this is a retry, print a message and delay first 112 # If this is a retry, print a message and delay first
113 if retry: 113 if retry:
114 # mt.exe failed to write to the target file. Print a warning message, 114 # mt.exe failed to write to the target file. Print a warning message,
115 # delay 3 seconds, and retry. 115 # delay 3 seconds, and retry.
116 print 'Warning: mt.exe failed to write to %s; retrying.' % target[0] 116 print 'Warning: mt.exe failed to write to %s; retrying.' % target[0]
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 LINKFLAGS=['/SUBSYSTEM:CONSOLE'], 172 LINKFLAGS=['/SUBSYSTEM:CONSOLE'],
173 ) 173 )
174 174
175 #------------------------------------------------------------------------------ 175 #------------------------------------------------------------------------------
176 176
177 177
178 def generate(env): 178 def generate(env):
179 # NOTE: SCons requires the use of this name, which fails gpylint. 179 # NOTE: SCons requires the use of this name, which fails gpylint.
180 """SCons entry point for this tool.""" 180 """SCons entry point for this tool."""
181 181
182 # Set up environment paths first 182 # Bring in the outside PATH, INCLUDE, and LIB if not blocked.
183 if not env.get('MSVC_BLOCK_ENVIRONMENT_CHANGES'):
184 env.AppendENVPath('PATH', os.environ.get('PATH', '[]'))
185 env.AppendENVPath('INCLUDE', os.environ.get('INCLUDE', '[]'))
186 env.AppendENVPath('LIB', os.environ.get('LIB', '[]'))
183 187
184 # Load various Visual Studio related tools. 188 # Load various Visual Studio related tools.
185 env.Tool('as') 189 env.Tool('as')
186 env.Tool('msvs') 190 env.Tool('msvs')
187 env.Tool('windows_hard_link') 191 env.Tool('windows_hard_link')
188 192
189 pre_msvc_env = env['ENV'].copy() 193 pre_msvc_env = env['ENV'].copy()
190 194
191 env.Tool('msvc') 195 env.Tool('msvc')
192 env.Tool('mslib') 196 env.Tool('mslib')
193 env.Tool('mslink') 197 env.Tool('mslink')
194 198
199 # Find VC80_DIR if it isn't already set.
200 if not env.get('VC80_DIR'):
201 # Look in each directory in the path for cl.exe.
202 for p in env['ENV']['PATH'].split(os.pathsep):
203 # Use the directory two layers up if it exists.
204 if os.path.exists(os.path.join(p, 'cl.exe')):
205 env['VC80_DIR'] = os.path.dirname(os.path.dirname(p))
206
195 # The msvc, mslink, and mslib tools search the registry for installed copies 207 # The msvc, mslink, and mslib tools search the registry for installed copies
196 # of Visual Studio and prepends them to the PATH, INCLUDE, and LIB 208 # of Visual Studio and prepends them to the PATH, INCLUDE, and LIB
197 # environment variables. Block these changes if necessary. 209 # environment variables. Block these changes if necessary.
198 if env.get('MSVC_BLOCK_ENVIRONMENT_CHANGES'): 210 if env.get('MSVC_BLOCK_ENVIRONMENT_CHANGES'):
199 env['ENV'] = pre_msvc_env 211 env['ENV'] = pre_msvc_env
200 212
201 # Declare bits 213 # Declare bits
202 DeclareBit('windows', 'Target platform is windows.', 214 DeclareBit('windows', 'Target platform is windows.',
203 exclusive_groups=('target_platform')) 215 exclusive_groups=('target_platform'))
204 env.SetBits('windows') 216 env.SetBits('windows')
205 217
206 env.Replace( 218 env.Replace(
207 TARGET_PLATFORM='WINDOWS', 219 TARGET_PLATFORM='WINDOWS',
208 COMPONENT_PLATFORM_SETUP=ComponentPlatformSetup, 220 COMPONENT_PLATFORM_SETUP=ComponentPlatformSetup,
209 221
210 # A better rebuild command (actually cleans, then rebuild) 222 # A better rebuild command (actually cleans, then rebuild)
211 MSVSREBUILDCOM=''.join(['$MSVSSCONSCOM -c "$MSVSBUILDTARGET" && ', 223 MSVSREBUILDCOM=''.join(['$MSVSSCONSCOM -c "$MSVSBUILDTARGET" && ',
212 '$MSVSSCONSCOM "$MSVSBUILDTARGET"']), 224 '$MSVSSCONSCOM "$MSVSBUILDTARGET"']),
225
226 CCFLAG_INCLUDE='/FI', # Command line option to include a header
213 ) 227 )
214 228
215 env.Append( 229 env.Append(
216 HOST_PLATFORMS=['WINDOWS'], 230 HOST_PLATFORMS=['WINDOWS'],
217 CPPDEFINES=['OS_WINDOWS=OS_WINDOWS'], 231 CPPDEFINES=['OS_WINDOWS=OS_WINDOWS'],
218 232
219 # Turn up the warning level 233 # Turn up the warning level
220 CCFLAGS=['/W3'], 234 CCFLAGS=['/W3'],
221 235
222 # Force x86 platform for now 236 # Force x86 platform for now
(...skipping 14 matching lines...) Expand all
237 '/MT', # link with LIBCMT.LIB (multi-threaded, static linked crt) 251 '/MT', # link with LIBCMT.LIB (multi-threaded, static linked crt)
238 '/GS', # enable security checks 252 '/GS', # enable security checks
239 ], 253 ],
240 254
241 # Settings for component_builders 255 # Settings for component_builders
242 COMPONENT_LIBRARY_LINK_SUFFIXES=['.lib'], 256 COMPONENT_LIBRARY_LINK_SUFFIXES=['.lib'],
243 COMPONENT_LIBRARY_DEBUG_SUFFIXES=['.pdb'], 257 COMPONENT_LIBRARY_DEBUG_SUFFIXES=['.pdb'],
244 ) 258 )
245 259
246 # Add manifests to EXEs and DLLs 260 # Add manifests to EXEs and DLLs
261 env['MANIFEST_FILE'] = '${TARGET}.manifest' # To allow override.
247 wait_action = SCons.Script.Action(WaitForWritable, 262 wait_action = SCons.Script.Action(WaitForWritable,
248 lambda target, source, env: ''), 263 lambda target, source, env: ''),
249 env['LINKCOM'] = [ 264 env['LINKCOM'] = [
250 env['LINKCOM'], 265 env['LINKCOM'],
251 SCons.Script.Action(RunManifestExe, lambda target, source, env: ''), 266 SCons.Script.Action(RunManifestExe, lambda target, source, env: ''),
252 SCons.Script.Delete('${TARGET}.manifest'), 267 SCons.Script.Delete('${TARGET}.manifest'),
253 wait_action, 268 wait_action,
254 ] 269 ]
255 env['SHLINKCOM'] = [ 270 env['SHLINKCOM'] = [
256 env['SHLINKCOM'], 271 env['SHLINKCOM'],
257 SCons.Script.Action(RunManifestDll, lambda target, source, env: ''), 272 SCons.Script.Action(RunManifestDll, lambda target, source, env: ''),
258 SCons.Script.Delete('${TARGET}.manifest'), 273 SCons.Script.Delete('${TARGET}.manifest'),
259 wait_action, 274 wait_action,
260 ] 275 ]
261 env['WINDOWS_INSERT_MANIFESTS'] = True 276 env['WINDOWS_INSERT_MANIFESTS'] = True
262 env.Append(LINKFLAGS=['-manifest']) 277 env.Append(LINKFLAGS=['-manifest'])
OLDNEW
« no previous file with comments | « site_scons/site_tools/target_platform_mac.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698