Permalink
Browse files

Update ProgramDatabaseFile for Ninja

Replace simple text with OutputFile style expansion to
handle cases where $(OutDir) or other VS Macros are used.

R=scottmg@chromium.org
Review URL: https://codereview.chromium.org/11368059

git-svn-id: http://gyp.googlecode.com/svn/trunk@1532 78cadc50-ecff-11dd-a971-7dbc132099af
  • Loading branch information...
1 parent 171d088 commit 10defb6b1dea70c51076dce765d2e359b7943de7 noelallen@chromium.org committed Nov 3, 2012
Showing with 37 additions and 7 deletions.
  1. +13 −1 pylib/gyp/msvs_emulation.py
  2. +5 −3 test/win/gyptest-link-pdb.py
  3. +19 −3 test/win/linker-flags/program-database.gyp
@@ -277,6 +277,16 @@ def GetOutputName(self, config, expand_special):
output_file, config=config))
return output_file
+ def GetPDBName(self, config, expand_special):
+ """Gets the explicitly overridden pdb name for a target or returns None
+ if it's not overridden."""
+ config = self._RealConfig(config)
+ output_file = self._Setting(('VCLinkerTool', 'ProgramDatabaseFile'), config)
+ if output_file:
+ output_file = expand_special(self.ConvertVSMacros(
+ output_file, config=config))
+ return output_file
+
def GetCflags(self, config):
"""Returns the flags that need to be added to .c and .cc compilations."""
config = self._RealConfig(config)
@@ -388,6 +398,9 @@ def GetLdflags(self, config, gyp_to_build_path, expand_special,
out = self.GetOutputName(config, expand_special)
if out:
ldflags.append('/OUT:' + out)
+ pdb = self.GetPDBName(config, expand_special)
+ if pdb:
+ ldflags.append('/PDB:' + pdb)
ld('AdditionalOptions', prefix='')
ld('SubSystem', map={'1': 'CONSOLE', '2': 'WINDOWS'}, prefix='/SUBSYSTEM:')
ld('LinkIncremental', map={'1': ':NO', '2': ''}, prefix='/INCREMENTAL')
@@ -402,7 +415,6 @@ def GetLdflags(self, config, gyp_to_build_path, expand_special,
ld('IgnoreDefaultLibraryNames', prefix='/NODEFAULTLIB:')
ld('ResourceOnlyDLL', map={'true': '/NOENTRY'})
ld('EntryPointSymbol', prefix='/ENTRY:')
- ld('ProgramDatabaseFile', prefix='/PDB:')
ld('Profile', map={ 'true': '/PROFILE'})
# TODO(scottmg): This should sort of be somewhere else (not really a flag).
ld('AdditionalDependencies', prefix='')
@@ -26,7 +26,9 @@ def FindFile(pdb):
# Verify the specified PDB is created when ProgramDatabaseFile
# is provided.
- if not FindFile('name_set.pdb'):
+ if not FindFile('name_outdir.pdb'):
test.fail_test()
- else:
- test.pass_test()
+ if not FindFile('name_proddir.pdb'):
+ test.fail_test()
+
+ test.pass_test()
@@ -4,9 +4,10 @@
{
'targets': [
- # Verify that 'ProgramDataBase' option correctly makes it to LINK steup in Ninja
+ # Verify that 'ProgramDataBase' option correctly makes it to LINK step in Ninja
{
- 'target_name': 'test_pdb_set',
+ # Verify that VC macros and windows paths work correctly
+ 'target_name': 'test_pdb_outdir',
'type': 'executable',
'sources': ['hello.cc'],
'msvs_settings': {
@@ -15,7 +16,22 @@
},
'VCLinkerTool': {
'GenerateDebugInformation': 'true',
- 'ProgramDatabaseFile': '<(PRODUCT_DIR)\\name_set.pdb',
+ 'ProgramDatabaseFile': '$(OutDir)\\name_outdir.pdb',
+ },
+ },
+ },
+ {
+ # Verify that GYP macros and POSIX paths work correctly
+ 'target_name': 'test_pdb_proddir',
+ 'type': 'executable',
+ 'sources': ['hello.cc'],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'DebugInformationFormat': '3'
+ },
+ 'VCLinkerTool': {
+ 'GenerateDebugInformation': 'true',
+ 'ProgramDatabaseFile': '<(PRODUCT_DIR)/name_proddir.pdb',
},
},
},

0 comments on commit 10defb6

Please sign in to comment.