diff options
Diffstat (limited to 'scons')
-rw-r--r-- | scons/mslib_sa.py | 137 | ||||
-rw-r--r-- | scons/mslink_sa.py | 246 | ||||
-rw-r--r-- | scons/msvc_sa.py | 246 | ||||
-rw-r--r-- | scons/wcesdk.py | 176 | ||||
-rw-r--r-- | scons/winddk.py | 148 | ||||
-rw-r--r-- | scons/winsdk.py | 131 |
6 files changed, 0 insertions, 1084 deletions
diff --git a/scons/mslib_sa.py b/scons/mslib_sa.py deleted file mode 100644 index bdc0dd92511..00000000000 --- a/scons/mslib_sa.py +++ /dev/null @@ -1,137 +0,0 @@ -"""mslib_sa - -Tool-specific initialization for lib (MicroSoft library archiver). - -Based on SCons.Tool.mslib, without the MSVC detection. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -import os -import tempfile -import string - -import SCons.Defaults -import SCons.Tool -import SCons.Util -import SCons.Errors - -class TempFileMunge: - """Same as SCons.Platform.TempFileMunge, but preserves LINK /LIB - together.""" - - def __init__(self, cmd): - self.cmd = cmd - - def __call__(self, target, source, env, for_signature): - if for_signature: - return self.cmd - cmd = env.subst_list(self.cmd, 0, target, source)[0] - try: - maxline = int(env.subst('$MAXLINELENGTH')) - except ValueError: - maxline = 2048 - - if (reduce(lambda x, y: x + len(y), cmd, 0) + len(cmd)) <= maxline: - return self.cmd - - # We do a normpath because mktemp() has what appears to be - # a bug in Windows that will use a forward slash as a path - # delimiter. Windows's link mistakes that for a command line - # switch and barfs. - # - # We use the .lnk suffix for the benefit of the Phar Lap - # linkloc linker, which likes to append an .lnk suffix if - # none is given. - tmp = os.path.normpath(tempfile.mktemp('.lnk')) - native_tmp = SCons.Util.get_native_path(tmp) - - if env['SHELL'] and env['SHELL'] == 'sh': - # The sh shell will try to escape the backslashes in the - # path, so unescape them. - native_tmp = string.replace(native_tmp, '\\', r'\\\\') - # In Cygwin, we want to use rm to delete the temporary - # file, because del does not exist in the sh shell. - rm = env.Detect('rm') or 'del' - else: - # Don't use 'rm' if the shell is not sh, because rm won't - # work with the Windows shells (cmd.exe or command.com) or - # Windows path names. - rm = 'del' - - prefix = env.subst('$TEMPFILEPREFIX') - if not prefix: - prefix = '@' - - if cmd[0:2] == ['link', '/lib']: - split = 2 - else: - split = 1 - - args = map(SCons.Subst.quote_spaces, cmd[split:]) - open(tmp, 'w').write(string.join(args, " ") + "\n") - # XXX Using the SCons.Action.print_actions value directly - # like this is bogus, but expedient. This class should - # really be rewritten as an Action that defines the - # __call__() and strfunction() methods and lets the - # normal action-execution logic handle whether or not to - # print/execute the action. The problem, though, is all - # of that is decided before we execute this method as - # part of expanding the $TEMPFILE construction variable. - # Consequently, refactoring this will have to wait until - # we get more flexible with allowing Actions to exist - # independently and get strung together arbitrarily like - # Ant tasks. In the meantime, it's going to be more - # user-friendly to not let obsession with architectural - # purity get in the way of just being helpful, so we'll - # reach into SCons.Action directly. - if SCons.Action.print_actions: - print("Using tempfile "+native_tmp+" for command line:\n"+ - " ".join(map(str,cmd))) - return cmd[:split] + [ prefix + native_tmp + '\n' + rm, native_tmp ] - -def generate(env): - """Add Builders and construction variables for lib to an Environment.""" - SCons.Tool.createStaticLibBuilder(env) - - if env.Detect('lib'): - env['AR'] = 'lib' - else: - # Recent WINDDK versions do not ship with lib. - env['AR'] = 'link /lib' - env['TEMPFILE'] = TempFileMunge - env['ARFLAGS'] = SCons.Util.CLVar('/nologo') - env['ARCOM'] = "${TEMPFILE('$AR $ARFLAGS /OUT:$TARGET $SOURCES')}" - env['LIBPREFIX'] = '' - env['LIBSUFFIX'] = '.lib' - -def exists(env): - return env.Detect('lib') or env.Detect('link') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/scons/mslink_sa.py b/scons/mslink_sa.py deleted file mode 100644 index 0ecdf24a929..00000000000 --- a/scons/mslink_sa.py +++ /dev/null @@ -1,246 +0,0 @@ -"""mslink_sa - -Tool-specific initialization for the Microsoft linker. - -Based on SCons.Tool.mslink, without the MSVS detection. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -import os.path - -import SCons.Action -import SCons.Defaults -import SCons.Errors -import SCons.Platform.win32 -import SCons.Tool -import SCons.Tool.msvc -import SCons.Util - -def pdbGenerator(env, target, source, for_signature): - try: - return ['/PDB:%s' % target[0].attributes.pdb, '/DEBUG'] - except (AttributeError, IndexError): - return None - -def _dllTargets(target, source, env, for_signature, paramtp): - listCmd = [] - dll = env.FindIxes(target, '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp) - if dll: listCmd.append("/out:%s"%dll.get_string(for_signature)) - - implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') - if implib: listCmd.append("/implib:%s"%implib.get_string(for_signature)) - - return listCmd - -def _dllSources(target, source, env, for_signature, paramtp): - listCmd = [] - - deffile = env.FindIxes(source, "WINDOWSDEFPREFIX", "WINDOWSDEFSUFFIX") - for src in source: - # Check explicitly for a non-None deffile so that the __cmp__ - # method of the base SCons.Util.Proxy class used for some Node - # proxies doesn't try to use a non-existent __dict__ attribute. - if deffile and src == deffile: - # Treat this source as a .def file. - listCmd.append("/def:%s" % src.get_string(for_signature)) - else: - # Just treat it as a generic source file. - listCmd.append(src) - return listCmd - -def windowsShlinkTargets(target, source, env, for_signature): - return _dllTargets(target, source, env, for_signature, 'SHLIB') - -def windowsShlinkSources(target, source, env, for_signature): - return _dllSources(target, source, env, for_signature, 'SHLIB') - -def _windowsLdmodTargets(target, source, env, for_signature): - """Get targets for loadable modules.""" - return _dllTargets(target, source, env, for_signature, 'LDMODULE') - -def _windowsLdmodSources(target, source, env, for_signature): - """Get sources for loadable modules.""" - return _dllSources(target, source, env, for_signature, 'LDMODULE') - -def _dllEmitter(target, source, env, paramtp): - """Common implementation of dll emitter.""" - SCons.Tool.msvc.validate_vars(env) - - extratargets = [] - extrasources = [] - - dll = env.FindIxes(target, '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp) - no_import_lib = env.get('no_import_lib', 0) - - if not dll: - raise SCons.Errors.UserError, 'A shared library should have exactly one target with the suffix: %s' % env.subst('$%sSUFFIX' % paramtp) - - insert_def = env.subst("$WINDOWS_INSERT_DEF") - if not insert_def in ['', '0', 0] and \ - not env.FindIxes(source, "WINDOWSDEFPREFIX", "WINDOWSDEFSUFFIX"): - - # append a def file to the list of sources - extrasources.append( - env.ReplaceIxes(dll, - '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp, - "WINDOWSDEFPREFIX", "WINDOWSDEFSUFFIX")) - - if env.has_key('PDB') and env['PDB']: - pdb = env.arg2nodes('$PDB', target=target, source=source)[0] - extratargets.append(pdb) - target[0].attributes.pdb = pdb - - if not no_import_lib and \ - not env.FindIxes(target, "LIBPREFIX", "LIBSUFFIX"): - # Append an import library to the list of targets. - extratargets.append( - env.ReplaceIxes(dll, - '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp, - "LIBPREFIX", "LIBSUFFIX")) - # and .exp file is created if there are exports from a DLL - extratargets.append( - env.ReplaceIxes(dll, - '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp, - "WINDOWSEXPPREFIX", "WINDOWSEXPSUFFIX")) - - return (target+extratargets, source+extrasources) - -def windowsLibEmitter(target, source, env): - return _dllEmitter(target, source, env, 'SHLIB') - -def ldmodEmitter(target, source, env): - """Emitter for loadable modules. - - Loadable modules are identical to shared libraries on Windows, but building - them is subject to different parameters (LDMODULE*). - """ - return _dllEmitter(target, source, env, 'LDMODULE') - -def prog_emitter(target, source, env): - SCons.Tool.msvc.validate_vars(env) - - extratargets = [] - - exe = env.FindIxes(target, "PROGPREFIX", "PROGSUFFIX") - if not exe: - raise SCons.Errors.UserError, "An executable should have exactly one target with the suffix: %s" % env.subst("$PROGSUFFIX") - - if env.has_key('PDB') and env['PDB']: - pdb = env.arg2nodes('$PDB', target=target, source=source)[0] - extratargets.append(pdb) - target[0].attributes.pdb = pdb - - return (target+extratargets,source) - -def RegServerFunc(target, source, env): - if env.has_key('register') and env['register']: - ret = regServerAction([target[0]], [source[0]], env) - if ret: - raise SCons.Errors.UserError, "Unable to register %s" % target[0] - else: - print "Registered %s sucessfully" % target[0] - return ret - return 0 - -regServerAction = SCons.Action.Action("$REGSVRCOM", "$REGSVRCOMSTR") -regServerCheck = SCons.Action.Action(RegServerFunc, None) -shlibLinkAction = SCons.Action.Action('${TEMPFILE("$SHLINK $SHLINKFLAGS $_SHLINK_TARGETS $_LIBDIRFLAGS $_LIBFLAGS $_PDB $_SHLINK_SOURCES")}') -compositeShLinkAction = shlibLinkAction + regServerCheck -ldmodLinkAction = SCons.Action.Action('${TEMPFILE("$LDMODULE $LDMODULEFLAGS $_LDMODULE_TARGETS $_LIBDIRFLAGS $_LIBFLAGS $_PDB $_LDMODULE_SOURCES")}') -compositeLdmodAction = ldmodLinkAction + regServerCheck - -def generate(env): - """Add Builders and construction variables for ar to an Environment.""" - SCons.Tool.createSharedLibBuilder(env) - SCons.Tool.createProgBuilder(env) - - env['SHLINK'] = '$LINK' - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS /dll') - env['_SHLINK_TARGETS'] = windowsShlinkTargets - env['_SHLINK_SOURCES'] = windowsShlinkSources - env['SHLINKCOM'] = compositeShLinkAction - env.Append(SHLIBEMITTER = [windowsLibEmitter]) - env['LINK'] = 'link' - env['LINKFLAGS'] = SCons.Util.CLVar('/nologo') - env['_PDB'] = pdbGenerator - env['LINKCOM'] = '${TEMPFILE("$LINK $LINKFLAGS /OUT:$TARGET.windows $_LIBDIRFLAGS $_LIBFLAGS $_PDB $SOURCES.windows")}' - env.Append(PROGEMITTER = [prog_emitter]) - env['LIBDIRPREFIX']='/LIBPATH:' - env['LIBDIRSUFFIX']='' - env['LIBLINKPREFIX']='' - env['LIBLINKSUFFIX']='$LIBSUFFIX' - - env['WIN32DEFPREFIX'] = '' - env['WIN32DEFSUFFIX'] = '.def' - env['WIN32_INSERT_DEF'] = 0 - env['WINDOWSDEFPREFIX'] = '${WIN32DEFPREFIX}' - env['WINDOWSDEFSUFFIX'] = '${WIN32DEFSUFFIX}' - env['WINDOWS_INSERT_DEF'] = '${WIN32_INSERT_DEF}' - - env['WIN32EXPPREFIX'] = '' - env['WIN32EXPSUFFIX'] = '.exp' - env['WINDOWSEXPPREFIX'] = '${WIN32EXPPREFIX}' - env['WINDOWSEXPSUFFIX'] = '${WIN32EXPSUFFIX}' - - env['WINDOWSSHLIBMANIFESTPREFIX'] = '' - env['WINDOWSSHLIBMANIFESTSUFFIX'] = '${SHLIBSUFFIX}.manifest' - env['WINDOWSPROGMANIFESTPREFIX'] = '' - env['WINDOWSPROGMANIFESTSUFFIX'] = '${PROGSUFFIX}.manifest' - - env['REGSVRACTION'] = regServerCheck - env['REGSVR'] = os.path.join(SCons.Platform.win32.get_system_root(),'System32','regsvr32') - env['REGSVRFLAGS'] = '/s ' - env['REGSVRCOM'] = '$REGSVR $REGSVRFLAGS ${TARGET.windows}' - - # Loadable modules are on Windows the same as shared libraries, but they - # are subject to different build parameters (LDMODULE* variables). - # Therefore LDMODULE* variables correspond as much as possible to - # SHLINK*/SHLIB* ones. - SCons.Tool.createLoadableModuleBuilder(env) - env['LDMODULE'] = '$SHLINK' - env['LDMODULEPREFIX'] = '$SHLIBPREFIX' - env['LDMODULESUFFIX'] = '$SHLIBSUFFIX' - env['LDMODULEFLAGS'] = '$SHLINKFLAGS' - env['_LDMODULE_TARGETS'] = _windowsLdmodTargets - env['_LDMODULE_SOURCES'] = _windowsLdmodSources - env['LDMODULEEMITTER'] = [ldmodEmitter] - env['LDMODULECOM'] = compositeLdmodAction - -def exists(env): - platform = env.get('PLATFORM', '') - if platform in ('win32', 'cygwin'): - # Only explicitly search for a 'link' executable on Windows - # systems. Some other systems (e.g. Ubuntu Linux) have an - # executable named 'link' and we don't want that to make SCons - # think Visual Studio is installed. - return env.Detect('link') - return None - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/scons/msvc_sa.py b/scons/msvc_sa.py deleted file mode 100644 index a9136629203..00000000000 --- a/scons/msvc_sa.py +++ /dev/null @@ -1,246 +0,0 @@ -"""msvc_sa - -Tool-specific initialization for Microsoft Visual C/C++. - -Based on SCons.Tool.msvc, without the MSVS detection. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -import os.path -import re -import string - -import SCons.Action -import SCons.Builder -import SCons.Errors -import SCons.Platform.win32 -import SCons.Tool -import SCons.Util -import SCons.Warnings -import SCons.Scanner.RC - -CSuffixes = ['.c', '.C'] -CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++'] - -def validate_vars(env): - """Validate the PCH and PCHSTOP construction variables.""" - if env.has_key('PCH') and env['PCH']: - if not env.has_key('PCHSTOP'): - raise SCons.Errors.UserError, "The PCHSTOP construction must be defined if PCH is defined." - if not SCons.Util.is_String(env['PCHSTOP']): - raise SCons.Errors.UserError, "The PCHSTOP construction variable must be a string: %r"%env['PCHSTOP'] - -def pch_emitter(target, source, env): - """Adds the object file target.""" - - validate_vars(env) - - pch = None - obj = None - - for t in target: - if SCons.Util.splitext(str(t))[1] == '.pch': - pch = t - if SCons.Util.splitext(str(t))[1] == '.obj': - obj = t - - if not obj: - obj = SCons.Util.splitext(str(pch))[0]+'.obj' - - target = [pch, obj] # pch must be first, and obj second for the PCHCOM to work - - return (target, source) - -def object_emitter(target, source, env, parent_emitter): - """Sets up the PCH dependencies for an object file.""" - - validate_vars(env) - - parent_emitter(target, source, env) - - if env.has_key('PCH') and env['PCH']: - env.Depends(target, env['PCH']) - - return (target, source) - -def static_object_emitter(target, source, env): - return object_emitter(target, source, env, - SCons.Defaults.StaticObjectEmitter) - -def shared_object_emitter(target, source, env): - return object_emitter(target, source, env, - SCons.Defaults.SharedObjectEmitter) - -pch_action = SCons.Action.Action('$PCHCOM', '$PCHCOMSTR') -pch_builder = SCons.Builder.Builder(action=pch_action, suffix='.pch', - emitter=pch_emitter, - source_scanner=SCons.Tool.SourceFileScanner) - - -# Logic to build .rc files into .res files (resource files) -res_scanner = SCons.Scanner.RC.RCScan() -res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR') -res_builder = SCons.Builder.Builder(action=res_action, - src_suffix='.rc', - suffix='.res', - src_builder=[], - source_scanner=res_scanner) - -def msvc_batch_key(action, env, target, source): - """ - Returns a key to identify unique batches of sources for compilation. - - If batching is enabled (via the $MSVC_BATCH setting), then all - target+source pairs that use the same action, defined by the same - environment, and have the same target and source directories, will - be batched. - - Returning None specifies that the specified target+source should not - be batched with other compilations. - """ - b = env.subst('$MSVC_BATCH') - if b in (None, '', '0'): - # We're not using batching; return no key. - return None - t = target[0] - s = source[0] - if os.path.splitext(t.name)[0] != os.path.splitext(s.name)[0]: - # The base names are different, so this *must* be compiled - # separately; return no key. - return None - return (id(action), id(env), t.dir, s.dir) - -def msvc_output_flag(target, source, env, for_signature): - """ - Returns the correct /Fo flag for batching. - - If batching is disabled or there's only one source file, then we - return an /Fo string that specifies the target explicitly. Otherwise, - we return an /Fo string that just specifies the first target's - directory (where the Visual C/C++ compiler will put the .obj files). - """ - b = env.subst('$MSVC_BATCH') - if b in (None, '', '0') or len(source) == 1: - return '/Fo$TARGET' - else: - # The Visual C/C++ compiler requires a \ at the end of the /Fo - # option to indicate an output directory. We use os.sep here so - # that the test(s) for this can be run on non-Windows systems - # without having a hard-coded backslash mess up command-line - # argument parsing. - return '/Fo${TARGET.dir}' + os.sep - -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): - """Add Builders and construction variables for MSVC++ to an Environment.""" - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - - # TODO(batch): shouldn't reach in to cmdgen this way; necessary - # for now to bypass the checks in Builder.DictCmdGenerator.__call__() - # and allow .cc and .cpp to be compiled in the same command line. - static_obj.cmdgen.source_ext_match = False - shared_obj.cmdgen.source_ext_match = False - - for suffix in CSuffixes: - static_obj.add_action(suffix, CAction) - shared_obj.add_action(suffix, ShCAction) - static_obj.add_emitter(suffix, static_object_emitter) - shared_obj.add_emitter(suffix, shared_object_emitter) - - for suffix in CXXSuffixes: - static_obj.add_action(suffix, CXXAction) - shared_obj.add_action(suffix, ShCXXAction) - static_obj.add_emitter(suffix, static_object_emitter) - shared_obj.add_emitter(suffix, shared_object_emitter) - - env['CCPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Z7") or ""}']) - env['CCPCHFLAGS'] = SCons.Util.CLVar(['${(PCH and "/Yu%s /Fp%s"%(PCHSTOP or "",File(PCH))) or ""}']) - env['_MSVC_OUTPUT_FLAG'] = msvc_output_flag - env['_CCCOMCOM'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $CCPCHFLAGS $CCPDBFLAGS' - env['CC'] = 'cl' - env['CCFLAGS'] = SCons.Util.CLVar('/nologo') - env['CFLAGS'] = SCons.Util.CLVar('') - env['CCCOM'] = '$CC $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $CFLAGS $CCFLAGS $_CCCOMCOM' - env['SHCC'] = '$CC' - env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') - env['SHCFLAGS'] = SCons.Util.CLVar('$CFLAGS') - env['SHCCCOM'] = '$SHCC $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $SHCFLAGS $SHCCFLAGS $_CCCOMCOM' - env['CXX'] = '$CC' - env['CXXFLAGS'] = SCons.Util.CLVar('$( /TP $)') - env['CXXCOM'] = '$CXX $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $CXXFLAGS $CCFLAGS $_CCCOMCOM' - env['SHCXX'] = '$CXX' - env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') - env['SHCXXCOM'] = '$SHCXX $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $SHCXXFLAGS $SHCCFLAGS $_CCCOMCOM' - env['CPPDEFPREFIX'] = '/D' - env['CPPDEFSUFFIX'] = '' - env['INCPREFIX'] = '/I' - env['INCSUFFIX'] = '' -# env.Append(OBJEMITTER = [static_object_emitter]) -# env.Append(SHOBJEMITTER = [shared_object_emitter]) - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 - - env['RC'] = 'rc' - env['RCFLAGS'] = SCons.Util.CLVar('') - env['RCSUFFIXES']=['.rc','.rc2'] - env['RCCOM'] = '$RC $_CPPDEFFLAGS $_CPPINCFLAGS $RCFLAGS /fo$TARGET $SOURCES' - env['BUILDERS']['RES'] = res_builder - env['OBJPREFIX'] = '' - env['OBJSUFFIX'] = '.obj' - env['SHOBJPREFIX'] = '$OBJPREFIX' - env['SHOBJSUFFIX'] = '$OBJSUFFIX' - - env['CFILESUFFIX'] = '.c' - env['CXXFILESUFFIX'] = '.cc' - - env['PCHPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Yd") or ""}']) - env['PCHCOM'] = '$CXX /Fo${TARGETS[1]} $CXXFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Yc$PCHSTOP /Fp${TARGETS[0]} $CCPDBFLAGS $PCHPDBFLAGS' - env['BUILDERS']['PCH'] = pch_builder - - if not env.has_key('ENV'): - env['ENV'] = {} - if not env['ENV'].has_key('SystemRoot'): # required for dlls in the winsxs folders - env['ENV']['SystemRoot'] = SCons.Platform.win32.get_system_root() - -def exists(env): - return env.Detect('cl') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/scons/wcesdk.py b/scons/wcesdk.py deleted file mode 100644 index e82f255c515..00000000000 --- a/scons/wcesdk.py +++ /dev/null @@ -1,176 +0,0 @@ -"""wcesdk - -Tool-specific initialization for Microsoft Window CE SDKs. - -""" - -# -# Copyright (c) 2001-2007 The SCons Foundation -# Copyright (c) 2008 Tungsten Graphics, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -import os.path -import re -import string - -import SCons.Action -import SCons.Builder -import SCons.Errors -import SCons.Platform.win32 -import SCons.Tool -import SCons.Util -import SCons.Warnings - -import msvc_sa -import mslib_sa -import mslink_sa - -def get_wce500_paths(env): - """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_paths = [] - lib_paths = [] - include_paths = [] - - # mymic the batch files located in Microsoft eMbedded C++ 4.0\EVC\WCExxx\BIN - os_version = os.environ.get('OSVERSION', 'WCE500') - platform = os.environ.get('PLATFORM', 'STANDARDSDK_500') - wce_root = os.environ.get('WCEROOT', 'C:\\Program Files\\Microsoft eMbedded C++ 4.0') - sdk_root = os.environ.get('SDKROOT', 'C:\\Windows CE Tools') - - target_cpu = 'x86' - cfg = 'none' - - exe_paths.append( os.path.join(wce_root, 'COMMON', 'EVC', 'bin') ) - exe_paths.append( os.path.join(wce_root, 'EVC', os_version, 'bin') ) - include_paths.append( os.path.join(sdk_root, os_version, platform, 'include', target_cpu) ) - include_paths.append( os.path.join(sdk_root, os_version, platform, 'MFC', 'include') ) - include_paths.append( os.path.join(sdk_root, os_version, platform, 'ATL', 'include') ) - lib_paths.append( os.path.join(sdk_root, os_version, platform, 'lib', target_cpu) ) - lib_paths.append( os.path.join(sdk_root, os_version, platform, 'MFC', 'lib', target_cpu) ) - lib_paths.append( os.path.join(sdk_root, os_version, platform, 'ATL', 'lib', target_cpu) ) - - include_path = string.join( include_paths, os.pathsep ) - lib_path = string.join(lib_paths, os.pathsep ) - exe_path = string.join(exe_paths, os.pathsep ) - return (include_path, lib_path, exe_path) - -def get_wce600_root(env): - try: - return os.environ['_WINCEROOT'] - except KeyError: - pass - - if SCons.Util.can_read_reg: - key = r'SOFTWARE\Microsoft\Platform Builder\6.00\Directories\OS Install Dir' - try: - path, t = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, key) - except SCons.Util.RegError: - pass - else: - return path - - default_path = os.path.join(r'C:\WINCE600', version) - if os.path.exists(default_path): - return default_path - - return None - -def get_wce600_paths(env): - """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_paths = [] - lib_paths = [] - include_paths = [] - - # See also C:\WINCE600\public\common\oak\misc\wince.bat - - wince_root = get_wce600_root(env) - if wince_root is None: - raise SCons.Errors.InternalError, "Windows CE 6.0 SDK not found" - - os_version = os.environ.get('_WINCEOSVER', '600') - platform_root = os.environ.get('_PLATFORMROOT', os.path.join(wince_root, 'platform')) - sdk_root = os.environ.get('_SDKROOT' ,os.path.join(wince_root, 'sdk')) - - platform_root = os.environ.get('_PLATFORMROOT', os.path.join(wince_root, 'platform')) - sdk_root = os.environ.get('_SDKROOT' ,os.path.join(wince_root, 'sdk')) - - host_cpu = os.environ.get('_HOSTCPUTYPE', 'i386') - target_cpu = os.environ.get('_TGTCPU', 'x86') - - if env['build'] == 'debug': - build = 'debug' - else: - build = 'retail' - - try: - project_root = os.environ['_PROJECTROOT'] - except KeyError: - # No project root defined -- use the common stuff instead - project_root = os.path.join(wince_root, 'public', 'common') - - exe_paths.append( os.path.join(sdk_root, 'bin', host_cpu) ) - exe_paths.append( os.path.join(sdk_root, 'bin', host_cpu, target_cpu) ) - exe_paths.append( os.path.join(wince_root, 'common', 'oak', 'bin', host_cpu) ) - exe_paths.append( os.path.join(wince_root, 'common', 'oak', 'misc') ) - - include_paths.append( os.path.join(project_root, 'sdk', 'inc') ) - include_paths.append( os.path.join(project_root, 'oak', 'inc') ) - include_paths.append( os.path.join(project_root, 'ddk', 'inc') ) - include_paths.append( os.path.join(sdk_root, 'CE', 'inc') ) - - lib_paths.append( os.path.join(project_root, 'sdk', 'lib', target_cpu, build) ) - lib_paths.append( os.path.join(project_root, 'oak', 'lib', target_cpu, build) ) - lib_paths.append( os.path.join(project_root, 'ddk', 'lib', target_cpu, build) ) - - include_path = string.join( include_paths, os.pathsep ) - lib_path = string.join(lib_paths, os.pathsep ) - exe_path = string.join(exe_paths, os.pathsep ) - return (include_path, lib_path, exe_path) - -def generate(env): - - msvc_sa.generate(env) - mslib_sa.generate(env) - mslink_sa.generate(env) - - if not env.has_key('ENV'): - env['ENV'] = {} - - try: - include_path, lib_path, exe_path = get_wce600_paths(env) - - env.PrependENVPath('INCLUDE', include_path) - env.PrependENVPath('LIB', lib_path) - env.PrependENVPath('PATH', exe_path) - except (SCons.Util.RegError, SCons.Errors.InternalError): - pass - -def exists(env): - return get_wce600_root(env) is not None - -# vim:set ts=4 sw=4 et: diff --git a/scons/winddk.py b/scons/winddk.py deleted file mode 100644 index 4dac16ee66e..00000000000 --- a/scons/winddk.py +++ /dev/null @@ -1,148 +0,0 @@ -"""winddk - -Tool-specific initialization for Microsoft Windows DDK. - -""" - -# -# Copyright (c) 2001-2007 The SCons Foundation -# Copyright (c) 2008 Tungsten Graphics, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -import os.path -import re -import string - -import SCons.Action -import SCons.Builder -import SCons.Errors -import SCons.Platform.win32 -import SCons.Tool -import SCons.Util -import SCons.Warnings - -import msvc_sa -import mslib_sa -import mslink_sa - -versions = [ - '6001.18002', - '3790.1830', -] - -def cpu_bin(target_cpu): - if target_cpu == 'i386': - return 'x86' - else: - return target_cpu - -def get_winddk_root(env, version): - default_path = os.path.join(r'C:\WINDDK', version) - if os.path.exists(default_path): - return default_path - return None - -def get_winddk_paths(env, version, root): - version_major, version_minor = map(int, version.split('.')) - - if version_major >= 6000: - target_os = 'wlh' - else: - target_os = 'wxp' - - if env['machine'] in ('generic', 'x86'): - target_cpu = 'i386' - elif env['machine'] == 'x86_64': - target_cpu = 'amd64' - else: - raise SCons.Errors.InternalError, "Unsupported target machine" - - if version_major >= 6000: - # TODO: take in consideration the host cpu - bin_dir = os.path.join(root, 'bin', 'x86', cpu_bin(target_cpu)) - else: - if target_cpu == 'i386': - bin_dir = os.path.join(root, 'bin', 'x86') - else: - # TODO: take in consideration the host cpu - bin_dir = os.path.join(root, 'bin', 'win64', 'x86', cpu_bin(target_cpu)) - - crt_inc_dir = os.path.join(root, 'inc', 'crt') - if version_major >= 6000: - sdk_inc_dir = os.path.join(root, 'inc', 'api') - ddk_inc_dir = os.path.join(root, 'inc', 'ddk') - wdm_inc_dir = os.path.join(root, 'inc', 'ddk') - else: - ddk_inc_dir = os.path.join(root, 'inc', 'ddk', target_os) - sdk_inc_dir = os.path.join(root, 'inc', target_os) - wdm_inc_dir = os.path.join(root, 'inc', 'ddk', 'wdm', target_os) - - if env['toolchain'] == 'winddk': - env.PrependENVPath('PATH', [bin_dir]) - env.PrependENVPath('INCLUDE', [ - wdm_inc_dir, - ddk_inc_dir, - crt_inc_dir, - sdk_inc_dir, - ]) - env.PrependENVPath('LIB', [ - os.path.join(root, 'lib', 'crt', target_cpu), - os.path.join(root, 'lib', target_os, target_cpu), - ]) - elif env['toolchain'] == 'crossmingw': - env.Prepend(CPPFLAGS = [ - '-isystem', ddk_inc_dir, - '-isystem', sdk_inc_dir, - ]) - else: - env.Prepend(CPPPATH = [ - wdm_inc_dir, - ddk_inc_dir, - sdk_inc_dir, - ]) - env.Prepend(LIBPATH = [ - os.path.join(root, 'lib', target_os, target_cpu), - ]) - - -def generate(env): - if not env.has_key('ENV'): - env['ENV'] = {} - - for version in versions: - root = get_winddk_root(env, version) - if root is not None: - get_winddk_paths(env, version, root) - break - - if env['toolchain'] == 'winddk': - msvc_sa.generate(env) - mslib_sa.generate(env) - mslink_sa.generate(env) - -def exists(env): - for version in versions: - if get_winddk_root(env, version) is not None: - return True - return False - -# vim:set ts=4 sw=4 et: diff --git a/scons/winsdk.py b/scons/winsdk.py deleted file mode 100644 index 7e874a507b8..00000000000 --- a/scons/winsdk.py +++ /dev/null @@ -1,131 +0,0 @@ -"""winsdk - -Tool-specific initialization for Microsoft Windows SDK. - -""" - -# -# Copyright (c) 2001-2007 The SCons Foundation -# Copyright (c) 2008 Tungsten Graphics, Inc. -# Copyright (c) 2009 VMware, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -import os.path -import platform - -import SCons.Errors -import SCons.Util - -import msvc_sa -import mslib_sa -import mslink_sa - - -def get_vs_root(env): - # TODO: Check HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7 - path = os.path.join(os.getenv('ProgramFiles', r'C:\Program Files'), 'Microsoft Visual Studio 9.0') - return path - -def get_vs_paths(env): - vs_root = get_vs_root(env) - if vs_root is None: - raise SCons.Errors.InternalError, "WINSDK compiler not found" - - tool_path = os.path.join(vs_root, 'Common7', 'IDE') - - env.PrependENVPath('PATH', tool_path) - -def get_vc_root(env): - # TODO: Check HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VC7 - path = os.path.join(os.getenv('ProgramFiles', r'C:\Program Files'), 'Microsoft Visual Studio 9.0', 'VC') - return path - -def get_vc_paths(env): - vc_root = get_vc_root(env) - if vc_root is None: - raise SCons.Errors.InternalError, "WINSDK compiler not found" - - target_cpu = env['machine'] - - if target_cpu in ('generic', 'x86'): - bin_dir = 'bin' - lib_dir = 'lib' - elif target_cpu == 'x86_64': - # TODO: take in consideration the host cpu - bin_dir = r'bin\x86_amd64' - lib_dir = r'lib\amd64' - else: - raise SCons.Errors.InternalError, "Unsupported target machine" - include_dir = 'include' - - env.PrependENVPath('PATH', os.path.join(vc_root, bin_dir)) - env.PrependENVPath('INCLUDE', os.path.join(vc_root, include_dir)) - env.PrependENVPath('LIB', os.path.join(vc_root, lib_dir)) - -def get_sdk_root(env): - if SCons.Util.can_read_reg: - key = r'SOFTWARE\Microsoft\Microsoft SDKs\Windows\CurrentInstallFolder' - try: - path, t = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, key) - except SCons.Util.RegError: - pass - else: - return path - - return None - -def get_sdk_paths(env): - sdk_root = get_sdk_root(env) - if sdk_root is None: - raise SCons.Errors.InternalError, "WINSDK not found" - - target_cpu = env['machine'] - - bin_dir = 'Bin' - if target_cpu in ('generic', 'x86'): - lib_dir = 'Lib' - elif target_cpu == 'x86_64': - lib_dir = r'Lib\x64' - else: - raise SCons.Errors.InternalError, "Unsupported target machine" - include_dir = 'Include' - - env.PrependENVPath('PATH', os.path.join(sdk_root, bin_dir)) - env.PrependENVPath('INCLUDE', os.path.join(sdk_root, include_dir)) - env.PrependENVPath('LIB', os.path.join(sdk_root, lib_dir)) - -def generate(env): - if not env.has_key('ENV'): - env['ENV'] = {} - - get_vs_paths(env) - get_vc_paths(env) - get_sdk_paths(env) - - msvc_sa.generate(env) - mslib_sa.generate(env) - mslink_sa.generate(env) - -def exists(env): - return get_vc_root(env) is not None and get_sdk_root(env) is not None - -# vim:set ts=4 sw=4 et: |