diff options
author | Dirk Baechle <dl9obn@darc.de> | 2015-04-06 16:40:24 +0200 |
---|---|---|
committer | Dirk Baechle <dl9obn@darc.de> | 2015-04-06 16:40:24 +0200 |
commit | 92907f21e0a36be8ef154562af8232f39d7dc842 (patch) | |
tree | 1a02c6889f352c73a293e2edf5586896a8371f3f | |
parent | 7e8b998e6e4174389d8754f7a20ab565b1dc8429 (diff) | |
parent | f1e7810fcb0dbcf7c44768a4139144d25c3142d6 (diff) | |
download | scons-92907f21e0a36be8ef154562af8232f39d7dc842.tar.gz |
Merged in LaurentMarchelli/scons (pull request #209), implementation of Visual Studio users files
33 files changed, 1314 insertions, 1300 deletions
diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py index 8635f8e6..923e319a 100644 --- a/QMTest/TestSCons.py +++ b/QMTest/TestSCons.py @@ -693,7 +693,7 @@ class TestSCons(TestCommon): else: jni_dirs = ['/System/Library/Frameworks/JavaVM.framework/Versions/%s*/Headers/jni.h'%version] jni_dirs.extend(['/usr/lib/jvm/java-*-sun-%s*/include/jni.h'%version, - '/usr/lib/jvm/java-%s*-openjdk/include/jni.h'%version, + '/usr/lib/jvm/java-%s*-openjdk*/include/jni.h'%version, '/usr/java/jdk%s*/include/jni.h'%version]) dirs = self.paths(jni_dirs) if not dirs: @@ -48,6 +48,12 @@ copyright = "Copyright (c) %s The SCons Foundation" % copyright_years platform = distutils.util.get_platform() +def is_windows(): + if platform.startswith('win'): + return True + else: + return False + SConsignFile() # @@ -56,7 +62,7 @@ SConsignFile() # def whereis(file): exts = [''] - if platform == "win32": + if is_windows(): exts += ['.exe'] for dir in os.environ['PATH'].split(os.pathsep): f = os.path.join(dir, file) @@ -267,7 +273,7 @@ test_local_zip_dir = os.path.join(build_dir, "test-local-zip") unpack_tar_gz_dir = os.path.join(build_dir, "unpack-tar-gz") unpack_zip_dir = os.path.join(build_dir, "unpack-zip") -if platform == "win32": +if is_windows(): tar_hflag = '' python_project_subinst_dir = os.path.join("Lib", "site-packages", project) project_script_subinst_dir = 'Scripts' @@ -331,7 +337,8 @@ try: path = os.path.join(dirname, name) if os.path.isfile(path): arg.write(path) - zf = zipfile.ZipFile(str(target[0]), 'w') + # default ZipFile compression is ZIP_STORED + zf = zipfile.ZipFile(str(target[0]), 'w', compression=zipfile.ZIP_DEFLATED) olddir = os.getcwd() os.chdir(env['CD']) try: os.path.walk(env['PSV'], visit, zf) @@ -356,7 +363,7 @@ try: if not os.path.isdir(dest): open(dest, 'wb').write(zf.read(name)) -except: +except ImportError: if unzip and zip: zipit = "cd $CD && $ZIP $ZIPFLAGS $( ${TARGET.abspath} $) $PSV" unzipit = "$UNZIP $UNZIPFLAGS $SOURCES" @@ -729,10 +736,9 @@ for p in [ scons ]: platform_zip = os.path.join(build, 'dist', "%s.%s.zip" % (pkg_version, platform)) - if platform == "win-amd64": - win32_exe = os.path.join(build, 'dist', "%s.win-amd64.exe" % pkg_version) - else: - win32_exe = os.path.join(build, 'dist', "%s.win32.exe" % pkg_version) + + win64_exe = os.path.join(build, 'dist', "%s.win-amd64.exe" % pkg_version) + win32_exe = os.path.join(build, 'dist', "%s.win32.exe" % pkg_version) # # Update the environment with the relevant information @@ -844,11 +850,13 @@ for p in [ scons ]: distutils_formats = [] - distutils_targets = [ win32_exe ] + distutils_targets = [ win32_exe , win64_exe ] + dist_distutils_targets = [] - dist_distutils_targets = env.Install('$DISTDIR', distutils_targets) - Local(dist_distutils_targets) - AddPostAction(dist_distutils_targets, Chmod(dist_distutils_targets, 0644)) + for target in distutils_targets: + dist_target = env.Install('$DISTDIR', target) + AddPostAction(dist_target, Chmod(dist_target, 0644)) + dist_distutils_targets += dist_target if not gzip: print "gzip not found in %s; skipping .tar.gz package for %s." % (os.environ['PATH'], pkg) @@ -1080,7 +1088,9 @@ for p in [ scons ]: commands.append("$PYTHON $PYTHONFLAGS $SETUP_PY sdist --formats=%s" % \ ','.join(distutils_formats)) - commands.append("$PYTHON $PYTHONFLAGS $SETUP_PY bdist_wininst --plat-name win32 --user-access-control auto") + commands.append("$PYTHON $PYTHONFLAGS $SETUP_PY bdist_wininst --plat-name=win32 --user-access-control auto") + + commands.append("$PYTHON $PYTHONFLAGS $SETUP_PY bdist_wininst --plat-name=win-amd64 --user-access-control auto") env.Command(distutils_targets, build_src_files, commands) @@ -1108,7 +1118,7 @@ for p in [ scons ]: for script in scripts: # add .py extension for scons-local scripts on non-windows platforms - if platform == "win32": + if is_windows(): break local_script = os.path.join(build_dir_local, script) commands.append(Move(local_script + '.py', local_script)) @@ -1132,7 +1142,7 @@ for p in [ scons ]: Local(l) if gzip: - if platform == "win32": + if is_windows(): # avoid problem with tar interpreting c:/ as a remote machine tar_cargs = '-cz --force-local -f' else: diff --git a/bin/SConsDoc.py b/bin/SConsDoc.py index e1c2b0bb..e435b4a7 100644 --- a/bin/SConsDoc.py +++ b/bin/SConsDoc.py @@ -127,8 +127,7 @@ except: try: import lxml except: - print("Failed to import either libxml2/libxslt or lxml") - sys.exit(1) + raise ImportError("Failed to import either libxml2/libxslt or lxml") has_etree = False if not has_libxml2: @@ -154,8 +153,7 @@ if not has_etree: # normal ElementTree install import elementtree.ElementTree as etree except ImportError: - print("Failed to import ElementTree from any known place") - sys.exit(1) + raise ImportError("Failed to import ElementTree from any known place") re_entity = re.compile("\&([^;]+);") re_entity_header = re.compile("<!DOCTYPE\s+sconsdoc\s+[^\]]+\]>") diff --git a/doc/SConscript b/doc/SConscript index 7880ba37..35eb380f 100644 --- a/doc/SConscript +++ b/doc/SConscript @@ -28,25 +28,43 @@ import os.path import re import sys import glob -import SConsDoc -import SConsExamples + import bootstrap Import('build_dir', 'env', 'whereis', 'revaction') -env = env.Clone() +# +# -- Check prerequisites for building the documentation --- +# +skip_doc = False -build = os.path.join(build_dir, 'doc') +try: + import SConsDoc + import SConsExamples +except ImportError as exc: + print("doc: SConsDoc failed to import, the error was:") + print(" ImportError: %s" % exc) + print(" Please make sure that python-libxml2 or python-lxml is installed.") + skip_doc = True fop = whereis('fop') xep = whereis('xep') + +if not fop and not xep: + print "doc: No PDF renderer found (fop|xep)!" + skip_doc = True + +# +# --- Configure build +# +env = env.Clone() + +build = os.path.join(build_dir, 'doc') + epydoc_cli = whereis('epydoc') gs = whereis('gs') lynx = whereis('lynx') -# -# -# dist_doc_tar_gz = '$DISTDIR/scons-doc-${VERSION}.tar.gz' tar_deps = [] @@ -55,7 +73,9 @@ tar_list = [] orig_env = env env = orig_env.Clone(SCONS_PY = File('#src/script/scons.py').rfile()) - +# +# --- Helpers --- +# def writeVersionXml(verfile, date, ver, rev): """ Helper function: Write a version.xml file. """ try: @@ -75,28 +95,49 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY buildrevision "%s"> """ % (date, ver, rev)) + +# The names of the target files for the MAN pages +man_page_list = ['scons.1','scons-time.1','sconsign.1'] + +# Template for the MAN page texts when we can't properly +# create them because the skip_doc flag is set (required +# modules/tools aren't installed in the current system) +man_replace_tpl = """.TH "%(uctitle)s" "1" "%(today)s" "SCons %(version)s" "SCons %(version)s" +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.nh +.ad l +.SH "NOTE" +%(title)s \- This is a replacement file, stemming from an incomplete +packaging process without the required doc modules installed. Please +update the system and try running bootstrap.py again. +""" + # -# Check whether we have all tools installed for -# building the documentation. +# --- Processing --- # -skip_doc = False -try: - import libxml2 - import libxslt -except: - try: - import lxml - except: - print "doc: Neither libxml2 nor lxml Python bindings found!" - print " Please install one of the packages python-libxml2 or python-lxml." - skip_doc = True - -if not fop and not xep: - print "doc: No PDF renderer found (fop|xep)!" - skip_doc = True - if skip_doc: print "doc: ...skipping building User Guide." + print " ...creating fake MAN pages." + + # Since the top-level SConstruct requires the MAN + # pages to exist for the basic packaging, we create simple + # stub texts here as replacement... + scdir = os.path.join(build, 'man') + if not os.path.isdir(scdir): + os.makedirs(scdir) + + import datetime + today = datetime.date.today().strftime("%m/%d/%Y") + version = env.subst('$VERSION') + for m in man_page_list: + man, _ = os.path.splitext(m) + fman = open(os.path.join(scdir, m), "w") + fman.write(man_replace_tpl % {'uctitle' : man.upper().replace("-", "\\-"), + 'today' : today, + 'title' : man, + 'version' : version}) + fman.close() else: if not lynx: print "doc: Warning, lynx is not installed...created release packages won't be complete!" @@ -275,9 +316,6 @@ else: 'man' : (['man','epub','text'], [], []) } - # The names of the target files for the MAN pages - man_page_list = ['scons.1','scons-time.1','sconsign.1'] - # # We have to tell SCons to scan the top-level XML files which # get included by the document XML files in the subdirectories. diff --git a/doc/generated/builders.gen b/doc/generated/builders.gen index 3d534b07..259fe790 100644 --- a/doc/generated/builders.gen +++ b/doc/generated/builders.gen @@ -832,161 +832,105 @@ Compile files for languages defined in <filename>LINGUAS</filename> file <term> <function>env.MSVSProject()</function> </term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -Builds a Microsoft Visual Studio project file, -and by default builds a solution file as well. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -This builds a Visual Studio project file, based on the version of -Visual Studio that is configured (either the latest installed version, -or the version specified by -<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVS_VERSION"><envar>$MSVS_VERSION</envar></link> -in the Environment constructor). -For Visual Studio 6, it will generate a -<filename>.dsp</filename> -file. -For Visual Studio 7 (.NET) and later versions, it will generate a -<filename>.vcproj</filename> -file. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -By default, -this also generates a solution file -for the specified project, -a -<filename>.dsw</filename> -file for Visual Studio 6 -or a -<filename>.sln</filename> -file for Visual Studio 7 (.NET). -This behavior may be disabled by specifying -<literal>auto_build_solution=0</literal> -when you call -<function xmlns="http://www.scons.org/dbxsd/v1.0">MSVSProject</function>, -in which case you presumably want to -build the solution file(s) -by calling the -<function xmlns="http://www.scons.org/dbxsd/v1.0">MSVSSolution</function> -Builder (see below). -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The <function xmlns="http://www.scons.org/dbxsd/v1.0">MSVSProject</function> builder -takes several lists of filenames -to be placed into the project file. -These are currently limited to -<literal>srcs</literal>, -<literal>incs</literal>, -<literal>localincs</literal>, -<literal>resources</literal>, -and -<literal>misc</literal>. -These are pretty self-explanatory, but it should be noted that these -lists are added to the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-SOURCES"><envar>$SOURCES</envar></link> construction variable as strings, -NOT as SCons File Nodes. This is because they represent file -names to be added to the project file, not the source files used to -build the project file. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The above filename lists are all optional, -although at least one must be specified -for the resulting project file to be non-empty. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -In addition to the above lists of values, -the following values may be specified: -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -<literal>target</literal>: -The name of the target -<filename>.dsp</filename> -or -<filename>.vcproj</filename> -file. -The correct -suffix for the version of Visual Studio must be used, -but the -<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVSPROJECTSUFFIX"><envar>$MSVSPROJECTSUFFIX</envar></link> -construction variable -will be defined to the correct value (see example below). -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -<literal>variant</literal>: -The name of this particular variant. -For Visual Studio 7 projects, -this can also be a list of variant names. -These are typically things like "Debug" or "Release", but really -can be anything you want. -For Visual Studio 7 projects, -they may also specify a target platform -separated from the variant name by a -<literal>|</literal> -(vertical pipe) -character: -<literal>Debug|Xbox</literal>. -The default target platform is Win32. -Multiple calls to -<function xmlns="http://www.scons.org/dbxsd/v1.0">MSVSProject</function> -with different variants are allowed; -all variants will be added to the project file with their appropriate -build targets and sources. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -<literal>buildtarget</literal>: -An optional string, node, or list of strings or nodes -(one per build variant), to tell the Visual Studio debugger -what output target to use in what build variant. -The number of -<literal>buildtarget</literal> -entries must match the number of -<literal>variant</literal> -entries. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -<literal>runfile</literal>: -The name of the file that Visual Studio 7 and later -will run and debug. -This appears as the value of the -<literal>Output</literal> -field in the resutling Visual Studio project file. -If this is not specified, -the default is the same as the specified -<literal>buildtarget</literal> -value. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -Note that because <application xmlns="http://www.scons.org/dbxsd/v1.0">SCons</application> always executes its build commands -from the directory in which the <filename xmlns="http://www.scons.org/dbxsd/v1.0">SConstruct</filename> file is located, -if you generate a project file in a different directory -than the <filename xmlns="http://www.scons.org/dbxsd/v1.0">SConstruct</filename> directory, -users will not be able to double-click -on the file name in compilation error messages -displayed in the Visual Studio console output window. -This can be remedied by adding the -Visual C/C++ -<literal>/FC</literal> -compiler option to the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-CCFLAGS"><envar>$CCFLAGS</envar></link> variable -so that the compiler will print -the full path name of any -files that cause compilation errors. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -Example usage: -</para> - -<example_commands xmlns="http://www.scons.org/dbxsd/v1.0"> -barsrcs = ['bar.cpp'], + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0"> Builds a Microsoft Visual Studio project +file, and by default builds a solution file as well. </para> <para xmlns="http://www.scons.org/dbxsd/v1.0"> This +builds a Visual Studio project file, based on the version of Visual Studio +that is configured (either the latest installed version, or the version +specified by <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVS_VERSION"><envar>$MSVS_VERSION</envar></link> in the Environment constructor). For +Visual Studio 6, it will generate a <filename>.dsp</filename> file. For Visual +Studio 7 (.NET) and later versions, it will generate a +<filename>.vcproj</filename> file. </para> <para xmlns="http://www.scons.org/dbxsd/v1.0"> By default, this also +generates a solution file for the specified project, a +<filename>.dsw</filename> file for Visual Studio 6 or a +<filename>.sln</filename> file for Visual Studio 7 (.NET). This behavior may +be disabled by specifying <literal>auto_build_solution=0</literal> when you +call <function xmlns="http://www.scons.org/dbxsd/v1.0">MSVSProject</function>, in which case you presumably want to build the solution +file(s) by calling the <function xmlns="http://www.scons.org/dbxsd/v1.0">MSVSSolution</function> Builder (see below). </para> <para xmlns="http://www.scons.org/dbxsd/v1.0"> +The <function xmlns="http://www.scons.org/dbxsd/v1.0">MSVSProject</function> builder takes several lists of filenames to be placed into +the project file. These are currently limited to <literal>srcs</literal>, +<literal>incs</literal>, <literal>localincs</literal>, +<literal>resources</literal>, and <literal>misc</literal>. These are pretty +self-explanatory, but it should be noted that these lists are added to the +<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-SOURCES"><envar>$SOURCES</envar></link> construction variable as strings, NOT as SCons File Nodes. +This is because they represent file names to be added to the project file, not +the source files used to build the project file. </para> <para xmlns="http://www.scons.org/dbxsd/v1.0"> The above +filename lists are all optional, although at least one must be specified for +the resulting project file to be non-empty. </para> <para xmlns="http://www.scons.org/dbxsd/v1.0"> In addition to the +above lists of values, the following values may be specified: +</para><variablelist xmlns="http://www.scons.org/dbxsd/v1.0"> + <varlistentry> + <term>target</term> + + <listitem> + <para>The name of the target <filename>.dsp</filename> or + <filename>.vcproj</filename> file. The correct suffix for the version + of Visual Studio must be used, but the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVSPROJECTSUFFIX"><envar>$MSVSPROJECTSUFFIX</envar></link> + construction variable will be defined to the correct value (see + example below).</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>variant</term> + + <listitem> + <para>The name of this particular variant. For Visual Studio 7 + projects, this can also be a list of variant names. These are + typically things like "Debug" or "Release", but really can be anything + you want. For Visual Studio 7 projects, they may also specify a target + platform separated from the variant name by a <literal>|</literal> + (vertical pipe) character: <literal>Debug|Xbox</literal>. The default + target platform is Win32. Multiple calls to <function xmlns="http://www.scons.org/dbxsd/v1.0">MSVSProject</function> with + different variants are allowed; all variants will be added to the + project file with their appropriate build targets and + sources.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>cmdargs</term> + + <listitem> + <para>Additional command line arguments for the different + variants. The number of <literal>cmdargs</literal> entries must match + the number of <literal>variant</literal> entries, or be empty (not + specified). If you give only one, it will automatically be propagated + to all variants.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>buildtarget</term> + + <listitem> + <para>An optional string, node, or list of strings or nodes (one + per build variant), to tell the Visual Studio debugger what output + target to use in what build variant. The number of + <literal>buildtarget</literal> entries must match the number of + <literal>variant</literal> entries.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>runfile</term> + + <listitem> + <para>The name of the file that Visual Studio 7 and later will + run and debug. This appears as the value of the + <literal>Output</literal> field in the resulting Visual Studio project + file. If this is not specified, the default is the same as the + specified <literal>buildtarget</literal> value.</para> + </listitem> + </varlistentry> + </variablelist><para xmlns="http://www.scons.org/dbxsd/v1.0"> Note that because <application xmlns="http://www.scons.org/dbxsd/v1.0">SCons</application> always executes its build +commands from the directory in which the <filename xmlns="http://www.scons.org/dbxsd/v1.0">SConstruct</filename> file is located, if you +generate a project file in a different directory than the <filename xmlns="http://www.scons.org/dbxsd/v1.0">SConstruct</filename> +directory, users will not be able to double-click on the file name in +compilation error messages displayed in the Visual Studio console output +window. This can be remedied by adding the Visual C/C++ <literal>/FC</literal> +compiler option to the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-CCFLAGS"><envar>$CCFLAGS</envar></link> variable so that the compiler will +print the full path name of any files that cause compilation errors. </para> +<para xmlns="http://www.scons.org/dbxsd/v1.0"> Example usage: </para> <example_commands xmlns="http://www.scons.org/dbxsd/v1.0">barsrcs = ['bar.cpp'], barincs = ['bar.h'], barlocalincs = ['StdAfx.h'] barresources = ['bar.rc','resource.h'] @@ -1004,7 +948,143 @@ env.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'], buildtarget = dll, variant = 'Release') </example_commands> -</listitem> +<para xmlns="http://www.scons.org/dbxsd/v1.0">Starting with version 2.4 of +SCons it's also possible to specify the optional argument +<parameter>DebugSettings</parameter>, which creates files for debugging under +Visual Studio:</para><variablelist xmlns="http://www.scons.org/dbxsd/v1.0"> + <varlistentry> + <term>DebugSettings</term> + + <listitem> + <para>A dictionary of debug settings that get written to the + <filename>.vcproj.user</filename> or the + <filename>.vcxproj.user</filename> file, depending on the version + installed. As it is done for cmdargs (see above), you can specify a + <parameter>DebugSettings</parameter> dictionary per variant. If you + give only one, it will be propagated to all variants.</para> + </listitem> + </varlistentry> + </variablelist><para xmlns="http://www.scons.org/dbxsd/v1.0">Currently, only Visual Studio v9.0 and Visual Studio +version v11 are implemented, for other versions no file is generated. To +generate the user file, you just need to add a +<parameter>DebugSettings</parameter> dictionary to the environment with the +right parameters for your MSVS version. If the dictionary is empty, or does +not contain any good value, no file will be generated.</para><para xmlns="http://www.scons.org/dbxsd/v1.0">Following +is a more contrived example, involving the setup of a project for variants and +DebugSettings:</para><example_commands xmlns="http://www.scons.org/dbxsd/v1.0"># Assuming you store your defaults in a file +vars = Variables('variables.py') +msvcver = vars.args.get('vc', '9') + +# Check command args to force one Microsoft Visual Studio version +if msvcver == '9' or msvcver == '11': + env = Environment(MSVC_VERSION=msvcver+'.0', MSVC_BATCH=False) +else: + env = Environment() + +AddOption('--userfile', action='store_true', dest='userfile', default=False, + help="Create Visual Studio Project user file") + +# +# 1. Configure your Debug Setting dictionary with options you want in the list +# of allowed options, for instance if you want to create a user file to launch +# a specific application for testing your dll with Microsoft Visual Studio 2008 (v9): +# +V9DebugSettings = { + 'Command':'c:\\myapp\\using\\thisdll.exe', + 'WorkingDirectory': 'c:\\myapp\\using\\', + 'CommandArguments': '-p password', +# 'Attach':'false', +# 'DebuggerType':'3', +# 'Remote':'1', +# 'RemoteMachine': None, +# 'RemoteCommand': None, +# 'HttpUrl': None, +# 'PDBPath': None, +# 'SQLDebugging': None, +# 'Environment': '', +# 'EnvironmentMerge':'true', +# 'DebuggerFlavor': None, +# 'MPIRunCommand': None, +# 'MPIRunArguments': None, +# 'MPIRunWorkingDirectory': None, +# 'ApplicationCommand': None, +# 'ApplicationArguments': None, +# 'ShimCommand': None, +# 'MPIAcceptMode': None, +# 'MPIAcceptFilter': None, +} + +# +# 2. Because there are a lot of different options depending on the Microsoft +# Visual Studio version, if you use more than one version you have to +# define a dictionary per version, for instance if you want to create a user +# file to launch a specific application for testing your dll with Microsoft +# Visual Studio 2012 (v11): +# +V10DebugSettings = { + 'LocalDebuggerCommand': 'c:\\myapp\\using\\thisdll.exe', + 'LocalDebuggerWorkingDirectory': 'c:\\myapp\\using\\', + 'LocalDebuggerCommandArguments': '-p password', +# 'LocalDebuggerEnvironment': None, +# 'DebuggerFlavor': 'WindowsLocalDebugger', +# 'LocalDebuggerAttach': None, +# 'LocalDebuggerDebuggerType': None, +# 'LocalDebuggerMergeEnvironment': None, +# 'LocalDebuggerSQLDebugging': None, +# 'RemoteDebuggerCommand': None, +# 'RemoteDebuggerCommandArguments': None, +# 'RemoteDebuggerWorkingDirectory': None, +# 'RemoteDebuggerServerName': None, +# 'RemoteDebuggerConnection': None, +# 'RemoteDebuggerDebuggerType': None, +# 'RemoteDebuggerAttach': None, +# 'RemoteDebuggerSQLDebugging': None, +# 'DeploymentDirectory': None, +# 'AdditionalFiles': None, +# 'RemoteDebuggerDeployDebugCppRuntime': None, +# 'WebBrowserDebuggerHttpUrl': None, +# 'WebBrowserDebuggerDebuggerType': None, +# 'WebServiceDebuggerHttpUrl': None, +# 'WebServiceDebuggerDebuggerType': None, +# 'WebServiceDebuggerSQLDebugging': None, +} + +# +# 3. Select the dictionary you want depending on the version of visual Studio +# Files you want to generate. +# +if not env.GetOption('userfile'): + dbgSettings = None +elif env.get('MSVC_VERSION', None) == '9.0': + dbgSettings = V9DebugSettings +elif env.get('MSVC_VERSION', None) == '11.0': + dbgSettings = V10DebugSettings +else: + dbgSettings = None + +# +# 4. Add the dictionary to the DebugSettings keyword. +# +barsrcs = ['bar.cpp', 'dllmain.cpp', 'stdafx.cpp'] +barincs = ['targetver.h'] +barlocalincs = ['StdAfx.h'] +barresources = ['bar.rc','resource.h'] +barmisc = ['ReadMe.txt'] + +dll = env.SharedLibrary(target = 'bar.dll', + source = barsrcs) + +env.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'], + srcs = barsrcs, + incs = barincs, + localincs = barlocalincs, + resources = barresources, + misc = barmisc, + buildtarget = [dll[0]] * 2, + variant = ('Debug|Win32', 'Release|Win32'), + cmdargs = 'vc=%s' % msvcver, + DebugSettings = (dbgSettings, {})) +</example_commands> </listitem> </varlistentry> <varlistentry id="b-MSVSSolution"> <term> @@ -1013,70 +1093,54 @@ env.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'], <term> <function>env.MSVSSolution()</function> </term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -Builds a Microsoft Visual Studio solution file. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -This builds a Visual Studio solution file, -based on the version of Visual Studio that is configured -(either the latest installed version, -or the version specified by -<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVS_VERSION"><envar>$MSVS_VERSION</envar></link> -in the construction environment). -For Visual Studio 6, it will generate a -<filename>.dsw</filename> -file. -For Visual Studio 7 (.NET), it will -generate a -<filename>.sln</filename> -file. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The following values must be specified: -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -<literal>target</literal>: -The name of the target .dsw or .sln file. The correct -suffix for the version of Visual Studio must be used, but the value -<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVSSOLUTIONSUFFIX"><envar>$MSVSSOLUTIONSUFFIX</envar></link> -will be defined to the correct value (see example below). -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -<literal>variant</literal>: -The name of this particular variant, or a list of variant -names (the latter is only supported for MSVS 7 solutions). These are -typically things like "Debug" or "Release", but really can be anything -you want. For MSVS 7 they may also specify target platform, like this -"Debug|Xbox". Default platform is Win32. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -<literal>projects</literal>: -A list of project file names, or Project nodes returned by calls to the -<function xmlns="http://www.scons.org/dbxsd/v1.0">MSVSProject</function> -Builder, -to be placed into the solution file. -It should be noted that these file names are NOT added to the $SOURCES -environment variable in form of files, but rather as strings. This -is because they represent file names to be added to the solution file, -not the source files used to build the solution file. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -Example Usage: -</para> - -<example_commands xmlns="http://www.scons.org/dbxsd/v1.0"> -env.MSVSSolution(target = 'Bar' + env['MSVSSOLUTIONSUFFIX'], - projects = ['bar' + env['MSVSPROJECTSUFFIX']], - variant = 'Release') -</example_commands> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">Builds a Microsoft Visual Studio solution +file. </para> <para xmlns="http://www.scons.org/dbxsd/v1.0">This builds a Visual Studio solution file, based on the +version of Visual Studio that is configured (either the latest installed +version, or the version specified by <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVS_VERSION"><envar>$MSVS_VERSION</envar></link> in the +construction environment). For Visual Studio 6, it will generate a +<filename>.dsw</filename> file. For Visual Studio 7 (.NET), it will generate a +<filename>.sln</filename> file. </para> <para xmlns="http://www.scons.org/dbxsd/v1.0"> The following values must be +specified: </para><variablelist xmlns="http://www.scons.org/dbxsd/v1.0"> + <varlistentry> + <term>target</term> + + <listitem> + <para>The name of the target .dsw or .sln file. The correct + suffix for the version of Visual Studio must be used, but the value + <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVSSOLUTIONSUFFIX"><envar>$MSVSSOLUTIONSUFFIX</envar></link> will be defined to the correct value (see + example below).</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>variant</term> + + <listitem> + <para>The name of this particular variant, or a list of variant + names (the latter is only supported for MSVS 7 solutions). These are + typically things like "Debug" or "Release", but really can be anything + you want. For MSVS 7 they may also specify target platform, like this + "Debug|Xbox". Default platform is Win32.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>projects</term> + + <listitem> + <para>A list of project file names, or Project nodes returned by + calls to the <function xmlns="http://www.scons.org/dbxsd/v1.0">MSVSProject</function> Builder, to be placed into the solution + file. It should be noted that these file names are NOT added to the + $SOURCES environment variable in form of files, but rather as strings. + This is because they represent file names to be added to the solution + file, not the source files used to build the solution + file.</para> + </listitem> + </varlistentry> + </variablelist> <para xmlns="http://www.scons.org/dbxsd/v1.0"> Example Usage: </para> <example_commands xmlns="http://www.scons.org/dbxsd/v1.0"> +env.MSVSSolution(target = 'Bar' + env['MSVSSOLUTIONSUFFIX'], projects = ['bar' ++ env['MSVSPROJECTSUFFIX']], variant = 'Release') +</example_commands></listitem> </varlistentry> <varlistentry id="b-Object"> <term> diff --git a/doc/generated/tools.gen b/doc/generated/tools.gen index aea2aa62..db894759 100644 --- a/doc/generated/tools.gen +++ b/doc/generated/tools.gen @@ -744,11 +744,8 @@ Sets construction variables for the Microsoft Visual C/C++ compiler. </varlistentry> <varlistentry id="t-msvs"> <term>msvs</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -Sets construction variables for Microsoft Visual Studio. -</para> -<para>Sets: &cv-link-MSVSBUILDCOM;, &cv-link-MSVSCLEANCOM;, &cv-link-MSVSENCODING;, &cv-link-MSVSPROJECTCOM;, &cv-link-MSVSREBUILDCOM;, &cv-link-MSVSSCONS;, &cv-link-MSVSSCONSCOM;, &cv-link-MSVSSCONSCRIPT;, &cv-link-MSVSSCONSFLAGS;, &cv-link-MSVSSOLUTIONCOM;.</para></listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0"> +Sets construction variables for Microsoft Visual Studio. </para> <para>Sets: &cv-link-MSVSBUILDCOM;, &cv-link-MSVSCLEANCOM;, &cv-link-MSVSENCODING;, &cv-link-MSVSPROJECTCOM;, &cv-link-MSVSREBUILDCOM;, &cv-link-MSVSSCONS;, &cv-link-MSVSSCONSCOM;, &cv-link-MSVSSCONSCRIPT;, &cv-link-MSVSSCONSFLAGS;, &cv-link-MSVSSOLUTIONCOM;.</para></listitem> </varlistentry> <varlistentry id="t-mwcc"> <term>mwcc</term> diff --git a/doc/generated/variables.gen b/doc/generated/variables.gen index d0077582..120b4a3d 100644 --- a/doc/generated/variables.gen +++ b/doc/generated/variables.gen @@ -4156,355 +4156,254 @@ Versions ending in <literal>Exp</literal> refer to "Express" or </varlistentry> <varlistentry id="cv-MSVS"> <term>MSVS</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -When the Microsoft Visual Studio tools are initialized, they set up -this dictionary with the following keys: -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -<envar>VERSION</envar>: -the version of MSVS being used (can be set via -<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVS_VERSION"><envar>$MSVS_VERSION</envar></link>) -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -<envar>VERSIONS</envar>: -the available versions of MSVS installed -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -<envar>VCINSTALLDIR</envar>: -installed directory of Visual C++ -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -<envar>VSINSTALLDIR</envar>: -installed directory of Visual Studio -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -<envar>FRAMEWORKDIR</envar>: -installed directory of the .NET framework -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -<envar>FRAMEWORKVERSIONS</envar>: -list of installed versions of the .NET framework, sorted latest to oldest. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -<envar>FRAMEWORKVERSION</envar>: -latest installed version of the .NET framework -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -<envar>FRAMEWORKSDKDIR</envar>: -installed location of the .NET SDK. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -<envar>PLATFORMSDKDIR</envar>: -installed location of the Platform SDK. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -<envar>PLATFORMSDK_MODULES</envar>: -dictionary of installed Platform SDK modules, -where the dictionary keys are keywords for the various modules, and -the values are 2-tuples where the first is the release date, and the -second is the version number. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -If a value isn't set, it wasn't available in the registry. -</para> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0"> +When the Microsoft Visual Studio tools are initialized, they set up this +dictionary with the following keys: </para><variablelist xmlns="http://www.scons.org/dbxsd/v1.0"> + <varlistentry> + <term>VERSION</term> + + <listitem> + <para>the version of MSVS being used (can be set via + <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVS_VERSION"><envar>$MSVS_VERSION</envar></link>)</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>VERSIONS</term> + + <listitem> + <para>the available versions of MSVS installed</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>VCINSTALLDIR</term> + + <listitem> + <para>installed directory of Visual C++</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>VSINSTALLDIR</term> + + <listitem> + <para>installed directory of Visual Studio</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>FRAMEWORKDIR</term> + + <listitem> + <para>installed directory of the .NET framework</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>FRAMEWORKVERSIONS</term> + + <listitem> + <para>list of installed versions of the .NET framework, sorted + latest to oldest.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>FRAMEWORKVERSION</term> + + <listitem> + <para>latest installed version of the .NET + framework</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>FRAMEWORKSDKDIR</term> + + <listitem> + <para>installed location of the .NET SDK.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>PLATFORMSDKDIR</term> + + <listitem> + <para>installed location of the Platform SDK.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>PLATFORMSDK_MODULES</term> + + <listitem> + <para>dictionary of installed Platform SDK modules, where the + dictionary keys are keywords for the various modules, and the values + are 2-tuples where the first is the release date, and the second is + the version number.</para> + </listitem> + </varlistentry> + </variablelist><para xmlns="http://www.scons.org/dbxsd/v1.0">If a value isn't set, it wasn't available in the +registry.</para></listitem> </varlistentry> <varlistentry id="cv-MSVS_ARCH"> <term>MSVS_ARCH</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -Sets the architecture for which the generated project(s) should build. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The default value is <literal>x86</literal>. -<literal>amd64</literal> is also supported -by <application xmlns="http://www.scons.org/dbxsd/v1.0">SCons</application> for some Visual Studio versions. -Trying to set <envar xmlns="http://www.scons.org/dbxsd/v1.0">$MSVS_ARCH</envar> to an architecture that's not -supported for a given Visual Studio version -will generate an error. -</para> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">Sets +the architecture for which the generated project(s) should build. </para> +<para xmlns="http://www.scons.org/dbxsd/v1.0">The default value is <literal>x86</literal>. <literal>amd64</literal> is +also supported by <application xmlns="http://www.scons.org/dbxsd/v1.0">SCons</application> for some Visual Studio versions. Trying to set +<envar xmlns="http://www.scons.org/dbxsd/v1.0">$MSVS_ARCH</envar> to an architecture that's not supported for a given Visual +Studio version will generate an error. </para> </listitem> </varlistentry> <varlistentry id="cv-MSVS_PROJECT_GUID"> <term>MSVS_PROJECT_GUID</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The string -placed in a generated Microsoft Visual Studio project file -as the value of the -<literal>ProjectGUID</literal> -attribute. -There is no default value. If not defined, a new GUID is generated. -</para> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">The string placed in a generated +Microsoft Visual Studio project file as the value of the +<literal>ProjectGUID</literal> attribute. There is no default value. If not +defined, a new GUID is generated. </para> </listitem> </varlistentry> <varlistentry id="cv-MSVS_SCC_AUX_PATH"> <term>MSVS_SCC_AUX_PATH</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The path name -placed in a generated Microsoft Visual Studio project file -as the value of the -<literal>SccAuxPath</literal> -attribute -if the -<envar>MSVS_SCC_PROVIDER</envar> -construction variable is also set. -There is no default value. -</para> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">The path name placed in a generated +Microsoft Visual Studio project file as the value of the +<literal>SccAuxPath</literal> attribute if the +<envar>MSVS_SCC_PROVIDER</envar> construction variable is also set. There is +no default value. </para> </listitem> </varlistentry> <varlistentry id="cv-MSVS_SCC_CONNECTION_ROOT"> <term>MSVS_SCC_CONNECTION_ROOT</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The root path of projects in your SCC workspace, i.e the path under which -all project and solution files will be generated. It is used as a -reference path from which the relative paths of the generated -Microsoft Visual Studio project and solution files are computed. -The relative project file path is placed as the value of the -<literal>SccLocalPath</literal> -attribute -of the project file -and as the values of the -<literal>SccProjectFilePathRelativizedFromConnection[i]</literal> -(where [i] ranges from 0 to the number of projects in the solution) -attributes of the -<literal>GlobalSection(SourceCodeControl)</literal> -section of the Microsoft Visual Studio solution file. -Similarly the relative solution file path is placed as the values of the -<literal>SccLocalPath[i]</literal> -(where [i] ranges from 0 to the number of projects in the solution) -attributes of the -<literal>GlobalSection(SourceCodeControl)</literal> -section of the Microsoft Visual Studio solution file. -This is used only -if the -<envar>MSVS_SCC_PROVIDER</envar> -construction variable is also set. -The default value is the current working directory. -</para> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">The root path of projects in +your SCC workspace, i.e the path under which all project and solution files +will be generated. It is used as a reference path from which the relative +paths of the generated Microsoft Visual Studio project and solution files are +computed. The relative project file path is placed as the value of the +<literal>SccLocalPath</literal> attribute of the project file and as the +values of the +<literal>SccProjectFilePathRelativizedFromConnection[i]</literal> (where [i] +ranges from 0 to the number of projects in the solution) attributes of the +<literal>GlobalSection(SourceCodeControl)</literal> section of the Microsoft +Visual Studio solution file. Similarly the relative solution file path is +placed as the values of the <literal>SccLocalPath[i]</literal> (where [i] +ranges from 0 to the number of projects in the solution) attributes of the +<literal>GlobalSection(SourceCodeControl)</literal> section of the Microsoft +Visual Studio solution file. This is used only if the +<envar>MSVS_SCC_PROVIDER</envar> construction variable is also set. The +default value is the current working directory. </para> </listitem> </varlistentry> <varlistentry id="cv-MSVS_SCC_PROJECT_NAME"> <term>MSVS_SCC_PROJECT_NAME</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The project name -placed in a generated Microsoft Visual Studio project file -as the value of the -<literal>SccProjectName</literal> -attribute -if the -<envar>MSVS_SCC_PROVIDER</envar> -construction variable is also set. -In this case the string is also placed in the -<literal>SccProjectName0</literal> -attribute of the -<literal>GlobalSection(SourceCodeControl)</literal> -section of the Microsoft Visual Studio solution file. -There is no default value. -</para> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">The project name placed in +a generated Microsoft Visual Studio project file as the value of the +<literal>SccProjectName</literal> attribute if the +<envar>MSVS_SCC_PROVIDER</envar> construction variable is also set. In this +case the string is also placed in the <literal>SccProjectName0</literal> +attribute of the <literal>GlobalSection(SourceCodeControl)</literal> section +of the Microsoft Visual Studio solution file. There is no default value. +</para> </listitem> </varlistentry> <varlistentry id="cv-MSVS_SCC_PROVIDER"> <term>MSVS_SCC_PROVIDER</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The string -placed in a generated Microsoft Visual Studio project file -as the value of the -<literal>SccProvider</literal> -attribute. -The string is also placed in the -<literal>SccProvider0</literal> -attribute of the -<literal>GlobalSection(SourceCodeControl)</literal> -section of the Microsoft Visual Studio solution file. -There is no default value. -</para> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">The +string placed in a generated Microsoft Visual Studio project file as the value +of the <literal>SccProvider</literal> attribute. The string is also placed in +the <literal>SccProvider0</literal> attribute of the +<literal>GlobalSection(SourceCodeControl)</literal> section of the Microsoft +Visual Studio solution file. There is no default value. </para> </listitem> </varlistentry> <varlistentry id="cv-MSVS_VERSION"> <term>MSVS_VERSION</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -Sets the preferred version of Microsoft Visual Studio to use. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -If <envar xmlns="http://www.scons.org/dbxsd/v1.0">$MSVS_VERSION</envar> is not set, -<application xmlns="http://www.scons.org/dbxsd/v1.0">SCons</application> will (by default) select the latest version -of Visual Studio installed on your system. -So, if you have version 6 and version 7 (MSVS .NET) installed, -it will prefer version 7. -You can override this by -specifying the -<envar>MSVS_VERSION</envar> -variable in the Environment initialization, setting it to the -appropriate version ('6.0' or '7.0', for example). -If the specified version isn't installed, -tool initialization will fail. -</para> - -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -This is obsolete: use <envar xmlns="http://www.scons.org/dbxsd/v1.0">$MSVC_VERSION</envar> instead. If <envar xmlns="http://www.scons.org/dbxsd/v1.0">$MSVS_VERSION</envar> is set and -<envar xmlns="http://www.scons.org/dbxsd/v1.0">$MSVC_VERSION</envar> is not, <envar xmlns="http://www.scons.org/dbxsd/v1.0">$MSVC_VERSION</envar> will be set automatically to <envar xmlns="http://www.scons.org/dbxsd/v1.0">$MSVS_VERSION</envar>. -If both are set to different values, scons will raise an error. -</para> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">Sets the preferred version +of Microsoft Visual Studio to use. </para> <para xmlns="http://www.scons.org/dbxsd/v1.0">If <envar xmlns="http://www.scons.org/dbxsd/v1.0">$MSVS_VERSION</envar> is not +set, <application xmlns="http://www.scons.org/dbxsd/v1.0">SCons</application> will (by default) select the latest version of Visual Studio +installed on your system. So, if you have version 6 and version 7 (MSVS .NET) +installed, it will prefer version 7. You can override this by specifying the +<envar>MSVS_VERSION</envar> variable in the Environment initialization, +setting it to the appropriate version ('6.0' or '7.0', for example). If the +specified version isn't installed, tool initialization will fail. </para> +<para xmlns="http://www.scons.org/dbxsd/v1.0">This is obsolete: use <envar xmlns="http://www.scons.org/dbxsd/v1.0">$MSVC_VERSION</envar> instead. If <envar xmlns="http://www.scons.org/dbxsd/v1.0">$MSVS_VERSION</envar> is +set and <envar xmlns="http://www.scons.org/dbxsd/v1.0">$MSVC_VERSION</envar> is not, <envar xmlns="http://www.scons.org/dbxsd/v1.0">$MSVC_VERSION</envar> will be set automatically +to <envar xmlns="http://www.scons.org/dbxsd/v1.0">$MSVS_VERSION</envar>. If both are set to different values, scons will raise an +error. </para> </listitem> </varlistentry> <varlistentry id="cv-MSVSBUILDCOM"> <term>MSVSBUILDCOM</term> <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The build command line placed in -a generated Microsoft Visual Studio project file. -The default is to have Visual Studio invoke SCons with any specified -build targets. -</para> -</listitem> +<para xmlns="http://www.scons.org/dbxsd/v1.0">The build command line placed in a generated Microsoft Visual Studio +project file. The default is to have Visual Studio invoke SCons with any +specified build targets. </para> </listitem> </varlistentry> <varlistentry id="cv-MSVSCLEANCOM"> <term>MSVSCLEANCOM</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The clean command line placed in -a generated Microsoft Visual Studio project file. -The default is to have Visual Studio invoke SCons with the -c option -to remove any specified targets. -</para> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">The clean command line placed in a generated Microsoft Visual +Studio project file. The default is to have Visual Studio invoke SCons with +the -c option to remove any specified targets. </para> </listitem> </varlistentry> <varlistentry id="cv-MSVSENCODING"> <term>MSVSENCODING</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The encoding string placed in -a generated Microsoft Visual Studio project file. -The default is encoding -<literal>Windows-1252</literal>. -</para> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">The encoding string placed in a +generated Microsoft Visual Studio project file. The default is encoding +<literal>Windows-1252</literal>. </para> </listitem> </varlistentry> <varlistentry id="cv-MSVSPROJECTCOM"> <term>MSVSPROJECTCOM</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The action used to generate Microsoft Visual Studio project files. -</para> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">The action used to generate Microsoft +Visual Studio project files. </para> </listitem> </varlistentry> <varlistentry id="cv-MSVSPROJECTSUFFIX"> <term>MSVSPROJECTSUFFIX</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The suffix used for Microsoft Visual Studio project (DSP) files. -The default value is -<filename>.vcproj</filename> -when using Visual Studio version 7.x (.NET) -or later version, -and -<filename>.dsp</filename> -when using earlier versions of Visual Studio. -</para> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">The suffix used for Microsoft Visual +Studio project (DSP) files. The default value is <filename>.vcproj</filename> +when using Visual Studio version 7.x (.NET) or later version, and +<filename>.dsp</filename> when using earlier versions of Visual Studio. +</para> </listitem> </varlistentry> <varlistentry id="cv-MSVSREBUILDCOM"> <term>MSVSREBUILDCOM</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The rebuild command line placed in -a generated Microsoft Visual Studio project file. -The default is to have Visual Studio invoke SCons with any specified -rebuild targets. -</para> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">The +rebuild command line placed in a generated Microsoft Visual Studio project +file. The default is to have Visual Studio invoke SCons with any specified +rebuild targets. </para> </listitem> </varlistentry> <varlistentry id="cv-MSVSSCONS"> <term>MSVSSCONS</term> <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The SCons used in generated Microsoft Visual Studio project files. -The default is the version of SCons being -used to generate the project file. -</para> -</listitem> +<para xmlns="http://www.scons.org/dbxsd/v1.0">The SCons used in generated Microsoft Visual Studio project files. The +default is the version of SCons being used to generate the project file. +</para> </listitem> </varlistentry> <varlistentry id="cv-MSVSSCONSCOM"> <term>MSVSSCONSCOM</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The default SCons command used in generated Microsoft Visual Studio -project files. -</para> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">The default +SCons command used in generated Microsoft Visual Studio project files. </para> </listitem> </varlistentry> <varlistentry id="cv-MSVSSCONSCRIPT"> <term>MSVSSCONSCRIPT</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The sconscript file -(that is, -<filename xmlns="http://www.scons.org/dbxsd/v1.0">SConstruct</filename> -or -<filename xmlns="http://www.scons.org/dbxsd/v1.0">SConscript</filename> -file) -that will be invoked by Visual Studio -project files -(through the -<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVSSCONSCOM"><envar>$MSVSSCONSCOM</envar></link> -variable). -The default is the same sconscript file -that contains the call to -<function xmlns="http://www.scons.org/dbxsd/v1.0">MSVSProject</function> -to build the project file. -</para> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">The sconscript +file (that is, <filename xmlns="http://www.scons.org/dbxsd/v1.0">SConstruct</filename> or <filename xmlns="http://www.scons.org/dbxsd/v1.0">SConscript</filename> file) that will be invoked by +Visual Studio project files (through the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVSSCONSCOM"><envar>$MSVSSCONSCOM</envar></link> variable). The +default is the same sconscript file that contains the call to <function xmlns="http://www.scons.org/dbxsd/v1.0">MSVSProject</function> +to build the project file. </para> </listitem> </varlistentry> <varlistentry id="cv-MSVSSCONSFLAGS"> <term>MSVSSCONSFLAGS</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The SCons flags used in generated Microsoft Visual Studio -project files. -</para> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">The +SCons flags used in generated Microsoft Visual Studio project files. </para> </listitem> </varlistentry> <varlistentry id="cv-MSVSSOLUTIONCOM"> <term>MSVSSOLUTIONCOM</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The action used to generate Microsoft Visual Studio solution files. -</para> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">The action used to generate Microsoft +Visual Studio solution files. </para> </listitem> </varlistentry> <varlistentry id="cv-MSVSSOLUTIONSUFFIX"> <term>MSVSSOLUTIONSUFFIX</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The suffix used for Microsoft Visual Studio solution (DSW) files. -The default value is -<filename>.sln</filename> -when using Visual Studio version 7.x (.NET), -and -<filename>.dsw</filename> -when using earlier versions of Visual Studio. -</para> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">The suffix used for Microsoft +Visual Studio solution (DSW) files. The default value is +<filename>.sln</filename> when using Visual Studio version 7.x (.NET), and +<filename>.dsw</filename> when using earlier versions of Visual Studio. +</para> </listitem> </varlistentry> <varlistentry id="cv-MT"> <term>MT</term> @@ -5850,17 +5749,11 @@ to check out editable files from SCCS. </varlistentry> <varlistentry id="cv-SCONS_HOME"> <term>SCONS_HOME</term> - <listitem> -<para xmlns="http://www.scons.org/dbxsd/v1.0"> -The (optional) path to the SCons library directory, -initialized from the external environment. -If set, this is used to construct a shorter and more -efficient search path in the -<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVSSCONS"><envar>$MSVSSCONS</envar></link> -command line executed -from Microsoft Visual Studio project files. -</para> -</listitem> + <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">The +(optional) path to the SCons library directory, initialized from the external +environment. If set, this is used to construct a shorter and more efficient +search path in the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVSSCONS"><envar>$MSVSSCONS</envar></link> command line executed from Microsoft +Visual Studio project files. </para> </listitem> </varlistentry> <varlistentry id="cv-SHCC"> <term>SHCC</term> diff --git a/doc/man/scons-time.xml b/doc/man/scons-time.xml index a1ecadf7..e0fa6b17 100644 --- a/doc/man/scons-time.xml +++ b/doc/man/scons-time.xml @@ -32,7 +32,8 @@ <refmeta> <refentrytitle>SCONS-TIME</refentrytitle> <manvolnum>1</manvolnum> -<refmiscinfo class='source'>__MONTH_YEAR__</refmiscinfo> +<refmiscinfo class='source'>SCons __VERSION__</refmiscinfo> +<refmiscinfo class='manual'>SCons __VERSION__</refmiscinfo> </refmeta> <refnamediv id='name'> <refname>scons-time</refname> diff --git a/doc/man/scons.xml b/doc/man/scons.xml index 55f2d634..08a942b9 100644 --- a/doc/man/scons.xml +++ b/doc/man/scons.xml @@ -75,7 +75,8 @@ <refmeta> <refentrytitle>SCONS</refentrytitle> <manvolnum>1</manvolnum> -<refmiscinfo class='source'>__MONTH_YEAR__</refmiscinfo> +<refmiscinfo class='source'>SCons __VERSION__</refmiscinfo> +<refmiscinfo class='manual'>SCons __VERSION__</refmiscinfo> </refmeta> <refnamediv id='name'> <refname>scons</refname> diff --git a/doc/man/sconsign.xml b/doc/man/sconsign.xml index ca99db6c..44a1e5f1 100644 --- a/doc/man/sconsign.xml +++ b/doc/man/sconsign.xml @@ -32,7 +32,8 @@ <refmeta> <refentrytitle>SCONSIGN</refentrytitle> <manvolnum>1</manvolnum> -<refmiscinfo class='source'>__MONTH_YEAR__</refmiscinfo> +<refmiscinfo class='source'>SCons __VERSION__</refmiscinfo> +<refmiscinfo class='manual'>SCons __VERSION__</refmiscinfo> </refmeta> <refnamediv id='name'> <refname>sconsign</refname> diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index 1c746be1..eecea11b 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -99,8 +99,6 @@ way for wrapping up the functions. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import SCons.compat - import dis import os # compat layer imports "cPickle" for us if it's available. @@ -112,7 +110,6 @@ import subprocess import SCons.Debug from SCons.Debug import logInstanceCreation import SCons.Errors -import SCons.Executor import SCons.Util import SCons.Subst @@ -357,21 +354,6 @@ def _do_create_action(act, kw): if isinstance(act, ActionBase): return act - if is_List(act): - return CommandAction(act, **kw) - - if callable(act): - try: - gen = kw['generator'] - del kw['generator'] - except KeyError: - gen = 0 - if gen: - action_type = CommandGeneratorAction - else: - action_type = FunctionAction - return action_type(act, kw) - if is_String(act): var=SCons.Util.get_environment_var(act) if var: @@ -388,6 +370,22 @@ def _do_create_action(act, kw): # The list of string commands may include a LazyAction, so we # reprocess them via _do_create_list_action. return _do_create_list_action(commands, kw) + + if is_List(act): + return CommandAction(act, **kw) + + if callable(act): + try: + gen = kw['generator'] + del kw['generator'] + except KeyError: + gen = 0 + if gen: + action_type = CommandGeneratorAction + else: + action_type = FunctionAction + return action_type(act, kw) + # Catch a common error case with a nice message: if isinstance(act, int) or isinstance(act, float): raise TypeError("Don't know how to create an Action from a number (%s)"%act) diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py index b46347df..e069d51d 100644 --- a/src/engine/SCons/ActionTests.py +++ b/src/engine/SCons/ActionTests.py @@ -23,8 +23,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import SCons.compat - # Define a null function and a null class for use as builder actions. # Where these are defined in the file seems to affect their byte-code # contents, so try to minimize changes by defining them here, before we diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py index ed7650a8..c82f6ac6 100644 --- a/src/engine/SCons/Builder.py +++ b/src/engine/SCons/Builder.py @@ -107,8 +107,6 @@ from SCons.Debug import logInstanceCreation from SCons.Errors import InternalError, UserError import SCons.Executor import SCons.Memoize -import SCons.Node -import SCons.Node.FS import SCons.Util import SCons.Warnings @@ -862,7 +860,7 @@ class CompositeBuilder(SCons.Util.Proxy): self.set_src_suffix(self.cmdgen.src_suffixes()) def is_a_Builder(obj): - """"Returns True iff the specified obj is one of our Builder classes. + """"Returns True if the specified obj is one of our Builder classes. The test is complicated a bit by the fact that CompositeBuilder is a proxy, not a subclass of BuilderBase. diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index 3f60bc0f..65004438 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -198,11 +198,10 @@ def copy_func(dest, src, symlinks=True): shutil.copy2(file, dest) return 0 elif os.path.islink(src): - linkto = os.readlink(src) if symlinks: - return os.symlink(linkto, dest) + return os.symlink(os.readlink(src), dest) else: - return copy_func(dest, linkto, symlinks) + return copy_func(dest, os.path.realpath(src)) elif os.path.isfile(src): return shutil.copy2(src, dest) else: diff --git a/src/engine/SCons/Executor.py b/src/engine/SCons/Executor.py index 051d275f..388f8acb 100644 --- a/src/engine/SCons/Executor.py +++ b/src/engine/SCons/Executor.py @@ -554,19 +554,20 @@ def AddBatchExecutor(key, executor): nullenv = None +import SCons.Util +class NullEnvironment(SCons.Util.Null): + import SCons.CacheDir + _CacheDir_path = None + _CacheDir = SCons.CacheDir.CacheDir(None) + def get_CacheDir(self): + return self._CacheDir + + def get_NullEnvironment(): """Use singleton pattern for Null Environments.""" global nullenv - import SCons.Util - class NullEnvironment(SCons.Util.Null): - import SCons.CacheDir - _CacheDir_path = None - _CacheDir = SCons.CacheDir.CacheDir(None) - def get_CacheDir(self): - return self._CacheDir - - if not nullenv: + if nullenv is None: nullenv = NullEnvironment() return nullenv diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index e73dd924..4db1cb33 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -2230,17 +2230,7 @@ class RootDir(Dir): raise SCons.Errors.UserError(msg) # There is no Node for this path name, and we're allowed # to create it. - # (note: would like to use p.rsplit('/',1) here but - # that's not in python 2.3) - # e.g.: dir_name, file_name = p.rsplit('/',1) - last_slash = p.rindex('/') - if (last_slash >= 0): - dir_name = p[:last_slash] - file_name = p[last_slash+1:] - else: - dir_name = p # shouldn't happen, just in case - file_name = '' - + dir_name, file_name = p.rsplit('/',1) dir_node = self._lookup_abs(dir_name, Dir) result = klass(file_name, dir_node, self.fs) diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py index d6a70ec0..87432eff 100644 --- a/src/engine/SCons/SConf.py +++ b/src/engine/SCons/SConf.py @@ -197,10 +197,8 @@ class Streamer(object): try: self.s.write(str) except TypeError as e: - if e.message.startswith('unicode argument expected'): - self.s.write(str.decode()) - else: - raise + # "unicode argument expected" bug in IOStream (python 2.x) + self.s.write(str.decode()) def writelines(self, lines): for l in lines: diff --git a/src/engine/SCons/Scanner/Prog.py b/src/engine/SCons/Scanner/Prog.py index 49e93a56..6567b3df 100644 --- a/src/engine/SCons/Scanner/Prog.py +++ b/src/engine/SCons/Scanner/Prog.py @@ -38,6 +38,24 @@ def ProgramScanner(**kw): ps = SCons.Scanner.Base(scan, "ProgramScanner", **kw) return ps +def _subst_libs(env, libs): + """ + Substitute environment variables and split into list. + """ + if SCons.Util.is_String(libs): + libs = env.subst(libs) + if SCons.Util.is_String(libs): + libs = libs.split() + elif SCons.Util.is_Sequence(libs): + _libs = [] + for l in libs: + _libs += _subst_libs(env, l) + libs = _libs + else: + # libs is an object (Node, for example) + libs = [libs] + return libs + def scan(node, env, libpath = ()): """ This scanner scans program files for static-library @@ -50,10 +68,8 @@ def scan(node, env, libpath = ()): except KeyError: # There are no LIBS in this environment, so just return a null list: return [] - if SCons.Util.is_String(libs): - libs = libs.split() - else: - libs = SCons.Util.flatten(libs) + + libs = _subst_libs(env, libs) try: prefix = env['LIBPREFIXES'] @@ -83,7 +99,6 @@ def scan(node, env, libpath = ()): adjustixes = SCons.Util.adjustixes for lib in libs: if SCons.Util.is_String(lib): - lib = env.subst(lib) for pref, suf in pairs: l = adjustixes(lib, pref, suf) l = find_file(l, libpath, verbose=print_find_libs) diff --git a/src/engine/SCons/Scanner/ProgTests.py b/src/engine/SCons/Scanner/ProgTests.py index 144addb1..ace3ff48 100644 --- a/src/engine/SCons/Scanner/ProgTests.py +++ b/src/engine/SCons/Scanner/ProgTests.py @@ -32,6 +32,7 @@ import TestUnit import SCons.Node.FS import SCons.Scanner.Prog +import SCons.Subst test = TestCmd.TestCmd(workdir = '') @@ -72,12 +73,7 @@ class DummyEnvironment(object): del self.Dictionary()[key] def subst(self, s, target=None, source=None, conv=None): - try: - if s[0] == '$': - return self._dict[s[1:]] - except IndexError: - return '' - return s + return SCons.Subst.scons_subst(s, self, gvars=self._dict, lvars=self._dict) def subst_path(self, path, target=None, source=None, conv=None): if not isinstance(path, list): @@ -223,6 +219,31 @@ class ProgramScannerTestCase8(unittest.TestCase): deps = s(DummyNode('dummy'), env, path) assert deps == [n1, n2], deps +class ProgramScannerTestCase9(unittest.TestCase): + def runTest(self): + env = DummyEnvironment(LIBPATH=[ test.workpath("dir") ], + LIBS=['foo', '$LIBBAR'], + LIBPREFIXES=['lib'], + LIBSUFFIXES=['.a'], + LIBBAR=['sub/libbar', 'xyz.other']) + s = SCons.Scanner.Prog.ProgramScanner() + path = s.path(env) + deps = s(DummyNode('dummy'), env, path) + assert deps_match(deps, ['dir/libfoo.a', 'dir/sub/libbar.a', 'dir/libxyz.other']), list(map(str, deps)) + +class ProgramScannerTestCase10(unittest.TestCase): + def runTest(self): + env = DummyEnvironment(LIBPATH=[ test.workpath("dir") ], + LIBS=['foo', '$LIBBAR'], + LIBPREFIXES=['lib'], + LIBSUFFIXES=['.a'], + LIBBAR='sub/libbar $LIBBAR2', + LIBBAR2=['xyz.other']) + s = SCons.Scanner.Prog.ProgramScanner() + path = s.path(env) + deps = s(DummyNode('dummy'), env, path) + assert deps_match(deps, ['dir/libfoo.a', 'dir/sub/libbar.a', 'dir/libxyz.other']), list(map(str, deps)) + def suite(): suite = unittest.TestSuite() suite.addTest(ProgramScannerTestCase1()) @@ -232,6 +253,8 @@ def suite(): suite.addTest(ProgramScannerTestCase6()) suite.addTest(ProgramScannerTestCase7()) suite.addTest(ProgramScannerTestCase8()) + suite.addTest(ProgramScannerTestCase9()) + suite.addTest(ProgramScannerTestCase10()) try: unicode except NameError: pass else: diff --git a/src/engine/SCons/Tool/MSCommon/sdk.py b/src/engine/SCons/Tool/MSCommon/sdk.py index 2bf5eef8..afb37fe4 100644 --- a/src/engine/SCons/Tool/MSCommon/sdk.py +++ b/src/engine/SCons/Tool/MSCommon/sdk.py @@ -19,7 +19,7 @@ # 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. -# + __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -172,6 +172,26 @@ SDK70VCSetupScripts = { 'x86' : r'bin\vcvars32.bat', # # If you update this list, update the documentation in Tool/mssdk.xml. SupportedSDKList = [ + WindowsSDK('7.1', + 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('7.0A', + 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('7.0', sanity_check_file=r'bin\SetEnv.Cmd', include_subdir='include', @@ -337,10 +357,13 @@ def mssdk_setup_env(env): elif 'MSSDK_VERSION' in env: sdk_version = env['MSSDK_VERSION'] if sdk_version is None: - msg = "SDK version %s is not installed" % repr(mssdk) + msg = "SDK version is specified as None" raise SCons.Errors.UserError(msg) sdk_version = env.subst(sdk_version) mssdk = get_sdk_by_version(sdk_version) + if mssdk is None: + msg = "SDK version %s is not installed" % sdk_version + raise SCons.Errors.UserError(msg) sdk_dir = mssdk.get_sdk_dir() debug('sdk.py:mssdk_setup_env: Using MSSDK_VERSION:%s'%sdk_dir) elif 'MSVS_VERSION' in env: diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py index 082d5c3a..a7d46c60 100644 --- a/src/engine/SCons/Tool/dmd.py +++ b/src/engine/SCons/Tool/dmd.py @@ -82,10 +82,10 @@ def generate(env): env['DC'] = env.Detect(['dmd', 'gdmd']) env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -of$TARGET $SOURCES' - env['_DINCFLAGS'] = '$( ${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' - env['_DVERFLAGS'] = '$( ${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)} $)' - env['_DDEBUGFLAGS'] = '$( ${_concat(DDEBUGPREFIX, DDEBUG, DDEBUGSUFFIX, __env__)} $)' - env['_DFLAGS'] = '$( ${_concat(DFLAGPREFIX, DFLAGS, DFLAGSUFFIX, __env__)} $)' + env['_DINCFLAGS'] = '${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)}' + env['_DVERFLAGS'] = '${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)}' + env['_DDEBUGFLAGS'] = '${_concat(DDEBUGPREFIX, DDEBUG, DDEBUGSUFFIX, __env__)}' + env['_DFLAGS'] = '${_concat(DFLAGPREFIX, DFLAGS, DFLAGSUFFIX, __env__)}' env['SHDC'] = '$DC' env['SHDCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -fPIC -of$TARGET $SOURCES' @@ -122,13 +122,13 @@ def generate(env): env['DLIBDIRPREFIX'] = '-L-L' env['DLIBDIRSUFFIX'] = '' - env['_DLIBDIRFLAGS'] = '$( ${_concat(DLIBDIRPREFIX, LIBPATH, DLIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['_DLIBDIRFLAGS'] = '${_concat(DLIBDIRPREFIX, LIBPATH, DLIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)}' env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr' env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {0}$TARGET $SOURCES $_DLIBFLAGS'.format('-c ' if env['PLATFORM'] == 'win32' else '') - #env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' + #env['_DLIBFLAGS'] = '${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)}' env['DLIBFLAGPREFIX'] = '-' env['DLIBFLAGSUFFIX'] = '' diff --git a/src/engine/SCons/Tool/gdc.py b/src/engine/SCons/Tool/gdc.py index 048d7360..799c3ab1 100644 --- a/src/engine/SCons/Tool/gdc.py +++ b/src/engine/SCons/Tool/gdc.py @@ -65,10 +65,10 @@ def generate(env): env['DC'] = env.Detect('gdc') env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -o $TARGET $SOURCES' - env['_DINCFLAGS'] = '$( ${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' - env['_DVERFLAGS'] = '$( ${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)} $)' - env['_DDEBUGFLAGS'] = '$( ${_concat(DDEBUGPREFIX, DDEBUG, DDEBUGSUFFIX, __env__)} $)' - env['_DFLAGS'] = '$( ${_concat(DFLAGPREFIX, DFLAGS, DFLAGSUFFIX, __env__)} $)' + env['_DINCFLAGS'] = '${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)}' + env['_DVERFLAGS'] = '${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)}' + env['_DDEBUGFLAGS'] = '${_concat(DDEBUGPREFIX, DDEBUG, DDEBUGSUFFIX, __env__)}' + env['_DFLAGS'] = '${_concat(DFLAGPREFIX, DFLAGS, DFLAGSUFFIX, __env__)}' env['SHDC'] = '$DC' env['SHDCOM'] = '$SHDC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -fPIC -c -o $TARGET $SOURCES' @@ -102,7 +102,7 @@ def generate(env): env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr' env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {0}$TARGET $SOURCES $_DLINKLIBFLAGS'.format('-c ' if env['PLATFORM'] == 'win32' else '') - env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' + env['_DLIBFLAGS'] = '${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)}' env['DLIBFLAGPREFIX'] = '-' env['DLIBFLAGSUFFIX'] = '' diff --git a/src/engine/SCons/Tool/ldc.py b/src/engine/SCons/Tool/ldc.py index ebef55d1..8f9b1175 100644 --- a/src/engine/SCons/Tool/ldc.py +++ b/src/engine/SCons/Tool/ldc.py @@ -70,10 +70,10 @@ def generate(env): env['DC'] = env.Detect('ldc2') env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -of=$TARGET $SOURCES' - env['_DINCFLAGS'] = '$( ${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' - env['_DVERFLAGS'] = '$( ${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)} $)' - env['_DDEBUGFLAGS'] = '$( ${_concat(DDEBUGPREFIX, DDEBUG, DDEBUGSUFFIX, __env__)} $)' - env['_DFLAGS'] = '$( ${_concat(DFLAGPREFIX, DFLAGS, DFLAGSUFFIX, __env__)} $)' + env['_DINCFLAGS'] = '${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)}' + env['_DVERFLAGS'] = '${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)}' + env['_DDEBUGFLAGS'] = '${_concat(DDEBUGPREFIX, DDEBUG, DDEBUGSUFFIX, __env__)}' + env['_DFLAGS'] = '${_concat(DFLAGPREFIX, DFLAGS, DFLAGSUFFIX, __env__)}' env['SHDC'] = '$DC' env['SHDCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -relocation-model=pic -of=$TARGET $SOURCES' @@ -109,18 +109,18 @@ def generate(env): env['DLIBLINKPREFIX'] = '' if env['PLATFORM'] == 'win32' else '-L-l' env['DLIBLINKSUFFIX'] = '.lib' if env['PLATFORM'] == 'win32' else '' - #env['_DLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + #env['_DLIBFLAGS'] = '${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)}' env['_DLIBFLAGS'] = '${_stripixes(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, LIBPREFIXES, LIBSUFFIXES, __env__)}' env['DLIBDIRPREFIX'] = '-L-L' env['DLIBDIRSUFFIX'] = '' - env['_DLIBDIRFLAGS'] = '$( ${_concat(DLIBDIRPREFIX, LIBPATH, DLIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['_DLIBDIRFLAGS'] = '${_concat(DLIBDIRPREFIX, LIBPATH, DLIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)}' env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr' env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {0}$TARGET $SOURCES $_DLIBFLAGS'.format('-c ' if env['PLATFORM'] == 'win32' else '') - #env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' + #env['_DLIBFLAGS'] = '${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)}' env['DLIBFLAGPREFIX'] = '-' env['DLIBFLAGSUFFIX'] = '' diff --git a/src/engine/SCons/Tool/msvs.xml b/src/engine/SCons/Tool/msvs.xml index 88a3346e..e85b27cd 100644 --- a/src/engine/SCons/Tool/msvs.xml +++ b/src/engine/SCons/Tool/msvs.xml @@ -5,202 +5,129 @@ __COPYRIGHT__ This file is processed by the bin/SConsDoc.py module. See its __doc__ string for a discussion of the format. --> - <!DOCTYPE sconsdoc [ -<!ENTITY % scons SYSTEM '../../../../doc/scons.mod'> +<!ENTITY % scons SYSTEM "../../../../doc/scons.mod"> %scons; -<!ENTITY % builders-mod SYSTEM '../../../../doc/generated/builders.mod'> +<!ENTITY % builders-mod SYSTEM "../../../../doc/generated/builders.mod"> %builders-mod; -<!ENTITY % functions-mod SYSTEM '../../../../doc/generated/functions.mod'> +<!ENTITY % functions-mod SYSTEM "../../../../doc/generated/functions.mod"> %functions-mod; -<!ENTITY % tools-mod SYSTEM '../../../../doc/generated/tools.mod'> +<!ENTITY % tools-mod SYSTEM "../../../../doc/generated/tools.mod"> %tools-mod; -<!ENTITY % variables-mod SYSTEM '../../../../doc/generated/variables.mod'> +<!ENTITY % variables-mod SYSTEM "../../../../doc/generated/variables.mod"> %variables-mod; ]> - -<sconsdoc xmlns="http://www.scons.org/dbxsd/v1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0 http://www.scons.org/dbxsd/v1.0/scons.xsd"> - -<tool name="msvs"> -<summary> -<para> -Sets construction variables for Microsoft Visual Studio. -</para> -</summary> -<sets> -<item>MSVSPROJECTCOM</item> -<item>MSVSSOLUTIONCOM</item> -<item>MSVSSCONSCRIPT</item> -<item>MSVSSCONS</item> -<item>MSVSSCONSFLAGS</item> -<item>MSVSSCONSCOM</item> -<item>MSVSBUILDCOM</item> -<item>MSVSREBUILDCOM</item> -<item>MSVSCLEANCOM</item> -<item>MSVSENCODING</item> -</sets> -<uses> -</uses> -</tool> - -<builder name ="MSVSProject"> -<summary> -<para> -Builds a Microsoft Visual Studio project file, -and by default builds a solution file as well. -</para> - -<para> -This builds a Visual Studio project file, based on the version of -Visual Studio that is configured (either the latest installed version, -or the version specified by -&cv-link-MSVS_VERSION; -in the Environment constructor). -For Visual Studio 6, it will generate a -<filename>.dsp</filename> -file. -For Visual Studio 7 (.NET) and later versions, it will generate a -<filename>.vcproj</filename> -file. -</para> - -<para> -By default, -this also generates a solution file -for the specified project, -a -<filename>.dsw</filename> -file for Visual Studio 6 -or a -<filename>.sln</filename> -file for Visual Studio 7 (.NET). -This behavior may be disabled by specifying -<literal>auto_build_solution=0</literal> -when you call -&b-MSVSProject;, -in which case you presumably want to -build the solution file(s) -by calling the -&b-MSVSSolution; -Builder (see below). -</para> - -<para> -The &b-MSVSProject; builder -takes several lists of filenames -to be placed into the project file. -These are currently limited to -<literal>srcs</literal>, -<literal>incs</literal>, -<literal>localincs</literal>, -<literal>resources</literal>, -and -<literal>misc</literal>. -These are pretty self-explanatory, but it should be noted that these -lists are added to the &cv-link-SOURCES; construction variable as strings, -NOT as SCons File Nodes. This is because they represent file -names to be added to the project file, not the source files used to -build the project file. -</para> - -<para> -The above filename lists are all optional, -although at least one must be specified -for the resulting project file to be non-empty. -</para> - -<para> -In addition to the above lists of values, -the following values may be specified: -</para> - -<para> -<literal>target</literal>: -The name of the target -<filename>.dsp</filename> -or -<filename>.vcproj</filename> -file. -The correct -suffix for the version of Visual Studio must be used, -but the -&cv-link-MSVSPROJECTSUFFIX; -construction variable -will be defined to the correct value (see example below). -</para> - -<para> -<literal>variant</literal>: -The name of this particular variant. -For Visual Studio 7 projects, -this can also be a list of variant names. -These are typically things like "Debug" or "Release", but really -can be anything you want. -For Visual Studio 7 projects, -they may also specify a target platform -separated from the variant name by a -<literal>|</literal> -(vertical pipe) -character: -<literal>Debug|Xbox</literal>. -The default target platform is Win32. -Multiple calls to -&b-MSVSProject; -with different variants are allowed; -all variants will be added to the project file with their appropriate -build targets and sources. -</para> - -<para> -<literal>buildtarget</literal>: -An optional string, node, or list of strings or nodes -(one per build variant), to tell the Visual Studio debugger -what output target to use in what build variant. -The number of -<literal>buildtarget</literal> -entries must match the number of -<literal>variant</literal> -entries. -</para> - -<para> -<literal>runfile</literal>: -The name of the file that Visual Studio 7 and later -will run and debug. -This appears as the value of the -<literal>Output</literal> -field in the resutling Visual Studio project file. -If this is not specified, -the default is the same as the specified -<literal>buildtarget</literal> -value. -</para> - -<para> -Note that because &SCons; always executes its build commands -from the directory in which the &SConstruct; file is located, -if you generate a project file in a different directory -than the &SConstruct; directory, -users will not be able to double-click -on the file name in compilation error messages -displayed in the Visual Studio console output window. -This can be remedied by adding the -Visual C/C++ -<literal>/FC</literal> -compiler option to the &cv-link-CCFLAGS; variable -so that the compiler will print -the full path name of any -files that cause compilation errors. -</para> - -<para> -Example usage: -</para> - -<example_commands> -barsrcs = ['bar.cpp'], +<sconsdoc +xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0 http://www.scons.org/dbxsd/v1.0/scons.xsd" +xmlns="http://www.scons.org/dbxsd/v1.0" +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +xmlns:xs="http://www.w3.org/2001/XMLSchema" +xmlns:ns="http://www.scons.org/dbxsd/v1.0"><tool name="msvs"> <summary> <para> +Sets construction variables for Microsoft Visual Studio. </para> </summary> +<sets> <item>MSVSPROJECTCOM</item> <item>MSVSSOLUTIONCOM</item> +<item>MSVSSCONSCRIPT</item> <item>MSVSSCONS</item> <item>MSVSSCONSFLAGS</item> +<item>MSVSSCONSCOM</item> <item>MSVSBUILDCOM</item> +<item>MSVSREBUILDCOM</item> <item>MSVSCLEANCOM</item> +<item>MSVSENCODING</item> </sets> <uses> </uses> </tool> <builder +name="MSVSProject"> <summary> <para> Builds a Microsoft Visual Studio project +file, and by default builds a solution file as well. </para> <para> This +builds a Visual Studio project file, based on the version of Visual Studio +that is configured (either the latest installed version, or the version +specified by &cv-link-MSVS_VERSION; in the Environment constructor). For +Visual Studio 6, it will generate a <filename>.dsp</filename> file. For Visual +Studio 7 (.NET) and later versions, it will generate a +<filename>.vcproj</filename> file. </para> <para> By default, this also +generates a solution file for the specified project, a +<filename>.dsw</filename> file for Visual Studio 6 or a +<filename>.sln</filename> file for Visual Studio 7 (.NET). This behavior may +be disabled by specifying <literal>auto_build_solution=0</literal> when you +call &b-MSVSProject;, in which case you presumably want to build the solution +file(s) by calling the &b-MSVSSolution; Builder (see below). </para> <para> +The &b-MSVSProject; builder takes several lists of filenames to be placed into +the project file. These are currently limited to <literal>srcs</literal>, +<literal>incs</literal>, <literal>localincs</literal>, +<literal>resources</literal>, and <literal>misc</literal>. These are pretty +self-explanatory, but it should be noted that these lists are added to the +&cv-link-SOURCES; construction variable as strings, NOT as SCons File Nodes. +This is because they represent file names to be added to the project file, not +the source files used to build the project file. </para> <para> The above +filename lists are all optional, although at least one must be specified for +the resulting project file to be non-empty. </para> <para> In addition to the +above lists of values, the following values may be specified: +</para><variablelist> + <varlistentry> + <term>target</term> + + <listitem> + <para>The name of the target <filename>.dsp</filename> or + <filename>.vcproj</filename> file. The correct suffix for the version + of Visual Studio must be used, but the &cv-link-MSVSPROJECTSUFFIX; + construction variable will be defined to the correct value (see + example below).</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>variant</term> + + <listitem> + <para>The name of this particular variant. For Visual Studio 7 + projects, this can also be a list of variant names. These are + typically things like "Debug" or "Release", but really can be anything + you want. For Visual Studio 7 projects, they may also specify a target + platform separated from the variant name by a <literal>|</literal> + (vertical pipe) character: <literal>Debug|Xbox</literal>. The default + target platform is Win32. Multiple calls to &b-MSVSProject; with + different variants are allowed; all variants will be added to the + project file with their appropriate build targets and + sources.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>cmdargs</term> + + <listitem> + <para>Additional command line arguments for the different + variants. The number of <literal>cmdargs</literal> entries must match + the number of <literal>variant</literal> entries, or be empty (not + specified). If you give only one, it will automatically be propagated + to all variants.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>buildtarget</term> + + <listitem> + <para>An optional string, node, or list of strings or nodes (one + per build variant), to tell the Visual Studio debugger what output + target to use in what build variant. The number of + <literal>buildtarget</literal> entries must match the number of + <literal>variant</literal> entries.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>runfile</term> + + <listitem> + <para>The name of the file that Visual Studio 7 and later will + run and debug. This appears as the value of the + <literal>Output</literal> field in the resulting Visual Studio project + file. If this is not specified, the default is the same as the + specified <literal>buildtarget</literal> value.</para> + </listitem> + </varlistentry> + </variablelist><para> Note that because &SCons; always executes its build +commands from the directory in which the &SConstruct; file is located, if you +generate a project file in a different directory than the &SConstruct; +directory, users will not be able to double-click on the file name in +compilation error messages displayed in the Visual Studio console output +window. This can be remedied by adding the Visual C/C++ <literal>/FC</literal> +compiler option to the &cv-link-CCFLAGS; variable so that the compiler will +print the full path name of any files that cause compilation errors. </para> +<para> Example usage: </para> <example_commands>barsrcs = ['bar.cpp'], barincs = ['bar.h'], barlocalincs = ['StdAfx.h'] barresources = ['bar.rc','resource.h'] @@ -218,440 +145,374 @@ env.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'], buildtarget = dll, variant = 'Release') </example_commands> -</summary> -</builder> - -<builder name ="MSVSSolution"> -<summary> -<para> -Builds a Microsoft Visual Studio solution file. -</para> - -<para> -This builds a Visual Studio solution file, -based on the version of Visual Studio that is configured -(either the latest installed version, -or the version specified by -&cv-link-MSVS_VERSION; -in the construction environment). -For Visual Studio 6, it will generate a -<filename>.dsw</filename> -file. -For Visual Studio 7 (.NET), it will -generate a -<filename>.sln</filename> -file. -</para> - -<para> -The following values must be specified: -</para> - -<para> -<literal>target</literal>: -The name of the target .dsw or .sln file. The correct -suffix for the version of Visual Studio must be used, but the value -&cv-link-MSVSSOLUTIONSUFFIX; -will be defined to the correct value (see example below). -</para> - -<para> -<literal>variant</literal>: -The name of this particular variant, or a list of variant -names (the latter is only supported for MSVS 7 solutions). These are -typically things like "Debug" or "Release", but really can be anything -you want. For MSVS 7 they may also specify target platform, like this -"Debug|Xbox". Default platform is Win32. -</para> - -<para> -<literal>projects</literal>: -A list of project file names, or Project nodes returned by calls to the -&b-MSVSProject; -Builder, -to be placed into the solution file. -It should be noted that these file names are NOT added to the $SOURCES -environment variable in form of files, but rather as strings. This -is because they represent file names to be added to the solution file, -not the source files used to build the solution file. -</para> - -<para> -Example Usage: -</para> - -<example_commands> -env.MSVSSolution(target = 'Bar' + env['MSVSSOLUTIONSUFFIX'], - projects = ['bar' + env['MSVSPROJECTSUFFIX']], - variant = 'Release') -</example_commands> -</summary> -</builder> - -<cvar name="MSVS"> -<summary> -<para> -When the Microsoft Visual Studio tools are initialized, they set up -this dictionary with the following keys: -</para> - -<para> -<envar>VERSION</envar>: -the version of MSVS being used (can be set via -&cv-link-MSVS_VERSION;) -</para> - -<para> -<envar>VERSIONS</envar>: -the available versions of MSVS installed -</para> - -<para> -<envar>VCINSTALLDIR</envar>: -installed directory of Visual C++ -</para> - -<para> -<envar>VSINSTALLDIR</envar>: -installed directory of Visual Studio -</para> - -<para> -<envar>FRAMEWORKDIR</envar>: -installed directory of the .NET framework -</para> - -<para> -<envar>FRAMEWORKVERSIONS</envar>: -list of installed versions of the .NET framework, sorted latest to oldest. -</para> - -<para> -<envar>FRAMEWORKVERSION</envar>: -latest installed version of the .NET framework -</para> - -<para> -<envar>FRAMEWORKSDKDIR</envar>: -installed location of the .NET SDK. -</para> - -<para> -<envar>PLATFORMSDKDIR</envar>: -installed location of the Platform SDK. -</para> - -<para> -<envar>PLATFORMSDK_MODULES</envar>: -dictionary of installed Platform SDK modules, -where the dictionary keys are keywords for the various modules, and -the values are 2-tuples where the first is the release date, and the -second is the version number. -</para> - -<para> -If a value isn't set, it wasn't available in the registry. -</para> -</summary> -</cvar> - -<cvar name="MSVS_ARCH"> -<summary> -<para> -Sets the architecture for which the generated project(s) should build. -</para> - -<para> -The default value is <literal>x86</literal>. -<literal>amd64</literal> is also supported -by &SCons; for some Visual Studio versions. -Trying to set &cv-MSVS_ARCH; to an architecture that's not -supported for a given Visual Studio version -will generate an error. -</para> -</summary> -</cvar> - -<cvar name="MSVS_PROJECT_GUID"> -<summary> -<para> -The string -placed in a generated Microsoft Visual Studio project file -as the value of the -<literal>ProjectGUID</literal> -attribute. -There is no default value. If not defined, a new GUID is generated. -</para> -</summary> -</cvar> - -<cvar name="MSVS_SCC_AUX_PATH"> -<summary> -<para> -The path name -placed in a generated Microsoft Visual Studio project file -as the value of the -<literal>SccAuxPath</literal> -attribute -if the -<envar>MSVS_SCC_PROVIDER</envar> -construction variable is also set. -There is no default value. -</para> -</summary> -</cvar> - -<cvar name="MSVS_SCC_CONNECTION_ROOT"> -<summary> -<para> -The root path of projects in your SCC workspace, i.e the path under which -all project and solution files will be generated. It is used as a -reference path from which the relative paths of the generated -Microsoft Visual Studio project and solution files are computed. -The relative project file path is placed as the value of the -<literal>SccLocalPath</literal> -attribute -of the project file -and as the values of the -<literal>SccProjectFilePathRelativizedFromConnection[i]</literal> -(where [i] ranges from 0 to the number of projects in the solution) -attributes of the -<literal>GlobalSection(SourceCodeControl)</literal> -section of the Microsoft Visual Studio solution file. -Similarly the relative solution file path is placed as the values of the -<literal>SccLocalPath[i]</literal> -(where [i] ranges from 0 to the number of projects in the solution) -attributes of the -<literal>GlobalSection(SourceCodeControl)</literal> -section of the Microsoft Visual Studio solution file. -This is used only -if the -<envar>MSVS_SCC_PROVIDER</envar> -construction variable is also set. -The default value is the current working directory. -</para> -</summary> -</cvar> - -<cvar name="MSVS_SCC_PROJECT_NAME"> -<summary> -<para> -The project name -placed in a generated Microsoft Visual Studio project file -as the value of the -<literal>SccProjectName</literal> -attribute -if the -<envar>MSVS_SCC_PROVIDER</envar> -construction variable is also set. -In this case the string is also placed in the -<literal>SccProjectName0</literal> -attribute of the -<literal>GlobalSection(SourceCodeControl)</literal> -section of the Microsoft Visual Studio solution file. -There is no default value. -</para> -</summary> -</cvar> - -<cvar name="MSVS_SCC_PROVIDER"> -<summary> -<para> -The string -placed in a generated Microsoft Visual Studio project file -as the value of the -<literal>SccProvider</literal> -attribute. -The string is also placed in the -<literal>SccProvider0</literal> -attribute of the -<literal>GlobalSection(SourceCodeControl)</literal> -section of the Microsoft Visual Studio solution file. -There is no default value. -</para> -</summary> -</cvar> - -<cvar name="MSVS_VERSION"> -<summary> -<para> -Sets the preferred version of Microsoft Visual Studio to use. -</para> - -<para> -If &cv-MSVS_VERSION; is not set, -&SCons; will (by default) select the latest version -of Visual Studio installed on your system. -So, if you have version 6 and version 7 (MSVS .NET) installed, -it will prefer version 7. -You can override this by -specifying the -<envar>MSVS_VERSION</envar> -variable in the Environment initialization, setting it to the -appropriate version ('6.0' or '7.0', for example). -If the specified version isn't installed, -tool initialization will fail. -</para> - -<para> -This is obsolete: use &cv-MSVC_VERSION; instead. If &cv-MSVS_VERSION; is set and -&cv-MSVC_VERSION; is not, &cv-MSVC_VERSION; will be set automatically to &cv-MSVS_VERSION;. -If both are set to different values, scons will raise an error. -</para> -</summary> -</cvar> - -<cvar name="MSVSBUILDCOM"> -<summary> -<para> -The build command line placed in -a generated Microsoft Visual Studio project file. -The default is to have Visual Studio invoke SCons with any specified -build targets. -</para> -</summary> -</cvar> - -<cvar name="MSVSCLEANCOM"> -<summary> -<para> -The clean command line placed in -a generated Microsoft Visual Studio project file. -The default is to have Visual Studio invoke SCons with the -c option -to remove any specified targets. -</para> -</summary> -</cvar> - -<cvar name="MSVSENCODING"> -<summary> -<para> -The encoding string placed in -a generated Microsoft Visual Studio project file. -The default is encoding -<literal>Windows-1252</literal>. -</para> -</summary> -</cvar> - -<cvar name="MSVSPROJECTCOM"> -<summary> -<para> -The action used to generate Microsoft Visual Studio project files. -</para> -</summary> -</cvar> - -<cvar name="MSVSPROJECTSUFFIX"> -<summary> -<para> -The suffix used for Microsoft Visual Studio project (DSP) files. -The default value is -<filename>.vcproj</filename> -when using Visual Studio version 7.x (.NET) -or later version, -and -<filename>.dsp</filename> -when using earlier versions of Visual Studio. -</para> -</summary> -</cvar> - -<cvar name="MSVSREBUILDCOM"> -<summary> -<para> -The rebuild command line placed in -a generated Microsoft Visual Studio project file. -The default is to have Visual Studio invoke SCons with any specified -rebuild targets. -</para> -</summary> -</cvar> - -<cvar name="MSVSSCONS"> -<summary> -<para> -The SCons used in generated Microsoft Visual Studio project files. -The default is the version of SCons being -used to generate the project file. -</para> -</summary> -</cvar> - -<cvar name="MSVSSCONSFLAGS"> -<summary> -<para> -The SCons flags used in generated Microsoft Visual Studio -project files. -</para> -</summary> -</cvar> - -<cvar name="MSVSSCONSCOM"> -<summary> -<para> -The default SCons command used in generated Microsoft Visual Studio -project files. -</para> -</summary> -</cvar> - -<cvar name="MSVSSCONSCRIPT"> -<summary> -<para> -The sconscript file -(that is, -&SConstruct; -or -&SConscript; -file) -that will be invoked by Visual Studio -project files -(through the -&cv-link-MSVSSCONSCOM; -variable). -The default is the same sconscript file -that contains the call to -&b-MSVSProject; -to build the project file. -</para> -</summary> -</cvar> - -<cvar name="MSVSSOLUTIONCOM"> -<summary> -<para> -The action used to generate Microsoft Visual Studio solution files. -</para> -</summary> -</cvar> - -<cvar name="MSVSSOLUTIONSUFFIX"> -<summary> -<para> -The suffix used for Microsoft Visual Studio solution (DSW) files. -The default value is -<filename>.sln</filename> -when using Visual Studio version 7.x (.NET), -and -<filename>.dsw</filename> -when using earlier versions of Visual Studio. -</para> -</summary> -</cvar> - -<cvar name="SCONS_HOME"> -<summary> -<para> -The (optional) path to the SCons library directory, -initialized from the external environment. -If set, this is used to construct a shorter and more -efficient search path in the -&cv-link-MSVSSCONS; -command line executed -from Microsoft Visual Studio project files. -</para> -</summary> -</cvar> - -</sconsdoc> +<para>Starting with version 2.4 of +SCons it's also possible to specify the optional argument +<parameter>DebugSettings</parameter>, which creates files for debugging under +Visual Studio:</para><variablelist> + <varlistentry> + <term>DebugSettings</term> + + <listitem> + <para>A dictionary of debug settings that get written to the + <filename>.vcproj.user</filename> or the + <filename>.vcxproj.user</filename> file, depending on the version + installed. As it is done for cmdargs (see above), you can specify a + <parameter>DebugSettings</parameter> dictionary per variant. If you + give only one, it will be propagated to all variants.</para> + </listitem> + </varlistentry> + </variablelist><para>Currently, only Visual Studio v9.0 and Visual Studio +version v11 are implemented, for other versions no file is generated. To +generate the user file, you just need to add a +<parameter>DebugSettings</parameter> dictionary to the environment with the +right parameters for your MSVS version. If the dictionary is empty, or does +not contain any good value, no file will be generated.</para><para>Following +is a more contrived example, involving the setup of a project for variants and +DebugSettings:</para><example_commands># Assuming you store your defaults in a file +vars = Variables('variables.py') +msvcver = vars.args.get('vc', '9') + +# Check command args to force one Microsoft Visual Studio version +if msvcver == '9' or msvcver == '11': + env = Environment(MSVC_VERSION=msvcver+'.0', MSVC_BATCH=False) +else: + env = Environment() + +AddOption('--userfile', action='store_true', dest='userfile', default=False, + help="Create Visual Studio Project user file") + +# +# 1. Configure your Debug Setting dictionary with options you want in the list +# of allowed options, for instance if you want to create a user file to launch +# a specific application for testing your dll with Microsoft Visual Studio 2008 (v9): +# +V9DebugSettings = { + 'Command':'c:\\myapp\\using\\thisdll.exe', + 'WorkingDirectory': 'c:\\myapp\\using\\', + 'CommandArguments': '-p password', +# 'Attach':'false', +# 'DebuggerType':'3', +# 'Remote':'1', +# 'RemoteMachine': None, +# 'RemoteCommand': None, +# 'HttpUrl': None, +# 'PDBPath': None, +# 'SQLDebugging': None, +# 'Environment': '', +# 'EnvironmentMerge':'true', +# 'DebuggerFlavor': None, +# 'MPIRunCommand': None, +# 'MPIRunArguments': None, +# 'MPIRunWorkingDirectory': None, +# 'ApplicationCommand': None, +# 'ApplicationArguments': None, +# 'ShimCommand': None, +# 'MPIAcceptMode': None, +# 'MPIAcceptFilter': None, +} + +# +# 2. Because there are a lot of different options depending on the Microsoft +# Visual Studio version, if you use more than one version you have to +# define a dictionary per version, for instance if you want to create a user +# file to launch a specific application for testing your dll with Microsoft +# Visual Studio 2012 (v11): +# +V10DebugSettings = { + 'LocalDebuggerCommand': 'c:\\myapp\\using\\thisdll.exe', + 'LocalDebuggerWorkingDirectory': 'c:\\myapp\\using\\', + 'LocalDebuggerCommandArguments': '-p password', +# 'LocalDebuggerEnvironment': None, +# 'DebuggerFlavor': 'WindowsLocalDebugger', +# 'LocalDebuggerAttach': None, +# 'LocalDebuggerDebuggerType': None, +# 'LocalDebuggerMergeEnvironment': None, +# 'LocalDebuggerSQLDebugging': None, +# 'RemoteDebuggerCommand': None, +# 'RemoteDebuggerCommandArguments': None, +# 'RemoteDebuggerWorkingDirectory': None, +# 'RemoteDebuggerServerName': None, +# 'RemoteDebuggerConnection': None, +# 'RemoteDebuggerDebuggerType': None, +# 'RemoteDebuggerAttach': None, +# 'RemoteDebuggerSQLDebugging': None, +# 'DeploymentDirectory': None, +# 'AdditionalFiles': None, +# 'RemoteDebuggerDeployDebugCppRuntime': None, +# 'WebBrowserDebuggerHttpUrl': None, +# 'WebBrowserDebuggerDebuggerType': None, +# 'WebServiceDebuggerHttpUrl': None, +# 'WebServiceDebuggerDebuggerType': None, +# 'WebServiceDebuggerSQLDebugging': None, +} + +# +# 3. Select the dictionary you want depending on the version of visual Studio +# Files you want to generate. +# +if not env.GetOption('userfile'): + dbgSettings = None +elif env.get('MSVC_VERSION', None) == '9.0': + dbgSettings = V9DebugSettings +elif env.get('MSVC_VERSION', None) == '11.0': + dbgSettings = V10DebugSettings +else: + dbgSettings = None + +# +# 4. Add the dictionary to the DebugSettings keyword. +# +barsrcs = ['bar.cpp', 'dllmain.cpp', 'stdafx.cpp'] +barincs = ['targetver.h'] +barlocalincs = ['StdAfx.h'] +barresources = ['bar.rc','resource.h'] +barmisc = ['ReadMe.txt'] + +dll = env.SharedLibrary(target = 'bar.dll', + source = barsrcs) + +env.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'], + srcs = barsrcs, + incs = barincs, + localincs = barlocalincs, + resources = barresources, + misc = barmisc, + buildtarget = [dll[0]] * 2, + variant = ('Debug|Win32', 'Release|Win32'), + cmdargs = 'vc=%s' % msvcver, + DebugSettings = (dbgSettings, {})) +</example_commands> </summary> </builder> <builder +name="MSVSSolution"> <summary> <para>Builds a Microsoft Visual Studio solution +file. </para> <para>This builds a Visual Studio solution file, based on the +version of Visual Studio that is configured (either the latest installed +version, or the version specified by &cv-link-MSVS_VERSION; in the +construction environment). For Visual Studio 6, it will generate a +<filename>.dsw</filename> file. For Visual Studio 7 (.NET), it will generate a +<filename>.sln</filename> file. </para> <para> The following values must be +specified: </para><variablelist> + <varlistentry> + <term>target</term> + + <listitem> + <para>The name of the target .dsw or .sln file. The correct + suffix for the version of Visual Studio must be used, but the value + &cv-link-MSVSSOLUTIONSUFFIX; will be defined to the correct value (see + example below).</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>variant</term> + + <listitem> + <para>The name of this particular variant, or a list of variant + names (the latter is only supported for MSVS 7 solutions). These are + typically things like "Debug" or "Release", but really can be anything + you want. For MSVS 7 they may also specify target platform, like this + "Debug|Xbox". Default platform is Win32.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>projects</term> + + <listitem> + <para>A list of project file names, or Project nodes returned by + calls to the &b-MSVSProject; Builder, to be placed into the solution + file. It should be noted that these file names are NOT added to the + $SOURCES environment variable in form of files, but rather as strings. + This is because they represent file names to be added to the solution + file, not the source files used to build the solution + file.</para> + </listitem> + </varlistentry> + </variablelist> <para> Example Usage: </para> <example_commands> +env.MSVSSolution(target = 'Bar' + env['MSVSSOLUTIONSUFFIX'], projects = ['bar' ++ env['MSVSPROJECTSUFFIX']], variant = 'Release') +</example_commands></summary></builder> <cvar name="MSVS"> <summary> <para> +When the Microsoft Visual Studio tools are initialized, they set up this +dictionary with the following keys: </para><variablelist> + <varlistentry> + <term>VERSION</term> + + <listitem> + <para>the version of MSVS being used (can be set via + &cv-link-MSVS_VERSION;)</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>VERSIONS</term> + + <listitem> + <para>the available versions of MSVS installed</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>VCINSTALLDIR</term> + + <listitem> + <para>installed directory of Visual C++</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>VSINSTALLDIR</term> + + <listitem> + <para>installed directory of Visual Studio</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>FRAMEWORKDIR</term> + + <listitem> + <para>installed directory of the .NET framework</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>FRAMEWORKVERSIONS</term> + + <listitem> + <para>list of installed versions of the .NET framework, sorted + latest to oldest.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>FRAMEWORKVERSION</term> + + <listitem> + <para>latest installed version of the .NET + framework</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>FRAMEWORKSDKDIR</term> + + <listitem> + <para>installed location of the .NET SDK.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>PLATFORMSDKDIR</term> + + <listitem> + <para>installed location of the Platform SDK.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>PLATFORMSDK_MODULES</term> + + <listitem> + <para>dictionary of installed Platform SDK modules, where the + dictionary keys are keywords for the various modules, and the values + are 2-tuples where the first is the release date, and the second is + the version number.</para> + </listitem> + </varlistentry> + </variablelist><para>If a value isn't set, it wasn't available in the +registry.</para></summary></cvar> <cvar name="MSVS_ARCH"> <summary> <para>Sets +the architecture for which the generated project(s) should build. </para> +<para>The default value is <literal>x86</literal>. <literal>amd64</literal> is +also supported by &SCons; for some Visual Studio versions. Trying to set +&cv-MSVS_ARCH; to an architecture that's not supported for a given Visual +Studio version will generate an error. </para> </summary> </cvar> <cvar +name="MSVS_PROJECT_GUID"> <summary> <para>The string placed in a generated +Microsoft Visual Studio project file as the value of the +<literal>ProjectGUID</literal> attribute. There is no default value. If not +defined, a new GUID is generated. </para> </summary> </cvar> <cvar +name="MSVS_SCC_AUX_PATH"> <summary> <para>The path name placed in a generated +Microsoft Visual Studio project file as the value of the +<literal>SccAuxPath</literal> attribute if the +<envar>MSVS_SCC_PROVIDER</envar> construction variable is also set. There is +no default value. </para> </summary> </cvar> <cvar +name="MSVS_SCC_CONNECTION_ROOT"> <summary> <para>The root path of projects in +your SCC workspace, i.e the path under which all project and solution files +will be generated. It is used as a reference path from which the relative +paths of the generated Microsoft Visual Studio project and solution files are +computed. The relative project file path is placed as the value of the +<literal>SccLocalPath</literal> attribute of the project file and as the +values of the +<literal>SccProjectFilePathRelativizedFromConnection[i]</literal> (where [i] +ranges from 0 to the number of projects in the solution) attributes of the +<literal>GlobalSection(SourceCodeControl)</literal> section of the Microsoft +Visual Studio solution file. Similarly the relative solution file path is +placed as the values of the <literal>SccLocalPath[i]</literal> (where [i] +ranges from 0 to the number of projects in the solution) attributes of the +<literal>GlobalSection(SourceCodeControl)</literal> section of the Microsoft +Visual Studio solution file. This is used only if the +<envar>MSVS_SCC_PROVIDER</envar> construction variable is also set. The +default value is the current working directory. </para> </summary> </cvar> +<cvar name="MSVS_SCC_PROJECT_NAME"> <summary> <para>The project name placed in +a generated Microsoft Visual Studio project file as the value of the +<literal>SccProjectName</literal> attribute if the +<envar>MSVS_SCC_PROVIDER</envar> construction variable is also set. In this +case the string is also placed in the <literal>SccProjectName0</literal> +attribute of the <literal>GlobalSection(SourceCodeControl)</literal> section +of the Microsoft Visual Studio solution file. There is no default value. +</para> </summary> </cvar> <cvar name="MSVS_SCC_PROVIDER"> <summary> <para>The +string placed in a generated Microsoft Visual Studio project file as the value +of the <literal>SccProvider</literal> attribute. The string is also placed in +the <literal>SccProvider0</literal> attribute of the +<literal>GlobalSection(SourceCodeControl)</literal> section of the Microsoft +Visual Studio solution file. There is no default value. </para> </summary> +</cvar> <cvar name="MSVS_VERSION"> <summary> <para>Sets the preferred version +of Microsoft Visual Studio to use. </para> <para>If &cv-MSVS_VERSION; is not +set, &SCons; will (by default) select the latest version of Visual Studio +installed on your system. So, if you have version 6 and version 7 (MSVS .NET) +installed, it will prefer version 7. You can override this by specifying the +<envar>MSVS_VERSION</envar> variable in the Environment initialization, +setting it to the appropriate version ('6.0' or '7.0', for example). If the +specified version isn't installed, tool initialization will fail. </para> +<para>This is obsolete: use &cv-MSVC_VERSION; instead. If &cv-MSVS_VERSION; is +set and &cv-MSVC_VERSION; is not, &cv-MSVC_VERSION; will be set automatically +to &cv-MSVS_VERSION;. If both are set to different values, scons will raise an +error. </para> </summary> </cvar> <cvar name="MSVSBUILDCOM"> <summary> +<para>The build command line placed in a generated Microsoft Visual Studio +project file. The default is to have Visual Studio invoke SCons with any +specified build targets. </para> </summary> </cvar> <cvar name="MSVSCLEANCOM"> +<summary> <para>The clean command line placed in a generated Microsoft Visual +Studio project file. The default is to have Visual Studio invoke SCons with +the -c option to remove any specified targets. </para> </summary> </cvar> +<cvar name="MSVSENCODING"> <summary> <para>The encoding string placed in a +generated Microsoft Visual Studio project file. The default is encoding +<literal>Windows-1252</literal>. </para> </summary> </cvar> <cvar +name="MSVSPROJECTCOM"> <summary> <para>The action used to generate Microsoft +Visual Studio project files. </para> </summary> </cvar> <cvar +name="MSVSPROJECTSUFFIX"> <summary> <para>The suffix used for Microsoft Visual +Studio project (DSP) files. The default value is <filename>.vcproj</filename> +when using Visual Studio version 7.x (.NET) or later version, and +<filename>.dsp</filename> when using earlier versions of Visual Studio. +</para> </summary> </cvar> <cvar name="MSVSREBUILDCOM"> <summary> <para>The +rebuild command line placed in a generated Microsoft Visual Studio project +file. The default is to have Visual Studio invoke SCons with any specified +rebuild targets. </para> </summary> </cvar> <cvar name="MSVSSCONS"> <summary> +<para>The SCons used in generated Microsoft Visual Studio project files. The +default is the version of SCons being used to generate the project file. +</para> </summary> </cvar> <cvar name="MSVSSCONSFLAGS"> <summary> <para>The +SCons flags used in generated Microsoft Visual Studio project files. </para> +</summary> </cvar> <cvar name="MSVSSCONSCOM"> <summary> <para>The default +SCons command used in generated Microsoft Visual Studio project files. </para> +</summary> </cvar> <cvar name="MSVSSCONSCRIPT"> <summary> <para>The sconscript +file (that is, &SConstruct; or &SConscript; file) that will be invoked by +Visual Studio project files (through the &cv-link-MSVSSCONSCOM; variable). The +default is the same sconscript file that contains the call to &b-MSVSProject; +to build the project file. </para> </summary> </cvar> <cvar +name="MSVSSOLUTIONCOM"> <summary> <para>The action used to generate Microsoft +Visual Studio solution files. </para> </summary> </cvar> <cvar +name="MSVSSOLUTIONSUFFIX"> <summary> <para>The suffix used for Microsoft +Visual Studio solution (DSW) files. The default value is +<filename>.sln</filename> when using Visual Studio version 7.x (.NET), and +<filename>.dsw</filename> when using earlier versions of Visual Studio. +</para> </summary> </cvar> <cvar name="SCONS_HOME"> <summary> <para>The +(optional) path to the SCons library directory, initialized from the external +environment. If set, this is used to construct a shorter and more efficient +search path in the &cv-link-MSVSSCONS; command line executed from Microsoft +Visual Studio project files. </para> </summary> </cvar></sconsdoc> diff --git a/src/setup.py b/src/setup.py index a8b59a32..fb16bddb 100644 --- a/src/setup.py +++ b/src/setup.py @@ -81,6 +81,16 @@ import distutils.command.install_data import distutils.command.install_lib import distutils.command.install_scripts import distutils.command.build_scripts +import distutils.msvccompiler + +def get_build_version(): + """ monkey patch distutils msvc version if we're not on windows. + We need to use vc version 9 for python 2.7.x and it defaults to 6 + for non-windows platforms and there is no way to override it besides + monkey patching""" + return 9 + +distutils.msvccompiler.get_build_version = get_build_version _install = distutils.command.install.install _install_data = distutils.command.install_data.install_data diff --git a/test/Copy-Symlinks.py b/test/Copy-Symlinks.py index 640e76c1..2b8b8247 100644 --- a/test/Copy-Symlinks.py +++ b/test/Copy-Symlinks.py @@ -50,18 +50,24 @@ treeToLink = 'tree' treelinkToCopy = 'treelinkToCopy' badToLink = 'None' # do not write this item badlinkToCopy = 'badlinkToCopy' +relToLink = os.path.join( treeToLink, fileToLink ) +rellinkToCopy = 'relLinkToCopy' test.symlink( fileToLink, filelinkToCopy ) test.symlink( dirToLink, dirlinkToCopy ) test.symlink( treeToLink, treelinkToCopy ) test.symlink( badToLink, badlinkToCopy ) +test.symlink( relToLink, rellinkToCopy ) test.write( fileToLink, fileContents ) test.subdir( dirToLink ) test.subdir( treeToLink ) -test.write( os.path.join( treeToLink, fileToLink ), fileContents ) +test.write( relToLink, fileContents ) -test.write('SConstruct', +sconstructPath = 'SConstruct' +sconscriptPath = os.path.join( treeToLink, 'SConscript' ) + +test.write( sconstructPath, """\ import SCons.Defaults SCons.Defaults.DefaultEnvironment( tools = [] ) @@ -81,17 +87,32 @@ Execute( Copy( 'L6', '%(treelinkToCopy)s', True ) ) Execute( Copy( 'Fails', '%(badlinkToCopy)s', False ) ) Execute( Copy( 'L7', '%(badlinkToCopy)s' ) ) Execute( Copy( 'L8', '%(badlinkToCopy)s', True ) ) + +SConscript( '%(sconscriptPath)s' ) +""" +% locals() +) + +relLinkCopyPath = os.path.join( '..', rellinkToCopy ) + +test.write( sconscriptPath, +"""\ +Execute( Copy( 'F2', '%(relLinkCopyPath)s', False ) ) +Execute( Copy( 'L9', '%(relLinkCopyPath)s' ) ) +Execute( Copy( 'L10', '%(relLinkCopyPath)s', True ) ) """ % locals() ) -test.must_exist( 'SConstruct' ) +test.must_exist( sconstructPath ) +test.must_exist( sconscriptPath ) test.must_exist( fileToLink ) test.must_exist( filelinkToCopy ) test.must_exist( dirlinkToCopy ) test.must_exist( treelinkToCopy ) test.must_not_exist( badToLink ) test.must_exist( badlinkToCopy ) +test.must_exist( rellinkToCopy ) expectStdout = test.wrap_stdout( read_str = @@ -105,9 +126,12 @@ Copy("L4", "%(dirlinkToCopy)s") Copy("T1", "%(treelinkToCopy)s") Copy("L5", "%(treelinkToCopy)s") Copy("L6", "%(treelinkToCopy)s") -Copy("Fails", "badlinkToCopy") +Copy("Fails", "%(badlinkToCopy)s") Copy("L7", "%(badlinkToCopy)s") Copy("L8", "%(badlinkToCopy)s") +Copy("F2", "%(relLinkCopyPath)s") +Copy("L9", "%(relLinkCopyPath)s") +Copy("L10", "%(relLinkCopyPath)s") ''' % locals(), build_str = '''\ @@ -117,13 +141,18 @@ scons: `.' is up to date. expectStderr = \ '''\ -scons: *** None: No such file or directory -''' +scons: *** %s: No such file or directory +''' % os.path.join( os.getcwd(), badToLink ) test.run( stdout = expectStdout, stderr = expectStderr, status = None ) +F2 = os.path.join( treeToLink, 'F2' ) +L9 = os.path.join( treeToLink, 'L9' ) +L10 = os.path.join( treeToLink, 'L10' ) + test.must_exist('D1') test.must_exist('F1') +test.must_exist( F2 ) test.must_exist('L2') test.must_exist('L3') test.must_exist('L4') @@ -131,17 +160,21 @@ test.must_exist('L5') test.must_exist('L6') test.must_exist('L7') test.must_exist('L8') +test.must_exist( L9 ) +test.must_exist( L10 ) test.must_exist('T1') test.must_not_exist( 'Fails' ) test.must_match( fileToLink, fileContents ) test.must_match( 'F1', fileContents ) +test.must_match( F2 , fileContents ) test.must_match( 'L1', fileContents ) test.must_match( 'L2', fileContents ) test.must_match( os.path.join( treeToLink, fileToLink ), fileContents ) test.fail_test( condition=os.path.islink('D1') ) test.fail_test( condition=os.path.islink('F1') ) +test.fail_test( condition=os.path.islink( F2 ) ) test.fail_test( condition=os.path.islink('T1') ) test.fail_test( condition=(not os.path.isdir('D1')) ) test.fail_test( condition=(not os.path.isfile('F1')) ) @@ -154,8 +187,12 @@ test.fail_test( condition=(not os.path.islink('L5')) ) test.fail_test( condition=(not os.path.islink('L6')) ) test.fail_test( condition=(not os.path.islink('L7')) ) test.fail_test( condition=(not os.path.islink('L8')) ) +test.fail_test( condition=(not os.path.islink( L9 )) ) +test.fail_test( condition=(not os.path.islink( L10 )) ) test.fail_test( condition=(os.path.exists('L7')) ) test.fail_test( condition=(os.path.exists('L8')) ) +test.fail_test( condition=(os.path.exists( L9 )) ) +test.fail_test( condition=(os.path.exists( L10 )) ) test.fail_test( condition=(os.readlink(filelinkToCopy) != os.readlink('L1')) ) test.fail_test( condition=(os.readlink(filelinkToCopy) != os.readlink('L2')) ) test.fail_test( condition=(os.readlink(dirlinkToCopy) != os.readlink('L3')) ) @@ -164,6 +201,8 @@ test.fail_test( condition=(os.readlink(treelinkToCopy) != os.readlink('L5')) ) test.fail_test( condition=(os.readlink(treelinkToCopy) != os.readlink('L6')) ) test.fail_test( condition=(os.readlink(badlinkToCopy) != os.readlink('L7')) ) test.fail_test( condition=(os.readlink(badlinkToCopy) != os.readlink('L8')) ) +test.fail_test( condition=(os.readlink(rellinkToCopy) != os.readlink( L9 )) ) +test.fail_test( condition=(os.readlink(rellinkToCopy) != os.readlink( L10 )) ) test.pass_test() diff --git a/test/D/Issues/2944/D_changed_DFLAGS_not_rebuilding.py b/test/D/Issues/2944/D_changed_DFLAGS_not_rebuilding.py new file mode 100644 index 00000000..1d9854fa --- /dev/null +++ b/test/D/Issues/2944/D_changed_DFLAGS_not_rebuilding.py @@ -0,0 +1,23 @@ +# Test to check for issue reported in tigris bug 2994 +# http://scons.tigris.org/issues/show_bug.cgi?id=2994 +# + +import TestSCons + +test = TestSCons.TestSCons() + +dmd_present = test.detect_tool('dmd', prog='dmd') +ldc_present = test.detect_tool('ldc',prog='ldc2') +gdc_present = test.detect_tool('gdc',prog='gdc') + +if not (dmd_present or ldc_present or gdc_present): + test.skip_test("Could not load dmd ldc or gdc Tool; skipping test(s).\n") + + +test.dir_fixture('image') +test.run() +test.fail_test('main.o' not in test.stdout()) +test.run(arguments='change=1') +test.fail_test('is up to date' in test.stdout()) + +test.pass_test() diff --git a/test/D/Issues/2944/image/SConstruct b/test/D/Issues/2944/image/SConstruct new file mode 100644 index 00000000..2c7deee1 --- /dev/null +++ b/test/D/Issues/2944/image/SConstruct @@ -0,0 +1,11 @@ +# -*- codig:utf-8; -*- + +env=Environment() + +change = ARGUMENTS.get('change', 0) +if int(change): + env.Append(DFLAGS = '-d') + +env.Program('proj', ['main.d']) + + diff --git a/test/D/Issues/2944/image/main.d b/test/D/Issues/2944/image/main.d new file mode 100644 index 00000000..f0aa23aa --- /dev/null +++ b/test/D/Issues/2944/image/main.d @@ -0,0 +1,11 @@ +/* This program prints a + hello world message + to the console. */ + +import std.stdio; + +void main() +{ + writeln("Hello, World!"); +} + diff --git a/test/D/MixedDAndC/Common/common.py b/test/D/MixedDAndC/Common/common.py index b356411d..852e2e2f 100644 --- a/test/D/MixedDAndC/Common/common.py +++ b/test/D/MixedDAndC/Common/common.py @@ -30,7 +30,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons from os.path import abspath, dirname -from platform import machine +from platform import architecture import sys sys.path.insert(1, abspath(dirname(__file__) + '/../../Support')) @@ -46,10 +46,17 @@ def testForTool(tool): test.dir_fixture('Image') - test.run() +# There was an issue with Russel mentioned but couldn't remember the details +# Which drove him to add the following logic. For now removing until +# we can determine what that issue is and if there's not a better +# way to handle the corner case +# if architecture()[0] == '32bit': +# test.run(status=2) +# test.fail_test('64-bit mode not compiled in' not in test.stderr()) +# else: +# test.run() - if machine() in ('i386',): - test.fail_test('64-bit mode not compiled in' not in test.stdout()) + test.run() test.pass_test() diff --git a/test/D/MixedDAndC/Image/SConstruct b/test/D/MixedDAndC/Image/SConstruct index 5cf58a39..176c4d31 100644 --- a/test/D/MixedDAndC/Image/SConstruct +++ b/test/D/MixedDAndC/Image/SConstruct @@ -3,7 +3,10 @@ import os environment = Environment( - DFLAGS=['-m64', '-O']) +) +# CFLAGS=['-m64'], +# DLINKFLAGS=['-m64'], +# DFLAGS=['-m64', '-O']) environment.Program('proj', [ 'proj.d', diff --git a/test/option/debug-count.py b/test/option/debug-count.py index 3f8a23c0..39c12224 100644 --- a/test/option/debug-count.py +++ b/test/option/debug-count.py @@ -28,6 +28,7 @@ Test that the --debug=count option works. """ import re +import sys import TestSCons @@ -85,11 +86,13 @@ scons: warning: --debug=count is not supported when running SCons \twith the python -O option or optimized \\(.pyo\\) modules. """ + TestSCons.file_expr -test.run(arguments = '--debug=count -h', - interpreter = ['python', '-O'], - stderr = expect_warning, - match = TestSCons.match_re) - +test.run( + arguments = '--debug=count -h', + # Test against current interpreter vs default path option. + interpreter = [ sys.executable, '-O' ], + stderr = expect_warning, + match = TestSCons.match_re +) test.pass_test() diff --git a/test/site_scons/override.py b/test/site_scons/override.py index ad03eaeb..e33bb888 100644 --- a/test/site_scons/override.py +++ b/test/site_scons/override.py @@ -48,7 +48,7 @@ def exists(env): """) test.write('SConstruct', """ -e=Environment() +e=Environment(tools=['m4']) print e.subst('M4 is $M4, M4_MINE is $M4_MINE') """) test.run(arguments = '-Q .', |