- if not SCons.Util.can_read_reg:
- raise SCons.Errors.InternalError, "No Windows registry module was found"
-
- if path=='lib':
- path= 'Library'
- path = string.upper(path + ' Dirs')
- K = ('Software\\Microsoft\\Devstudio\\%s\\' +
- 'Build System\\Components\\Platforms\\Win32 (%s)\\Directories') % \
- (version,platform)
- for base in (SCons.Util.HKEY_CLASSES_ROOT,
- SCons.Util.HKEY_LOCAL_MACHINE,
- SCons.Util.HKEY_CURRENT_USER,
- SCons.Util.HKEY_USERS):
- try:
- k = SCons.Util.RegOpenKeyEx(base,K)
- i = 0
- while 1:
- try:
- (p,v,t) = SCons.Util.RegEnumValue(k,i)
- if string.upper(p) == path:
- return v
- i = i + 1
- except SCons.Util.RegError:
- break
- except SCons.Util.RegError:
- pass
-
- # if we got here, then we didn't find the registry entries:
- raise SCons.Errors.InternalError, "%s was not found in the registry."%path
-
-def get_msdev_dir(version):
- """Returns the root directory of the MSDev installation from the
- registry if it can be found, otherwise we guess."""
- if SCons.Util.can_read_reg:
- K = ('Software\\Microsoft\\Devstudio\\%s\\' +
- 'Products\\Microsoft Visual C++') % \
- version
- for base in (SCons.Util.HKEY_LOCAL_MACHINE,
- SCons.Util.HKEY_CURRENT_USER):
- try:
- k = SCons.Util.RegOpenKeyEx(base,K)
- val, tok = SCons.Util.RegQueryValueEx(k, 'ProductDir')
- return os.path.split(val)[0]
- except SCons.Util.RegError:
- pass
-
-def get_msdev_paths(version=None):
- """Return a 3-tuple of (INCLUDE, LIB, PATH) as the values
- of those three environment variables that should be set
- in order to execute the MSVC tools properly."""
- exe_path = ''
- lib_path = ''
- include_path = ''
- try:
- if not version:
- version = get_devstudio_versions()[0] #use highest version
- include_path = get_msvc_path("include", version)
- lib_path = get_msvc_path("lib", version)
- exe_path = get_msvc_path("path", version) + ";" + os.environ['PATH']
- except (SCons.Util.RegError, SCons.Errors.InternalError):
- # Could not get the configured directories from the registry.
- # However, the configured directories only appear if the user
- # changes them from the default. Therefore, we'll see if
- # we can get the path to the MSDev base installation from
- # the registry and deduce the default directories.
- MVSdir = None
- if version:
- MVSdir = get_msdev_dir(version)
- if MVSdir:
- MVSVCdir = r'%s\VC98' % MVSdir
- MVSCommondir = r'%s\Common' % MVSdir
- include_path = r'%s\atl\include;%s\mfc\include;%s\include' % (MVSVCdir, MVSVCdir, MVSVCdir)
- lib_path = r'%s\mfc\lib;%s\lib' % (MVSVCdir, MVSVCdir)
- try:
- extra_path = os.pathsep + os.environ['PATH']
- except KeyError:
- extra_path = ''
- exe_path = (r'%s\MSDev98\Bin;%s\Bin' % (MVSCommondir, MVSVCdir)) + extra_path
- else:
- # The DevStudio environment variables don't exist,
- # so just use the variables from the source environment.
- MVSdir = r'C:\Program Files\Microsoft Visual Studio'
- MVSVCdir = r'%s\VC98' % MVSdir
- MVSCommondir = r'%s\Common' % MVSdir
- try:
- include_path = os.environ['INCLUDE']
- except KeyError:
- include_path = ''
- try:
- lib_path = os.environ['LIB']
- except KeyError:
- lib_path = ''
- try:
- exe_path = os.environ['PATH']
- except KeyError:
- exe_path = ''
- return (include_path, lib_path, exe_path)
-
-def generate(env, platform):
+CAction = SCons.Action.Action("$CCCOM", "$CCCOMSTR",
+ batch_key=msvc_batch_key,
+ targets='$CHANGED_TARGETS')
+ShCAction = SCons.Action.Action("$SHCCCOM", "$SHCCCOMSTR",
+ batch_key=msvc_batch_key,
+ targets='$CHANGED_TARGETS')
+CXXAction = SCons.Action.Action("$CXXCOM", "$CXXCOMSTR",
+ batch_key=msvc_batch_key,
+ targets='$CHANGED_TARGETS')
+ShCXXAction = SCons.Action.Action("$SHCXXCOM", "$SHCXXCOMSTR",
+ batch_key=msvc_batch_key,
+ targets='$CHANGED_TARGETS')
+
+def generate(env):