summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Tool/mslink.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-10-03 21:01:02 (GMT)
committerSteven Knight <knight@baldmt.com>2002-10-03 21:01:02 (GMT)
commit313be3374d81ff22c10b8ec09c465cabd835062f (patch)
tree9385dedc5fcd031f98ebd15791c5c15c62303144 /src/engine/SCons/Tool/mslink.py
parentdffe09bd431aeeb996ad14763154abe5c412b93e (diff)
downloadSCons-313be3374d81ff22c10b8ec09c465cabd835062f.zip
SCons-313be3374d81ff22c10b8ec09c465cabd835062f.tar.gz
SCons-313be3374d81ff22c10b8ec09c465cabd835062f.tar.bz2
Add MSVC PCH and PDB support. (Anthony Roach)
Diffstat (limited to 'src/engine/SCons/Tool/mslink.py')
-rw-r--r--src/engine/SCons/Tool/mslink.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/engine/SCons/Tool/mslink.py b/src/engine/SCons/Tool/mslink.py
index 35bd868..3fdd4d8 100644
--- a/src/engine/SCons/Tool/mslink.py
+++ b/src/engine/SCons/Tool/mslink.py
@@ -40,6 +40,7 @@ import SCons.Defaults
import SCons.Errors
import SCons.Action
import SCons.Util
+import msvc
from SCons.Tool.msvc import get_msdev_paths
@@ -68,6 +69,10 @@ def win32TempFileMunge(env, cmd_list, for_signature):
def win32LinkGenerator(env, target, source, for_signature):
args = [ '$LINK', '$LINKFLAGS', '/OUT:%s' % target[0],
'$(', '$_LIBDIRFLAGS', '$)', '$_LIBFLAGS' ]
+
+ if env.has_key('PDB') and env['PDB']:
+ args.extend(['/PDB:%s'%env['PDB'], '/DEBUG'])
+
args.extend(map(SCons.Util.to_String, source))
return win32TempFileMunge(env, args, for_signature)
@@ -75,6 +80,9 @@ def win32LibGenerator(target, source, env, for_signature):
listCmd = [ "$SHLINK", "$SHLINKFLAGS" ]
no_import_lib = env.get('no_import_lib', 0)
+ if env.has_key('PDB') and env['PDB']:
+ listCmd.extend(['/PDB:%s'%env['PDB'], '/DEBUG'])
+
for tgt in target:
ext = os.path.splitext(str(tgt))[1]
if ext == env.subst("$LIBSUFFIX"):
@@ -94,9 +102,12 @@ def win32LibGenerator(target, source, env, for_signature):
else:
# Just treat it as a generic source file.
listCmd.append(str(src))
+
return win32TempFileMunge(env, listCmd, for_signature)
def win32LibEmitter(target, source, env):
+ msvc.validate_vars(env)
+
dll = None
no_import_lib = env.get('no_import_lib', 0)
@@ -116,6 +127,11 @@ def win32LibEmitter(target, source, env):
# append a def file to the list of sources
source.append("%s%s" % (os.path.splitext(str(dll))[0],
env.subst("$WIN32DEFSUFFIX")))
+
+ if env.has_key('PDB') and env['PDB']:
+ env.SideEffect(env['PDB'], target)
+ env.Precious(env['PDB'])
+
if not no_import_lib and \
not env.subst("$LIBSUFFIX") in \
map(lambda x: os.path.split(str(x))[1], target):
@@ -125,6 +141,15 @@ def win32LibEmitter(target, source, env):
env.subst("$LIBSUFFIX")))
return (target, source)
+def prog_emitter(target, source, env):
+ msvc.validate_vars(env)
+
+ if env.has_key('PDB') and env['PDB']:
+ env.SideEffect(env['PDB'], target)
+ env.Precious(env['PDB'])
+
+ return (target,source)
+
ShLibAction = SCons.Action.CommandGenerator(win32LibGenerator)
LinkAction = SCons.Action.CommandGenerator(win32LinkGenerator)
@@ -140,6 +165,7 @@ def generate(env, platform):
env['LINK'] = 'link'
env['LINKFLAGS'] = '/nologo'
env['LINKCOM'] = LinkAction
+ env['PROGEMITTER'] = prog_emitter
env['LIBDIRPREFIX']='/LIBPATH:'
env['LIBDIRSUFFIX']=''
env['LIBLINKPREFIX']=''