From: stevenknight Date: Sat, 8 May 2004 23:00:41 +0000 (+0000) Subject: Better midl (Visual Studio MIDL compiler) Tool detection. (Anthony Roach) X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f74b195d48a953c51073dddeb633efdb059755bc;p=scons.git Better midl (Visual Studio MIDL compiler) Tool detection. (Anthony Roach) git-svn-id: http://scons.tigris.org/svn/scons/trunk@973 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 3d3d4cec..215937ae 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -127,6 +127,9 @@ RELEASE 0.96 - XXX - Fix use of the --implicit-cache option with timestamp signatures. + - If Visual Studio is installed, assume the C/C++ compiler, the linker + and the MIDL compiler that comes with it are available, too. + From sam th: - Allow SConf.CheckLib() to search a list of libraries, like the diff --git a/src/engine/SCons/Tool/midl.py b/src/engine/SCons/Tool/midl.py index 2efabccb..d02f23a6 100644 --- a/src/engine/SCons/Tool/midl.py +++ b/src/engine/SCons/Tool/midl.py @@ -38,6 +38,7 @@ import os.path import SCons.Defaults import SCons.Scanner.IDL import SCons.Util +import SCons.Tool.msvs def midl_emitter(target, source, env): """Produces a list of outputs from the MIDL compiler""" @@ -69,4 +70,10 @@ def generate(env): env['BUILDERS']['TypeLibrary'] = midl_builder def exists(env): - return env.Detect('midl') + if SCons.Tool.msvs.is_msvs_installed(): + # there's at least one version of MSVS installed, which comes with midl: + return 1 + else: + return env.Detect('midl') + + diff --git a/src/engine/SCons/Tool/mslink.py b/src/engine/SCons/Tool/mslink.py index 7e32e603..5ff8a011 100644 --- a/src/engine/SCons/Tool/mslink.py +++ b/src/engine/SCons/Tool/mslink.py @@ -180,13 +180,8 @@ def generate(env): pass def exists(env): - try: - v = SCons.Tool.msvs.get_visualstudio_versions() - except (SCons.Util.RegError, SCons.Errors.InternalError): - pass - - if not v: - return env.Detect('link') - else: + if SCons.Tool.msvs.is_msvs_installed(): # there's at least one version of MSVS installed. return 1 + else: + return env.Detect('link') diff --git a/src/engine/SCons/Tool/msvc.py b/src/engine/SCons/Tool/msvc.py index 1caa4dbc..3d498026 100644 --- a/src/engine/SCons/Tool/msvc.py +++ b/src/engine/SCons/Tool/msvc.py @@ -478,13 +478,9 @@ def generate(env): env['BUILDERS']['PCH'] = pch_builder def exists(env): - try: - v = SCons.Tool.msvs.get_visualstudio_versions() - except (SCons.Util.RegError, SCons.Errors.InternalError): - pass - - if not v: - return env.Detect('cl') - else: + if SCons.Tool.msvs.is_msvs_installed(): # there's at least one version of MSVS installed. return 1 + else: + return env.Detect('cl') + diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index 10ab42af..06f850ea 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -846,6 +846,16 @@ def get_visualstudio_versions(): return L +def is_msvs_installed(): + """ + Check the registry for an installed visual studio. + """ + try: + v = SCons.Tool.msvs.get_visualstudio_versions() + return v + except (SCons.Util.RegError, SCons.Errors.InternalError): + return 0 + def get_msvs_install_dirs(version = None): """ Get installed locations for various msvc-related products, like the .NET SDK