"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "SCons/Tool/msvc.py" between
scons-4.2.0.tar.gz and SCons-4.3.0.tar.gz

About: SCons is a software construction tool (a Python script and a set of modules as a superior alternative to the classic "Make" build tool).

msvc.py  (scons-4.2.0):msvc.py  (SCons-4.3.0)
"""SCons.Tool.msvc # MIT License
Tool-specific initialization for Microsoft Visual C/C++.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
# #
# __COPYRIGHT__ # Copyright The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including # "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, # without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to # distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to # permit persons to whom the Software is furnished to do so, subject to
# the following conditions: # the following conditions:
# #
# The above copyright notice and this permission notice shall be included # The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software. # in all copies or substantial portions of the Software.
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """SCons.Tool.msvc
Tool-specific initialization for Microsoft Visual C/C++.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
import os.path import os.path
import os import os
import SCons.Action import SCons.Action
import SCons.Builder import SCons.Builder
import SCons.Errors import SCons.Errors
import SCons.Platform.win32 import SCons.Platform.win32
import SCons.Tool import SCons.Tool
import SCons.Tool.msvs import SCons.Tool.msvs
import SCons.Util import SCons.Util
import SCons.Warnings import SCons.Warnings
import SCons.Scanner.RC import SCons.Scanner.RC
from .MSCommon import msvc_exists, msvc_setup_env_once, msvc_version_to_maj_min, msvc_find_vswhere from .MSCommon import msvc_exists, msvc_setup_env_once, msvc_version_to_maj_min, msvc_find_vswhere
from .MSCommon.common import get_pch_node
CSuffixes = ['.c', '.C'] CSuffixes = ['.c', '.C']
CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++'] CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++']
def validate_vars(env): def validate_vars(env):
"""Validate the PCH and PCHSTOP construction variables.""" """Validate the PCH and PCHSTOP construction variables."""
if 'PCH' in env and env['PCH']: if 'PCH' in env and env['PCH']:
if 'PCHSTOP' not in env: if 'PCHSTOP' not in env:
raise SCons.Errors.UserError("The PCHSTOP construction must be defin ed if PCH is defined.") raise SCons.Errors.UserError("The PCHSTOP construction must be defin ed if PCH is defined.")
if not SCons.Util.is_String(env['PCHSTOP']): if not SCons.Util.is_String(env['PCHSTOP']):
skipping to change at line 114 skipping to change at line 113
# Add a dependency, but only if the target (e.g. 'Source1.obj') # Add a dependency, but only if the target (e.g. 'Source1.obj')
# doesn't correspond to the pre-compiled header ('Source1.pch'). # doesn't correspond to the pre-compiled header ('Source1.pch').
# If the basenames match, then this was most likely caused by # If the basenames match, then this was most likely caused by
# someone adding the source file to both the env.PCH() and the # someone adding the source file to both the env.PCH() and the
# env.Program() calls, and adding the explicit dependency would # env.Program() calls, and adding the explicit dependency would
# cause a cycle on the .pch file itself. # cause a cycle on the .pch file itself.
# #
# See issue #2505 for a discussion of what to do if it turns # See issue #2505 for a discussion of what to do if it turns
# out this assumption causes trouble in the wild: # out this assumption causes trouble in the wild:
# https://github.com/SCons/scons/issues/2505 # https://github.com/SCons/scons/issues/2505
if 'PCH' in env: pch=get_pch_node(env, target, source)
pch = env['PCH'] if pch:
if str(target[0]) != SCons.Util.splitext(str(pch))[0] + '.obj': if str(target[0]) != SCons.Util.splitext(str(pch))[0] + '.obj':
env.Depends(target, pch) env.Depends(target, pch)
return (target, source) return (target, source)
def static_object_emitter(target, source, env): def static_object_emitter(target, source, env):
return object_emitter(target, source, env, return object_emitter(target, source, env,
SCons.Defaults.StaticObjectEmitter) SCons.Defaults.StaticObjectEmitter)
def shared_object_emitter(target, source, env): def shared_object_emitter(target, source, env):
return object_emitter(target, source, env, return object_emitter(target, source, env,
SCons.Defaults.SharedObjectEmitter) SCons.Defaults.SharedObjectEmitter)
def gen_ccpchflags(env, target, source, for_signature):
"""
Generator for CCPCHFLAGS
if PCH is not defined or evaluates to a false value, then return empty strin
g.
"""
pch_node = get_pch_node(env, target, source)
if not pch_node:
return ''
return SCons.Util.CLVar(["/Yu$PCHSTOP", "/Fp%s" % pch_node])
pch_action = SCons.Action.Action('$PCHCOM', '$PCHCOMSTR') pch_action = SCons.Action.Action('$PCHCOM', '$PCHCOMSTR')
pch_builder = SCons.Builder.Builder(action=pch_action, suffix='.pch', pch_builder = SCons.Builder.Builder(action=pch_action, suffix='.pch',
emitter=pch_emitter, emitter=pch_emitter,
source_scanner=SCons.Tool.SourceFileScanner) source_scanner=SCons.Tool.SourceFileScanner)
# Logic to build .rc files into .res files (resource files) # Logic to build .rc files into .res files (resource files)
res_scanner = SCons.Scanner.RC.RCScan() res_scanner = SCons.Scanner.RC.RCScan()
res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR') res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR')
res_builder = SCons.Builder.Builder(action=res_action, res_builder = SCons.Builder.Builder(action=res_action,
src_suffix='.rc', src_suffix='.rc',
skipping to change at line 236 skipping to change at line 246
static_obj.add_emitter(suffix, static_object_emitter) static_obj.add_emitter(suffix, static_object_emitter)
shared_obj.add_emitter(suffix, shared_object_emitter) shared_obj.add_emitter(suffix, shared_object_emitter)
for suffix in CXXSuffixes: for suffix in CXXSuffixes:
static_obj.add_action(suffix, CXXAction) static_obj.add_action(suffix, CXXAction)
shared_obj.add_action(suffix, ShCXXAction) shared_obj.add_action(suffix, ShCXXAction)
static_obj.add_emitter(suffix, static_object_emitter) static_obj.add_emitter(suffix, static_object_emitter)
shared_obj.add_emitter(suffix, shared_object_emitter) shared_obj.add_emitter(suffix, shared_object_emitter)
env['CCPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Z7") or ""}']) env['CCPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Z7") or ""}'])
env['CCPCHFLAGS'] = SCons.Util.CLVar(['${(PCH and "/Yu%s \\\"/Fp%s\\\""%(PCH STOP or "",File(PCH))) or ""}']) env['CCPCHFLAGS'] = gen_ccpchflags
env['_MSVC_OUTPUT_FLAG'] = msvc_output_flag env['_MSVC_OUTPUT_FLAG'] = msvc_output_flag
env['_CCCOMCOM'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $CCPCHFLAGS $CCPD BFLAGS' env['_CCCOMCOM'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $CCPCHFLAGS $CCPD BFLAGS'
env['CC'] = 'cl' env['CC'] = 'cl'
env['CCFLAGS'] = SCons.Util.CLVar('/nologo') env['CCFLAGS'] = SCons.Util.CLVar('/nologo')
env['CFLAGS'] = SCons.Util.CLVar('') env['CFLAGS'] = SCons.Util.CLVar('')
env['CCCOM'] = '${TEMPFILE("$CC $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $CFLAGS $CCFLAGS $_CCCOMCOM","$CCCOMSTR")}' env['CCCOM'] = '${TEMPFILE("$CC $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $CFLAGS $CCFLAGS $_CCCOMCOM","$CCCOMSTR")}'
env['SHCC'] = '$CC' env['SHCC'] = '$CC'
env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS')
env['SHCFLAGS'] = SCons.Util.CLVar('$CFLAGS') env['SHCFLAGS'] = SCons.Util.CLVar('$CFLAGS')
env['SHCCCOM'] = '${TEMPFILE("$SHCC $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCE S $SHCFLAGS $SHCCFLAGS $_CCCOMCOM","$SHCCCOMSTR")}' env['SHCCCOM'] = '${TEMPFILE("$SHCC $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCE S $SHCFLAGS $SHCCFLAGS $_CCCOMCOM","$SHCCCOMSTR")}'
 End of changes. 8 change blocks. 
16 lines changed or deleted 27 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)