Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. 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 """ | 5 """ |
| 6 This module helps emulate Visual Studio 2008 behavior on top of other | 6 This module helps emulate Visual Studio 2008 behavior on top of other |
| 7 build systems, primarily ninja. | 7 build systems, primarily ninja. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import os | 10 import os |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 config = self._RealConfig(config) | 270 config = self._RealConfig(config) |
| 271 type = self.spec['type'] | 271 type = self.spec['type'] |
| 272 root = 'VCLibrarianTool' if type == 'static_library' else 'VCLinkerTool' | 272 root = 'VCLibrarianTool' if type == 'static_library' else 'VCLinkerTool' |
| 273 # TODO(scottmg): Handle OutputDirectory without OutputFile. | 273 # TODO(scottmg): Handle OutputDirectory without OutputFile. |
| 274 output_file = self._Setting((root, 'OutputFile'), config) | 274 output_file = self._Setting((root, 'OutputFile'), config) |
| 275 if output_file: | 275 if output_file: |
| 276 output_file = expand_special(self.ConvertVSMacros( | 276 output_file = expand_special(self.ConvertVSMacros( |
| 277 output_file, config=config)) | 277 output_file, config=config)) |
| 278 return output_file | 278 return output_file |
| 279 | 279 |
| 280 def GetPDBName(self, config, expand_special): | |
| 281 """Gets the explicitly overridden pdb name for a target or returns None | |
| 282 if it's not overridden.""" | |
| 283 config = self._RealConfig(config) | |
|
scottmg
2012/11/02 22:32:36
remove
noelallen1
2012/11/02 23:18:23
I don't need the _RealConfig in this case since th
| |
| 284 output_file = self._Setting(('VCLinkerTool', 'ProgramDatabaseFile'), config) | |
| 285 if output_file: | |
| 286 output_file = expand_special(self.ConvertVSMacros( | |
| 287 output_file, config=config)) | |
| 288 return output_file | |
| 289 | |
| 280 def GetCflags(self, config): | 290 def GetCflags(self, config): |
| 281 """Returns the flags that need to be added to .c and .cc compilations.""" | 291 """Returns the flags that need to be added to .c and .cc compilations.""" |
| 282 config = self._RealConfig(config) | 292 config = self._RealConfig(config) |
| 283 cflags = [] | 293 cflags = [] |
| 284 cflags.extend(['/wd' + w for w in self.msvs_disabled_warnings[config]]) | 294 cflags.extend(['/wd' + w for w in self.msvs_disabled_warnings[config]]) |
| 285 cl = self._GetWrapper(self, self.msvs_settings[config], | 295 cl = self._GetWrapper(self, self.msvs_settings[config], |
| 286 'VCCLCompilerTool', append=cflags) | 296 'VCCLCompilerTool', append=cflags) |
| 287 cl('Optimization', | 297 cl('Optimization', |
| 288 map={'0': 'd', '1': '1', '2': '2', '3': 'x'}, prefix='/O') | 298 map={'0': 'd', '1': '1', '2': '2', '3': 'x'}, prefix='/O') |
| 289 cl('InlineFunctionExpansion', prefix='/Ob') | 299 cl('InlineFunctionExpansion', prefix='/Ob') |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 381 'VCLinkerTool', append=ldflags) | 391 'VCLinkerTool', append=ldflags) |
| 382 self._GetDefFileAsLdflags(self.spec, ldflags, gyp_to_build_path) | 392 self._GetDefFileAsLdflags(self.spec, ldflags, gyp_to_build_path) |
| 383 ld('GenerateDebugInformation', map={'true': '/DEBUG'}) | 393 ld('GenerateDebugInformation', map={'true': '/DEBUG'}) |
| 384 ld('TargetMachine', map={'1': 'X86', '17': 'X64'}, prefix='/MACHINE:') | 394 ld('TargetMachine', map={'1': 'X86', '17': 'X64'}, prefix='/MACHINE:') |
| 385 ldflags.extend(self._GetAdditionalLibraryDirectories( | 395 ldflags.extend(self._GetAdditionalLibraryDirectories( |
| 386 'VCLinkerTool', config, gyp_to_build_path)) | 396 'VCLinkerTool', config, gyp_to_build_path)) |
| 387 ld('DelayLoadDLLs', prefix='/DELAYLOAD:') | 397 ld('DelayLoadDLLs', prefix='/DELAYLOAD:') |
| 388 out = self.GetOutputName(config, expand_special) | 398 out = self.GetOutputName(config, expand_special) |
| 389 if out: | 399 if out: |
| 390 ldflags.append('/OUT:' + out) | 400 ldflags.append('/OUT:' + out) |
| 401 pdb = self.GetPDBName(config, expand_special) | |
| 402 if pdb: | |
| 403 ldflags.append('/PDB:' + pdb) | |
| 391 ld('AdditionalOptions', prefix='') | 404 ld('AdditionalOptions', prefix='') |
| 392 ld('SubSystem', map={'1': 'CONSOLE', '2': 'WINDOWS'}, prefix='/SUBSYSTEM:') | 405 ld('SubSystem', map={'1': 'CONSOLE', '2': 'WINDOWS'}, prefix='/SUBSYSTEM:') |
| 393 ld('LinkIncremental', map={'1': ':NO', '2': ''}, prefix='/INCREMENTAL') | 406 ld('LinkIncremental', map={'1': ':NO', '2': ''}, prefix='/INCREMENTAL') |
| 394 ld('FixedBaseAddress', map={'1': ':NO', '2': ''}, prefix='/FIXED') | 407 ld('FixedBaseAddress', map={'1': ':NO', '2': ''}, prefix='/FIXED') |
| 395 ld('RandomizedBaseAddress', | 408 ld('RandomizedBaseAddress', |
| 396 map={'1': ':NO', '2': ''}, prefix='/DYNAMICBASE') | 409 map={'1': ':NO', '2': ''}, prefix='/DYNAMICBASE') |
| 397 ld('DataExecutionPrevention', | 410 ld('DataExecutionPrevention', |
| 398 map={'1': ':NO', '2': ''}, prefix='/NXCOMPAT') | 411 map={'1': ':NO', '2': ''}, prefix='/NXCOMPAT') |
| 399 ld('OptimizeReferences', map={'1': 'NOREF', '2': 'REF'}, prefix='/OPT:') | 412 ld('OptimizeReferences', map={'1': 'NOREF', '2': 'REF'}, prefix='/OPT:') |
| 400 ld('EnableCOMDATFolding', map={'1': 'NOICF', '2': 'ICF'}, prefix='/OPT:') | 413 ld('EnableCOMDATFolding', map={'1': 'NOICF', '2': 'ICF'}, prefix='/OPT:') |
| 401 ld('LinkTimeCodeGeneration', map={'1': '/LTCG'}) | 414 ld('LinkTimeCodeGeneration', map={'1': '/LTCG'}) |
| 402 ld('IgnoreDefaultLibraryNames', prefix='/NODEFAULTLIB:') | 415 ld('IgnoreDefaultLibraryNames', prefix='/NODEFAULTLIB:') |
| 403 ld('ResourceOnlyDLL', map={'true': '/NOENTRY'}) | 416 ld('ResourceOnlyDLL', map={'true': '/NOENTRY'}) |
| 404 ld('EntryPointSymbol', prefix='/ENTRY:') | 417 ld('EntryPointSymbol', prefix='/ENTRY:') |
| 405 ld('ProgramDatabaseFile', prefix='/PDB:') | |
| 406 ld('Profile', map={ 'true': '/PROFILE'}) | 418 ld('Profile', map={ 'true': '/PROFILE'}) |
| 407 # TODO(scottmg): This should sort of be somewhere else (not really a flag). | 419 # TODO(scottmg): This should sort of be somewhere else (not really a flag). |
| 408 ld('AdditionalDependencies', prefix='') | 420 ld('AdditionalDependencies', prefix='') |
| 409 # TODO(scottmg): These too. | 421 # TODO(scottmg): These too. |
| 410 ldflags.extend(('kernel32.lib', 'user32.lib', 'gdi32.lib', 'winspool.lib', | 422 ldflags.extend(('kernel32.lib', 'user32.lib', 'gdi32.lib', 'winspool.lib', |
| 411 'comdlg32.lib', 'advapi32.lib', 'shell32.lib', 'ole32.lib', | 423 'comdlg32.lib', 'advapi32.lib', 'shell32.lib', 'ole32.lib', |
| 412 'oleaut32.lib', 'uuid.lib', 'odbc32.lib', 'DelayImp.lib')) | 424 'oleaut32.lib', 'uuid.lib', 'odbc32.lib', 'DelayImp.lib')) |
| 413 | 425 |
| 414 # If the base address is not specifically controlled, DYNAMICBASE should | 426 # If the base address is not specifically controlled, DYNAMICBASE should |
| 415 # be on by default. | 427 # be on by default. |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 701 so they're not surprised when the VS build fails.""" | 713 so they're not surprised when the VS build fails.""" |
| 702 if int(generator_flags.get('msvs_error_on_missing_sources', 0)): | 714 if int(generator_flags.get('msvs_error_on_missing_sources', 0)): |
| 703 no_specials = filter(lambda x: '$' not in x, sources) | 715 no_specials = filter(lambda x: '$' not in x, sources) |
| 704 relative = [os.path.join(build_dir, gyp_to_ninja(s)) for s in no_specials] | 716 relative = [os.path.join(build_dir, gyp_to_ninja(s)) for s in no_specials] |
| 705 missing = filter(lambda x: not os.path.exists(x), relative) | 717 missing = filter(lambda x: not os.path.exists(x), relative) |
| 706 if missing: | 718 if missing: |
| 707 # They'll look like out\Release\..\..\stuff\things.cc, so normalize the | 719 # They'll look like out\Release\..\..\stuff\things.cc, so normalize the |
| 708 # path for a slightly less crazy looking output. | 720 # path for a slightly less crazy looking output. |
| 709 cleaned_up = [os.path.normpath(x) for x in missing] | 721 cleaned_up = [os.path.normpath(x) for x in missing] |
| 710 raise Exception('Missing input files:\n%s' % '\n'.join(cleaned_up)) | 722 raise Exception('Missing input files:\n%s' % '\n'.join(cleaned_up)) |
| OLD | NEW |