msvs.py (SCons-4.3.0) | : | msvs.py (SCons-4.4.0) | ||
---|---|---|---|---|
skipping to change at line 48 | skipping to change at line 48 | |||
import SCons.Builder | import SCons.Builder | |||
import SCons.Node.FS | import SCons.Node.FS | |||
import SCons.Platform.win32 | import SCons.Platform.win32 | |||
import SCons.Script.SConscript | import SCons.Script.SConscript | |||
import SCons.PathList | import SCons.PathList | |||
import SCons.Util | import SCons.Util | |||
import SCons.Warnings | import SCons.Warnings | |||
from SCons.Defaults import processDefines | from SCons.Defaults import processDefines | |||
from SCons.compat import PICKLE_PROTOCOL | from SCons.compat import PICKLE_PROTOCOL | |||
from .MSCommon import msvc_exists, msvc_setup_env_once | from .MSCommon import msvc_setup_env_tool, msvc_setup_env_once | |||
tool_name = 'msvs' | ||||
############################################################################## | ############################################################################## | |||
# Below here are the classes and functions for generation of | # Below here are the classes and functions for generation of | |||
# DSP/DSW/SLN/VCPROJ files. | # DSP/DSW/SLN/VCPROJ files. | |||
############################################################################## | ############################################################################## | |||
def xmlify(s): | def xmlify(s): | |||
s = s.replace("&", "&") # do this first | s = s.replace("&", "&") # do this first | |||
s = s.replace("'", "'") | s = s.replace("'", "'") | |||
s = s.replace('"', """) | s = s.replace('"', """) | |||
skipping to change at line 319 | skipping to change at line 321 | |||
'MPIAcceptFilter': None, | 'MPIAcceptFilter': None, | |||
} | } | |||
class _GenerateV7User(_UserGenerator): | class _GenerateV7User(_UserGenerator): | |||
"""Generates a Project file for MSVS .NET""" | """Generates a Project file for MSVS .NET""" | |||
def __init__(self, dspfile, source, env): | def __init__(self, dspfile, source, env): | |||
if self.version_num >= 9.0: | if self.version_num >= 9.0: | |||
self.usrhead = V9UserHeader | self.usrhead = V9UserHeader | |||
self.usrconf = V9UserConfiguration | self.usrconf = V9UserConfiguration | |||
self.usrdebg = V9DebugSettings | self.usrdebg = V9DebugSettings | |||
_UserGenerator.__init__(self, dspfile, source, env) | super().__init__(dspfile, source, env) | |||
def UserProject(self): | def UserProject(self): | |||
confkeys = sorted(self.configs.keys()) | confkeys = sorted(self.configs.keys()) | |||
for kind in confkeys: | for kind in confkeys: | |||
variant = self.configs[kind].variant | variant = self.configs[kind].variant | |||
platform = self.configs[kind].platform | platform = self.configs[kind].platform | |||
debug = self.configs[kind].debug | debug = self.configs[kind].debug | |||
if debug: | if debug: | |||
debug_settings = '\n'.join(['\t\t\t\t%s="%s"' % (key, xmlify(val ue)) | debug_settings = '\n'.join(['\t\t\t\t%s="%s"' % (key, xmlify(val ue)) | |||
for key, value in debug.items() | for key, value in debug.items() | |||
skipping to change at line 394 | skipping to change at line 396 | |||
elif version_num >= 14.1: | elif version_num >= 14.1: | |||
# Visual Studio 2017 is considered to be version 15. | # Visual Studio 2017 is considered to be version 15. | |||
self.versionstr = '15.0' | self.versionstr = '15.0' | |||
elif version_num == 14.0: | elif version_num == 14.0: | |||
self.versionstr = '14.0' | self.versionstr = '14.0' | |||
else: | else: | |||
self.versionstr = '4.0' | self.versionstr = '4.0' | |||
self.usrhead = V10UserHeader | self.usrhead = V10UserHeader | |||
self.usrconf = V10UserConfiguration | self.usrconf = V10UserConfiguration | |||
self.usrdebg = V10DebugSettings | self.usrdebg = V10DebugSettings | |||
_UserGenerator.__init__(self, dspfile, source, env) | super().__init__(dspfile, source, env) | |||
def UserProject(self): | def UserProject(self): | |||
confkeys = sorted(self.configs.keys()) | confkeys = sorted(self.configs.keys()) | |||
for kind in confkeys: | for kind in confkeys: | |||
variant = self.configs[kind].variant | variant = self.configs[kind].variant | |||
platform = self.configs[kind].platform | platform = self.configs[kind].platform | |||
debug = self.configs[kind].debug | debug = self.configs[kind].debug | |||
if debug: | if debug: | |||
debug_settings = '\n'.join(['\t\t<%s>%s</%s>' % (key, xmlify(val ue), key) | debug_settings = '\n'.join(['\t\t<%s>%s</%s>' % (key, xmlify(val ue), key) | |||
for key, value in debug.items() | for key, value in debug.items() | |||
skipping to change at line 1485 | skipping to change at line 1487 | |||
else: | else: | |||
self.name = os.path.basename(SCons.Util.splitext(self.dswfile)[0]) | self.name = os.path.basename(SCons.Util.splitext(self.dswfile)[0]) | |||
self.name = self.env.subst(self.name) | self.name = self.env.subst(self.name) | |||
def Build(self): | def Build(self): | |||
pass | pass | |||
class _GenerateV7DSW(_DSWGenerator): | class _GenerateV7DSW(_DSWGenerator): | |||
"""Generates a Solution file for MSVS .NET""" | """Generates a Solution file for MSVS .NET""" | |||
def __init__(self, dswfile, source, env): | def __init__(self, dswfile, source, env): | |||
_DSWGenerator.__init__(self, dswfile, source, env) | super().__init__(dswfile, source, env) | |||
self.file = None | self.file = None | |||
self.version = self.env['MSVS_VERSION'] | self.version = self.env['MSVS_VERSION'] | |||
self.version_num, self.suite = msvs_parse_version(self.version) | self.version_num, self.suite = msvs_parse_version(self.version) | |||
self.versionstr = '7.00' | self.versionstr = '7.00' | |||
if self.version_num >= 11.0: | if self.version_num >= 11.0: | |||
self.versionstr = '12.00' | self.versionstr = '12.00' | |||
elif self.version_num >= 10.0: | elif self.version_num >= 10.0: | |||
self.versionstr = '11.00' | self.versionstr = '11.00' | |||
elif self.version_num >= 9.0: | elif self.version_num >= 9.0: | |||
skipping to change at line 2073 | skipping to change at line 2075 | |||
env['MSVSSCONS'] = '"%s" -c "%s"' % (python_executable, getExecScriptMai n(env)) | env['MSVSSCONS'] = '"%s" -c "%s"' % (python_executable, getExecScriptMai n(env)) | |||
if 'MSVSSCONSFLAGS' not in env: | if 'MSVSSCONSFLAGS' not in env: | |||
env['MSVSSCONSFLAGS'] = '-C "${MSVSSCONSCRIPT.dir.get_abspath()}" -f ${M SVSSCONSCRIPT.name}' | env['MSVSSCONSFLAGS'] = '-C "${MSVSSCONSCRIPT.dir.get_abspath()}" -f ${M SVSSCONSCRIPT.name}' | |||
env['MSVSSCONSCOM'] = '$MSVSSCONS $MSVSSCONSFLAGS' | env['MSVSSCONSCOM'] = '$MSVSSCONS $MSVSSCONSFLAGS' | |||
env['MSVSBUILDCOM'] = '$MSVSSCONSCOM "$MSVSBUILDTARGET"' | env['MSVSBUILDCOM'] = '$MSVSSCONSCOM "$MSVSBUILDTARGET"' | |||
env['MSVSREBUILDCOM'] = '$MSVSSCONSCOM "$MSVSBUILDTARGET"' | env['MSVSREBUILDCOM'] = '$MSVSSCONSCOM "$MSVSBUILDTARGET"' | |||
env['MSVSCLEANCOM'] = '$MSVSSCONSCOM -c "$MSVSBUILDTARGET"' | env['MSVSCLEANCOM'] = '$MSVSSCONSCOM -c "$MSVSBUILDTARGET"' | |||
# Set-up ms tools paths for default version | # Set-up ms tools paths for default version | |||
msvc_setup_env_once(env) | msvc_setup_env_once(env, tool=tool_name) | |||
if 'MSVS_VERSION' in env: | if 'MSVS_VERSION' in env: | |||
version_num, suite = msvs_parse_version(env['MSVS_VERSION']) | version_num, suite = msvs_parse_version(env['MSVS_VERSION']) | |||
else: | else: | |||
(version_num, suite) = (7.0, None) # guess at a default | (version_num, suite) = (7.0, None) # guess at a default | |||
if 'MSVS' not in env: | if 'MSVS' not in env: | |||
env['MSVS'] = {} | env['MSVS'] = {} | |||
if version_num < 7.0: | if version_num < 7.0: | |||
env['MSVS']['PROJECTSUFFIX'] = '.dsp' | env['MSVS']['PROJECTSUFFIX'] = '.dsp' | |||
env['MSVS']['SOLUTIONSUFFIX'] = '.dsw' | env['MSVS']['SOLUTIONSUFFIX'] = '.dsw' | |||
skipping to change at line 2103 | skipping to change at line 2105 | |||
else: | else: | |||
env['MSVSENCODING'] = 'Windows-1252' | env['MSVSENCODING'] = 'Windows-1252' | |||
env['GET_MSVSPROJECTSUFFIX'] = GetMSVSProjectSuffix | env['GET_MSVSPROJECTSUFFIX'] = GetMSVSProjectSuffix | |||
env['GET_MSVSSOLUTIONSUFFIX'] = GetMSVSSolutionSuffix | env['GET_MSVSSOLUTIONSUFFIX'] = GetMSVSSolutionSuffix | |||
env['MSVSPROJECTSUFFIX'] = '${GET_MSVSPROJECTSUFFIX}' | env['MSVSPROJECTSUFFIX'] = '${GET_MSVSPROJECTSUFFIX}' | |||
env['MSVSSOLUTIONSUFFIX'] = '${GET_MSVSSOLUTIONSUFFIX}' | env['MSVSSOLUTIONSUFFIX'] = '${GET_MSVSSOLUTIONSUFFIX}' | |||
env['SCONS_HOME'] = os.environ.get('SCONS_HOME') | env['SCONS_HOME'] = os.environ.get('SCONS_HOME') | |||
def exists(env): | def exists(env): | |||
return msvc_exists(env) | return msvc_setup_env_tool(env, tool=tool_name) | |||
# Local Variables: | # Local Variables: | |||
# tab-width:4 | # tab-width:4 | |||
# indent-tabs-mode:nil | # indent-tabs-mode:nil | |||
# End: | # End: | |||
# vim: set expandtab tabstop=4 shiftwidth=4: | # vim: set expandtab tabstop=4 shiftwidth=4: | |||
End of changes. 6 change blocks. | ||||
6 lines changed or deleted | 8 lines changed or added |