summaryrefslogtreecommitdiff
path: root/src/engine/SCons/Tool/MSCommon
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/Tool/MSCommon')
-rw-r--r--src/engine/SCons/Tool/MSCommon/__init__.py2
-rw-r--r--src/engine/SCons/Tool/MSCommon/arch.py2
-rw-r--r--src/engine/SCons/Tool/MSCommon/common.py2
-rw-r--r--src/engine/SCons/Tool/MSCommon/netframework.py2
-rw-r--r--src/engine/SCons/Tool/MSCommon/sdk.py70
-rw-r--r--src/engine/SCons/Tool/MSCommon/vc.py66
-rw-r--r--src/engine/SCons/Tool/MSCommon/vc.py.bak2
-rw-r--r--src/engine/SCons/Tool/MSCommon/vs.py2
8 files changed, 122 insertions, 26 deletions
diff --git a/src/engine/SCons/Tool/MSCommon/__init__.py b/src/engine/SCons/Tool/MSCommon/__init__.py
index 7a23c87..b6cd6a0 100644
--- a/src/engine/SCons/Tool/MSCommon/__init__.py
+++ b/src/engine/SCons/Tool/MSCommon/__init__.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/MSCommon/__init__.py 4629 2010/01/17 22:23:21 scons"
+__revision__ = "src/engine/SCons/Tool/MSCommon/__init__.py 4691 2010/03/06 16:22:36 bdbaddog"
__doc__ = """
Common functions for Microsoft Visual Studio and Visual C/C++.
diff --git a/src/engine/SCons/Tool/MSCommon/arch.py b/src/engine/SCons/Tool/MSCommon/arch.py
index 25ec1b9..3093455 100644
--- a/src/engine/SCons/Tool/MSCommon/arch.py
+++ b/src/engine/SCons/Tool/MSCommon/arch.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/MSCommon/arch.py 4629 2010/01/17 22:23:21 scons"
+__revision__ = "src/engine/SCons/Tool/MSCommon/arch.py 4691 2010/03/06 16:22:36 bdbaddog"
__doc__ = """Module to define supported Windows chip architectures.
"""
diff --git a/src/engine/SCons/Tool/MSCommon/common.py b/src/engine/SCons/Tool/MSCommon/common.py
index d7d3b79..aeea37b 100644
--- a/src/engine/SCons/Tool/MSCommon/common.py
+++ b/src/engine/SCons/Tool/MSCommon/common.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/MSCommon/common.py 4629 2010/01/17 22:23:21 scons"
+__revision__ = "src/engine/SCons/Tool/MSCommon/common.py 4691 2010/03/06 16:22:36 bdbaddog"
__doc__ = """
Common helper functions for working with the Microsoft tool chain.
diff --git a/src/engine/SCons/Tool/MSCommon/netframework.py b/src/engine/SCons/Tool/MSCommon/netframework.py
index b52e597..1185717 100644
--- a/src/engine/SCons/Tool/MSCommon/netframework.py
+++ b/src/engine/SCons/Tool/MSCommon/netframework.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/MSCommon/netframework.py 4629 2010/01/17 22:23:21 scons"
+__revision__ = "src/engine/SCons/Tool/MSCommon/netframework.py 4691 2010/03/06 16:22:36 bdbaddog"
__doc__ = """
"""
diff --git a/src/engine/SCons/Tool/MSCommon/sdk.py b/src/engine/SCons/Tool/MSCommon/sdk.py
index f458dc0..24b85d6 100644
--- a/src/engine/SCons/Tool/MSCommon/sdk.py
+++ b/src/engine/SCons/Tool/MSCommon/sdk.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/MSCommon/sdk.py 4629 2010/01/17 22:23:21 scons"
+__revision__ = "src/engine/SCons/Tool/MSCommon/sdk.py 4691 2010/03/06 16:22:36 bdbaddog"
__doc__ = """Module to detect the Platform/Windows SDK
@@ -102,6 +102,25 @@ class SDKDefinition:
sdk_dir = self.find_sdk_dir()
self._sdk_dir = sdk_dir
return sdk_dir
+
+ def get_sdk_vc_script(self,host_arch, target_arch):
+ """ Return the script to initialize the VC compiler installed by SDK
+ """
+
+ if (host_arch == 'amd64' and target_arch == 'x86'):
+ # No cross tools needed compiling 32 bits on 64 bit machine
+ host_arch=target_arch
+
+ arch_string=target_arch
+ if (host_arch != target_arch):
+ arch_string='%s_%s'%(host_arch,target_arch)
+
+ debug("sdk.py: get_sdk_vc_script():arch_string:%s host_arch:%s target_arch:%s"%(arch_string,
+ host_arch,
+ target_arch))
+ file=self.vc_setup_scripts.get(arch_string,None)
+ debug("sdk.py: get_sdk_vc_script():file:%s"%file)
+ return file
class WindowsSDK(SDKDefinition):
"""
@@ -121,6 +140,27 @@ class PlatformSDK(SDKDefinition):
apply(SDKDefinition.__init__, (self,)+args, kw)
self.hkey_data = self.uuid
+#
+# The list of VC initialization scripts installed by the SDK
+# These should be tried if the vcvarsall.bat TARGET_ARCH fails
+preSDK61VCSetupScripts = { 'x86' : r'bin\vcvars32.bat',
+ 'amd64' : r'bin\vcvarsamd64.bat',
+ 'x86_amd64': r'bin\vcvarsx86_amd64.bat',
+ 'x86_ia64' : r'bin\vcvarsx86_ia64.bat',
+ 'ia64' : r'bin\vcvarsia64.bat'}
+
+SDK61VCSetupScripts = {'x86' : r'bin\vcvars32.bat',
+ 'amd64' : r'bin\amd64\vcvarsamd64.bat',
+ 'x86_amd64': r'bin\x86_amd64\vcvarsx86_amd64.bat',
+ 'x86_ia64' : r'bin\x86_ia64\vcvarsx86_ia64.bat',
+ 'ia64' : r'bin\ia64\vcvarsia64.bat'}
+
+SDK70VCSetupScripts = { 'x86' : r'bin\vcvars32.bat',
+ 'amd64' : r'bin\vcvars64.bat',
+ 'x86_amd64': r'bin\vcvarsx86_amd64.bat',
+ 'x86_ia64' : r'bin\vcvarsx86_ia64.bat',
+ 'ia64' : r'bin\vcvarsia64.bat'}
+
# The list of support SDKs which we know how to detect.
#
# The first SDK found in the list is the one used by default if there
@@ -129,6 +169,16 @@ class PlatformSDK(SDKDefinition):
#
# If you update this list, update the documentation in Tool/mssdk.xml.
SupportedSDKList = [
+ WindowsSDK('7.0',
+ sanity_check_file=r'bin\SetEnv.Cmd',
+ include_subdir='include',
+ lib_subdir={
+ 'x86' : ['lib'],
+ 'x86_64' : [r'lib\x64'],
+ 'ia64' : [r'lib\ia64'],
+ },
+ vc_setup_scripts = SDK70VCSetupScripts,
+ ),
WindowsSDK('6.1',
sanity_check_file=r'bin\SetEnv.Cmd',
include_subdir='include',
@@ -137,6 +187,7 @@ SupportedSDKList = [
'x86_64' : [r'lib\x64'],
'ia64' : [r'lib\ia64'],
},
+ vc_setup_scripts = SDK61VCSetupScripts,
),
WindowsSDK('6.0A',
@@ -147,22 +198,26 @@ SupportedSDKList = [
'x86_64' : [r'lib\x64'],
'ia64' : [r'lib\ia64'],
},
+ vc_setup_scripts = preSDK61VCSetupScripts,
),
WindowsSDK('6.0',
sanity_check_file=r'bin\gacutil.exe',
include_subdir='include',
lib_subdir='lib',
+ vc_setup_scripts = preSDK61VCSetupScripts,
),
PlatformSDK('2003R2',
sanity_check_file=r'SetEnv.Cmd',
- uuid="D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1"
+ uuid="D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1",
+ vc_setup_scripts = preSDK61VCSetupScripts,
),
PlatformSDK('2003R1',
sanity_check_file=r'SetEnv.Cmd',
uuid="8F9E5EF3-A9A5-491B-A889-C58EFFECE8B3",
+ vc_setup_scripts = preSDK61VCSetupScripts,
),
]
@@ -186,9 +241,9 @@ def get_installed_sdks():
InstalledSDKList = []
InstalledSDKMap = {}
for sdk in SupportedSDKList:
- debug('trying to find SDK %s' % sdk.version)
+ debug('MSCommon/sdk.py: trying to find SDK %s' % sdk.version)
if sdk.get_sdk_dir():
- debug('found SDK %s' % sdk.version)
+ debug('MSCommon/sdk.py:found SDK %s' % sdk.version)
InstalledSDKList.append(sdk)
InstalledSDKMap[sdk.version] = sdk
return InstalledSDKList
@@ -203,6 +258,7 @@ SDKEnvironmentUpdates = {}
def set_sdk_by_directory(env, sdk_dir):
global SDKEnvironmentUpdates
+ debug('set_sdk_by_directory: Using dir:%s'%sdk_dir)
try:
env_tuple_list = SDKEnvironmentUpdates[sdk_dir]
except KeyError:
@@ -264,12 +320,13 @@ def get_default_sdk():
return InstalledSDKList[0]
def mssdk_setup_env(env):
- debug('msvs_setup_env()')
+ debug('mssdk_setup_env()')
if env.has_key('MSSDK_DIR'):
sdk_dir = env['MSSDK_DIR']
if sdk_dir is None:
return
sdk_dir = env.subst(sdk_dir)
+ debug('mssdk_setup_env: Using MSSDK_DIR:%s'%sdk_dir)
elif env.has_key('MSSDK_VERSION'):
sdk_version = env['MSSDK_VERSION']
if sdk_version is None:
@@ -278,6 +335,7 @@ def mssdk_setup_env(env):
sdk_version = env.subst(sdk_version)
mssdk = get_sdk_by_version(sdk_version)
sdk_dir = mssdk.get_sdk_dir()
+ debug('mssdk_setup_env: Using MSSDK_VERSION:%s'%sdk_dir)
elif env.has_key('MSVS_VERSION'):
msvs_version = env['MSVS_VERSION']
debug('Getting MSVS_VERSION from env:%s'%msvs_version)
@@ -298,11 +356,13 @@ def mssdk_setup_env(env):
if not mssdk:
return
sdk_dir = mssdk.get_sdk_dir()
+ debug('mssdk_setup_env: Using MSVS_VERSION:%s'%sdk_dir)
else:
mssdk = get_default_sdk()
if not mssdk:
return
sdk_dir = mssdk.get_sdk_dir()
+ debug('mssdk_setup_env: not using any env values. sdk_dir:%s'%sdk_dir)
set_sdk_by_directory(env, sdk_dir)
diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py
index a190b8e..f2f2a01 100644
--- a/src/engine/SCons/Tool/MSCommon/vc.py
+++ b/src/engine/SCons/Tool/MSCommon/vc.py
@@ -30,7 +30,7 @@
# * test on 64 bits XP + VS 2005 (and VS 6 if possible)
# * SDK
# * Assembly
-__revision__ = "src/engine/SCons/Tool/MSCommon/vc.py 4629 2010/01/17 22:23:21 scons"
+__revision__ = "src/engine/SCons/Tool/MSCommon/vc.py 4691 2010/03/06 16:22:36 bdbaddog"
__doc__ = """Module for Visual C/C++ detection and configuration.
"""
@@ -45,6 +45,11 @@ import common
debug = common.debug
+import sdk
+
+get_installed_sdks = sdk.get_installed_sdks
+
+
class VisualCException(Exception):
pass
@@ -198,10 +203,16 @@ def find_vc_pdir(msvc_version):
raise MissingConfiguration("registry dir %s not found on the filesystem" % comps)
return None
-def find_batch_file(msvc_version):
+def find_batch_file(env,msvc_version):
+ """
+ Find the location of the batch script which should set up the compiler
+ for any TARGET_ARCH whose compilers were installed by Visual Studio/VCExpress
+ """
pdir = find_vc_pdir(msvc_version)
if pdir is None:
raise NoVersionFound("No version of Visual Studio found")
+
+ debug('vc.py: find_batch_file() pdir:%s'%pdir)
vernum = float(msvc_version)
if 7 <= vernum < 8:
@@ -213,11 +224,22 @@ def find_batch_file(msvc_version):
else: # >= 8
batfilename = os.path.join(pdir, "vcvarsall.bat")
- if os.path.exists(batfilename):
- return batfilename
- else:
+ if not os.path.exists(batfilename):
debug("Not found: %s" % batfilename)
- return None
+ batfilename = None
+
+ installed_sdks=get_installed_sdks()
+ (host_arch,target_arch)=get_host_target(env)
+ for _sdk in installed_sdks:
+ sdk_bat_file=_sdk.get_sdk_vc_script(host_arch,target_arch)
+ sdk_bat_file_path=os.path.join(pdir,sdk_bat_file)
+ debug('vc.py:find_batch_file() sdk_bat_file_path:%s'%sdk_bat_file_path)
+ if os.path.exists(sdk_bat_file_path):
+ return (batfilename,sdk_bat_file_path)
+ else:
+ debug("vc.py:find_batch_file() not found:%s"%sdk_bat_file_path)
+ else:
+ return (batfilename,None)
__INSTALLED_VCS_RUN = None
@@ -319,7 +341,8 @@ def msvc_setup_env(env):
env['MSVS'] = {}
try:
- script = find_batch_file(version)
+ (vc_script,sdk_script) = find_batch_file(env,version)
+ debug('vc.py:msvc_setup_env() vc_script:%s sdk_script:%s'%(vc_script,sdk_script))
except VisualCException, e:
msg = str(e)
debug('Caught exception while looking for batch file (%s)' % msg)
@@ -329,7 +352,8 @@ def msvc_setup_env(env):
warn_msg = warn_msg % (version, cached_get_installed_vcs())
SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg)
return None
-
+
+ debug('vc.py:msvc_setup_env() vc_script:%s sdk_script:%s'%(vc_script,sdk_script))
use_script = env.get('MSVC_USE_SCRIPT', True)
if SCons.Util.is_String(use_script):
debug('use_script 1 %s\n' % repr(use_script))
@@ -342,13 +366,24 @@ def msvc_setup_env(env):
(host_target, version)
SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg)
arg = _HOST_TARGET_ARCH_TO_BAT_ARCH[host_target]
- debug('use_script 2 %s, args:%s\n' % (repr(script), arg))
- try:
- d = script_env(script, args=arg)
- except BatchFileExecutionError, e:
- msg = "MSVC error while executing %s with args %s (error was %s)" % \
- (script, arg, str(e))
- raise SCons.Errors.UserError(msg)
+ debug('use_script 2 %s, args:%s\n' % (repr(vc_script), arg))
+ if vc_script:
+ try:
+ d = script_env(vc_script, args=arg)
+ except BatchFileExecutionError, e:
+ debug('use_script 3: failed running VC script %s: %s: Error:%s'%(repr(vc_script),arg,e))
+ vc_script=None
+ if not vc_script and sdk_script:
+ debug('use_script 4: trying sdk script: %s'%(sdk_script))
+ try:
+ d = script_env(sdk_script,args=[])
+ except BatchFileExecutionError,e:
+ debug('use_script 5: failed running SDK script %s: Error:%s'%(repr(sdk_script),e))
+ return None
+ elif not vc_script and not sdk_script:
+ debug('use_script 6: Neither VC script nor SDK script found')
+ return None
+
else:
debug('MSVC_USE_SCRIPT set to False')
warn_msg = "MSVC_USE_SCRIPT set to False, assuming environment " \
@@ -357,6 +392,7 @@ def msvc_setup_env(env):
return None
for k, v in d.items():
+ debug('vc.py:msvc_setup_env() env:%s -> %s'%(k,v))
env.PrependENVPath(k, v, delete_existing=True)
def msvc_exists(version=None):
diff --git a/src/engine/SCons/Tool/MSCommon/vc.py.bak b/src/engine/SCons/Tool/MSCommon/vc.py.bak
index 711fffa..7690e5d 100644
--- a/src/engine/SCons/Tool/MSCommon/vc.py.bak
+++ b/src/engine/SCons/Tool/MSCommon/vc.py.bak
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/MSCommon/vc.py.bak 4629 2010/01/17 22:23:21 scons"
+__revision__ = "src/engine/SCons/Tool/MSCommon/vc.py.bak 4691 2010/03/06 16:22:36 bdbaddog"
__doc__ = """Module for Visual C/C++ detection and configuration.
"""
diff --git a/src/engine/SCons/Tool/MSCommon/vs.py b/src/engine/SCons/Tool/MSCommon/vs.py
index 5be29c1..204a32f 100644
--- a/src/engine/SCons/Tool/MSCommon/vs.py
+++ b/src/engine/SCons/Tool/MSCommon/vs.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/MSCommon/vs.py 4629 2010/01/17 22:23:21 scons"
+__revision__ = "src/engine/SCons/Tool/MSCommon/vs.py 4691 2010/03/06 16:22:36 bdbaddog"
__doc__ = """Module to detect Visual Studio and/or Visual C/C++
"""