Add MSVS Project file support. (Greg Spencer)
[scons.git] / src / engine / SCons / Tool / mslib.py
index 4180e05c3eee5c66635b08205863c54c3cc24ce8..93a36cc4b55c5843609a0b65038787fae5c10aae 100644 (file)
@@ -34,15 +34,32 @@ selection method.
 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 
 import SCons.Defaults
+import SCons.Tool.msvs
+import SCons.Tool.msvc
 
 def generate(env):
     """Add Builders and construction variables for lib to an Environment."""
     env['BUILDERS']['Library'] = SCons.Defaults.StaticLibrary
     env['BUILDERS']['StaticLibrary'] = SCons.Defaults.StaticLibrary
-    
+
+    version = SCons.Tool.msvs.get_default_visualstudio_version(env)
+
+    if env.has_key('MSVS_IGNORE_IDE_PATHS') and env['MSVS_IGNORE_IDE_PATHS']:
+        include_path, lib_path, exe_path = SCons.Tool.msvc.get_msvc_default_paths(version)
+    else:
+        include_path, lib_path, exe_path = SCons.Tool.msvc.get_msvc_paths(version)
+
+    # since other tools can set this, we just make sure that the
+    # relevant stuff from MSVS is in there somewhere.
+    env.PrependENVPath('PATH', exe_path)
+
     env['AR']          = 'lib'
     env['ARFLAGS']     = '/nologo'
     env['ARCOM']       = "${TEMPFILE('$AR $ARFLAGS /OUT:$TARGET $SOURCES')}"
 
 def exists(env):
-    return env.Detect('lib')
+    if not SCons.Util.can_read_reg or not SCons.Tool.msvs.get_visualstudio_versions():
+        return env.Detect('lib')
+    else:
+        # there's at least one version of MSVS installed.
+        return True