Skip to content
Browse files

Add support for ProgramDatabaseFile to Ninja

Currently we ignore the ProgramDatabaseFile option in the linker
portion of the GYP file.  This change will cause the /PDB:<name>
switch to be emitted during the link step as part of ldflags.
Since ldflags are appended to the defaults, they override any
default /PDB switches that are current emitted which is consistent
with our current uses.

BUG=126499
TEST=gyptest-link-pdb
Review URL: https://codereview.chromium.org/11359044

git-svn-id: http://gyp.googlecode.com/svn/trunk@1530 78cadc50-ecff-11dd-a971-7dbc132099af
  • Loading branch information...
1 parent eff8be6 commit 7a9065df64cfbf8dd74a6d925d0df3ea7df78fde noelallen@chromium.org committed Nov 2, 2012
Showing with 56 additions and 0 deletions.
  1. +1 −0 pylib/gyp/msvs_emulation.py
  2. +32 −0 test/win/gyptest-link-pdb.py
  3. +23 −0 test/win/linker-flags/program-database.gyp
View
1 pylib/gyp/msvs_emulation.py
@@ -402,6 +402,7 @@ 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='')
View
32 test/win/gyptest-link-pdb.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2012 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies that the 'Profile' attribute in VCLinker is extracted properly.
+"""
+
+import TestGyp
+
+import os
+import sys
+
+
+if sys.platform == 'win32':
+ test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
+ CHDIR = 'linker-flags'
+ test.run_gyp('program-database.gyp', chdir=CHDIR)
+ test.build('program-database.gyp', test.ALL, chdir=CHDIR)
+
+ def FindFile(pdb):
+ full_path = test.built_file_path(pdb, chdir=CHDIR)
+ return os.path.isfile(full_path)
+
+ # Verify the specified PDB is created when ProgramDatabaseFile
+ # is provided.
+ if not FindFile('name_set.pdb'):
+ test.fail_test()
+ else:
+ test.pass_test()
View
23 test/win/linker-flags/program-database.gyp
@@ -0,0 +1,23 @@
+# Copyright (c) 2012 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ # Verify that 'ProgramDataBase' option correctly makes it to LINK steup in Ninja
+ {
+ 'target_name': 'test_pdb_set',
+ 'type': 'executable',
+ 'sources': ['hello.cc'],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'DebugInformationFormat': '3'
+ },
+ 'VCLinkerTool': {
+ 'GenerateDebugInformation': 'true',
+ 'ProgramDatabaseFile': '<(PRODUCT_DIR)\\name_set.pdb',
+ },
+ },
+ },
+ ]
+}

0 comments on commit 7a9065d

Please sign in to comment.
Something went wrong with that request. Please try again.