From 3c785d3842e5cfd41689782d1e6425e0f6fd0f7f Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sun, 6 Jan 2019 13:32:45 -0700 Subject: Work on Default docu wording a bit more An earlier change updated some examples, this makes some tweaks to the wording as well for Default, DEFAULT_TARGETS, etc. to clarify. Signed-off-by: Mats Wichmann --- doc/man/scons.xml | 2 +- doc/user/command-line.xml | 18 ++++++++++-------- src/CHANGES.txt | 2 ++ src/engine/SCons/Script/SConscript.xml | 4 ++++ 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/doc/man/scons.xml b/doc/man/scons.xml index 805164c..caeb2b1 100644 --- a/doc/man/scons.xml +++ b/doc/man/scons.xml @@ -274,7 +274,7 @@ scons will build all target files in or below the current directory. Explicit default targets (to be built when no targets are specified on the command line) -may be defined the SConscript file(s) +may be defined in the SConscript file(s) using the Default() function, described below. diff --git a/doc/user/command-line.xml b/doc/user/command-line.xml index 1b329e7..d129d2e 100644 --- a/doc/user/command-line.xml +++ b/doc/user/command-line.xml @@ -1987,17 +1987,16 @@ foo.c - One of the most basic things you can control - is which targets &SCons; will build by default--that is, + You can control + which targets &SCons; will build by default - that is, when there are no targets specified on the command line. As mentioned previously, &SCons; will normally build every target - in or below the current directory - by default--that is, when you don't + in or below the current directory unless you explicitly specify one or more targets on the command line. Sometimes, however, you may want - to specify explicitly that only + to specify that only certain programs, or programs in certain directories, should be built by default. You do this with the &Default; function: @@ -2193,7 +2192,8 @@ prog2.c &SCons; supports a &DEFAULT_TARGETS; variable - that lets you get at the current list of default targets. + that lets you get at the current list of default targets + specified by calls to the &Default; function or method. The &DEFAULT_TARGETS; variable has two important differences from the &COMMAND_LINE_TARGETS; variable. First, the &DEFAULT_TARGETS; variable is a list of @@ -2233,7 +2233,7 @@ prog1.c Second, - the contents of the &DEFAULT_TARGETS; list change + the contents of the &DEFAULT_TARGETS; list changes in response to calls to the &Default; function, as you can see from the following &SConstruct; file: @@ -2351,7 +2351,9 @@ prog2.c Notice how the value of &BUILD_TARGETS; changes depending on whether a target is - specified on the command line: + specified on the command line - &BUILD_TARGETS; + takes from &DEFAULT_TARGETS; + only if there are no &COMMAND_LINE_TARGETS;: diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 840359c..01dda95 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -16,6 +16,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER product from the default Visual Studio - Add TEMPFILESUFFIX to allow a customizable filename extension, as described in the patch attached to issue #2431. + - Doc updates around Default(), and the various *TARGETS variables. From Daniel Moody: - Improved support for VC14.1 and Visual Studio 2017, as well as arm and arm64 targets. @@ -25,6 +26,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Enhance cpp scanner regex logic to detect if/elif expressions without whitespaces but parenthesis like "#if(defined FOO)" or "#elif!(BAR)" correctly. + RELEASE 3.0.3 - Mon, 07 Jan 2019 20:05:22 -0400 NOTE: 3.0.2 release was dropped because there was a packaging bug. Please consider all 3.0.2 content. diff --git a/src/engine/SCons/Script/SConscript.xml b/src/engine/SCons/Script/SConscript.xml index a6258c4..330a56c 100644 --- a/src/engine/SCons/Script/SConscript.xml +++ b/src/engine/SCons/Script/SConscript.xml @@ -38,6 +38,10 @@ Multiple calls to &f-Default; are legal, and add to the list of default targets. +As noted above, both forms of this call affect the +same global list of default targets; the +construction environment method applies +construction variable expansion to the targets. -- cgit v0.12 From 15d275627e2a6ee154396e2768cb77aa82a7dd04 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 30 Jan 2019 13:32:38 -0800 Subject: Add test to check for configure calling configured decider not handling DeciderNeedsNode exception which can be thrown by MD5-Timestamp decider logic --- test/Configure/option--config.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/Configure/option--config.py b/test/Configure/option--config.py index 1f40a80..09430d2 100644 --- a/test/Configure/option--config.py +++ b/test/Configure/option--config.py @@ -122,6 +122,25 @@ test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", [((".c", CR), (_obj, NCR))]], "config.log", ".sconf_temp", "SConstruct") + +# Check the combination of --config=force and Decider('MD5-timestamp') +# On second run there was an issue where the decider would throw DeciderNeedsNode +# exception which the configure code didn't handle. +SConstruct_path = test.workpath('SConstruct') +test.write(SConstruct_path, """ +env = Environment() +env.Decider('MD5-timestamp') +conf = Configure(env) +conf.TryLink('int main(){return 0;}','.c') +env = conf.Finish() +""") +test.run(arguments='--config=force') +# On second run the sconsign is loaded and decider doesn't just indicate need to rebuild +test.run(arguments='--config=force') +test.must_not_contain(test.workpath('config.log'),"TypeError: 'NoneType' object is not callable") + + + test.pass_test() # Local Variables: -- cgit v0.12 From 48a7fddf3f2cbd628cc2270926268a64a1501222 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 30 Jan 2019 13:33:19 -0800 Subject: handle exceptions slightly better --- src/engine/SCons/Job.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/SCons/Job.py b/src/engine/SCons/Job.py index c0e80b1..3720ca2 100644 --- a/src/engine/SCons/Job.py +++ b/src/engine/SCons/Job.py @@ -199,7 +199,7 @@ class Serial(object): task.prepare() if task.needs_execute(): task.execute() - except: + except Exception as e: if self.interrupted(): try: raise SCons.Errors.BuildError( -- cgit v0.12 From 533bef13e179053fe56a1e5e504aa080f353ed3d Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 30 Jan 2019 13:33:58 -0800 Subject: Fix configure logic calling configured decider not handling DeciderNeedsNode exception which can be thrown by MD5-Timestamp decider logic --- src/engine/SCons/SConf.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py index 0dcbab8..f23c401 100644 --- a/src/engine/SCons/SConf.py +++ b/src/engine/SCons/SConf.py @@ -56,6 +56,7 @@ import SCons.Warnings import SCons.Conftest from SCons.Debug import Trace +from SCons.Node import DeciderNeedsNode # Turn off the Conftest error logging SCons.Conftest.LogInputFiles = 0 @@ -330,8 +331,14 @@ class SConfBuildTask(SCons.Taskmaster.AlwaysTask): # that the correct .sconsign info will get calculated # and keep the build state consistent. def force_build(dependency, target, prev_ni, - env_decider=env.decide_source): - env_decider(dependency, target, prev_ni) + env_decider=env.decide_source, + node=None): + try: + env_decider(dependency, target, prev_ni) + except DeciderNeedsNode as e: + e.decider(target, prev_ni, node=target) + except Exception as e: + raise e return True if env.decide_source.__code__ is not force_build.__code__: env.Decider(force_build) -- cgit v0.12 From bd2441310379b8009f1ebdc723ff23bb75cc3eb5 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 30 Jan 2019 14:07:55 -0800 Subject: Update src/CHANGES.txt fix issue #3283 --- src/CHANGES.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index b563593..c6d7191 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -7,9 +7,13 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - From John Doe: + From William Deegan: - - Whatever John Doe did. + - Fix Issue #3283 - Handle using --config=force in combination with Decider('MD5-timestamp'). + 3.0.2 in fix for issue #2980 added that deciders can throw DeciderNeedsNode exception. + The Configure logic directly calls the decider when using --config=force but wasn't handling + that exception. This would yield minimally configure tests using TryLink() not running and + leaving TypeError Nonetype exception in config.log From Daniel Moody: - Change the default for AppendENVPath to delete_existing=0, so path -- cgit v0.12 From 2860462520f2e0ea0c5ccd5090fbefaef47e66e8 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Fri, 1 Feb 2019 17:59:28 -0500 Subject: Fix new test binary/text read issue for py3.5+. Changed mode to 'r' as just plain part of a line --- test/Configure/option--config.py | 81 +++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 42 deletions(-) diff --git a/test/Configure/option--config.py b/test/Configure/option--config.py index 09430d2..80a8bcd 100644 --- a/test/Configure/option--config.py +++ b/test/Configure/option--config.py @@ -39,9 +39,9 @@ test = TestSCons.TestSCons() test.subdir('include') NCR = test.NCR # non-cached rebuild -CR = test.CR # cached rebuild (up to date) +CR = test.CR # cached rebuild (up to date) NCF = test.NCF # non-cached build failure -CF = test.CF # cached build failure +CF = test.CF # cached build failure SConstruct_path = test.workpath('SConstruct') @@ -70,36 +70,36 @@ scons: *** "%(conftest_0_c)s" is not yet built and cache is forced. test.run(arguments='--config=cache', status=2, stderr=expect) test.run(arguments='--config=auto') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["yes", "no"], - [[((".c", NCR), (_obj, NCR))], - [((".c", NCR), (_obj, NCF))]], - "config.log", ".sconf_temp", "SConstruct") +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["yes", "no"], + [[((".c", NCR), (_obj, NCR))], + [((".c", NCR), (_obj, NCF))]], + "config.log", ".sconf_temp", "SConstruct") test.run(arguments='--config=auto') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["yes", "no"], - [[((".c", CR), (_obj, CR))], - [((".c", CR), (_obj, CF))]], - "config.log", ".sconf_temp", "SConstruct") +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["yes", "no"], + [[((".c", CR), (_obj, CR))], + [((".c", CR), (_obj, CF))]], + "config.log", ".sconf_temp", "SConstruct") test.run(arguments='--config=force') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["yes", "no"], - [[((".c", NCR), (_obj, NCR))], - [((".c", NCR), (_obj, NCF))]], - "config.log", ".sconf_temp", "SConstruct") +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["yes", "no"], + [[((".c", NCR), (_obj, NCR))], + [((".c", NCR), (_obj, NCF))]], + "config.log", ".sconf_temp", "SConstruct") test.run(arguments='--config=cache') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["yes", "no"], - [[((".c", CR), (_obj, CR))], - [((".c", CR), (_obj, CF))]], - "config.log", ".sconf_temp", "SConstruct") +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["yes", "no"], + [[((".c", CR), (_obj, CR))], + [((".c", CR), (_obj, CF))]], + "config.log", ".sconf_temp", "SConstruct") test.write(['include', 'non_system_header1.h'], """ /* Another header */ @@ -107,21 +107,20 @@ test.write(['include', 'non_system_header1.h'], """ test.unlink(['include', 'non_system_header0.h']) test.run(arguments='--config=cache') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["yes", "no"], - [[((".c", CR), (_obj, CR))], - [((".c", CR), (_obj, CF))]], - "config.log", ".sconf_temp", "SConstruct") +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["yes", "no"], + [[((".c", CR), (_obj, CR))], + [((".c", CR), (_obj, CF))]], + "config.log", ".sconf_temp", "SConstruct") test.run(arguments='--config=auto') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["no", "yes"], - [[((".c", CR), (_obj, NCF))], - [((".c", CR), (_obj, NCR))]], - "config.log", ".sconf_temp", "SConstruct") - +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["no", "yes"], + [[((".c", CR), (_obj, NCF))], + [((".c", CR), (_obj, NCR))]], + "config.log", ".sconf_temp", "SConstruct") # Check the combination of --config=force and Decider('MD5-timestamp') # On second run there was an issue where the decider would throw DeciderNeedsNode @@ -137,9 +136,7 @@ env = conf.Finish() test.run(arguments='--config=force') # On second run the sconsign is loaded and decider doesn't just indicate need to rebuild test.run(arguments='--config=force') -test.must_not_contain(test.workpath('config.log'),"TypeError: 'NoneType' object is not callable") - - +test.must_not_contain(test.workpath('config.log'), "TypeError: 'NoneType' object is not callable", mode='r') test.pass_test() -- cgit v0.12 From dc4b8ba81d9077c86aea6fce4cd0814111339037 Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Mon, 4 Feb 2019 12:04:27 -0600 Subject: update m4 test to use mingw on windows and not pass if m4 doesn't exist --- test/M4/M4.py | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/test/M4/M4.py b/test/M4/M4.py index 82c084c..1f5c679 100644 --- a/test/M4/M4.py +++ b/test/M4/M4.py @@ -36,8 +36,6 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - test.write('mym4.py', """ import sys contents = sys.stdin.read() @@ -60,23 +58,16 @@ line 3 test.run() -import sys - -if sys.platform == 'win32': - # Handle carriage returns. - test.must_match(test.workpath('aaa.x'), "line 1\r\nmym4.py\r\nline 3\r\n") -else: - test.must_match(test.workpath('aaa.x'), "line 1\nmym4.py\nline 3\n") - - +test.must_match(test.workpath('aaa.x'), os.linesep.join(["line 1", "mym4.py", "line 3", ""])) m4 = test.where_is('m4') -if m4: +if not m4: + test.skip_test('M4 not found found; skipping test.\n') - test.file_fixture('wrapper.py') +test.file_fixture('wrapper.py') - test.write('SConstruct', """ +test.write('SConstruct', """ DefaultEnvironment(tools=[]) foo = Environment(tools=['m4'], M4=r'%(m4)s', M4FLAGS='-DFFF=fff') @@ -87,23 +78,18 @@ foo.M4(target = 'foo.x', source = 'foo.x.m4') bar.M4(target = 'bar', source = 'bar.m4') """ % locals()) - test.write('foo.x.m4', "line 1\n" - "FFF\n" - "line 3\n") - - test.write('bar.m4', "line 1\n" - "BBB\n" - "line 3\n") +test.write('foo.x.m4', os.linesep.join(["line 1", "FFF", "line 3"])) - test.run(arguments = '.') +test.write('bar.m4', os.linesep.join(["line 1", "BBB", "line 3"])) - test.up_to_date(arguments = '.') +test.run(arguments = '.') +test.up_to_date(arguments = '.') - test.must_match('wrapper.out', "wrapper.py\n") +test.must_match('wrapper.out', "wrapper.py\n") - test.must_match('foo.x', "line 1\nfff\nline 3\n") +test.must_match('foo.x', os.linesep.join(["line 1", "fff", "line 3"])) - test.must_match('bar', "line 1\nbbb\nline 3\n") +test.must_match('bar', os.linesep.join(["line 1", "bbb", "line 3"])) test.pass_test() -- cgit v0.12 From aabd8be12936101ee73e328964e8e00ddfd153d2 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 4 Feb 2019 16:59:41 -0700 Subject: Pretty-print msvs.xml Doc file had large sections in not very readable format, with lots of tags on single line, etc. Ran through a formatting tool and did some manual fixups. Signed-off-by: Mats Wichmann --- src/engine/SCons/Tool/msvs.xml | 963 ++++++++++++++++++++++++----------------- 1 file changed, 563 insertions(+), 400 deletions(-) diff --git a/src/engine/SCons/Tool/msvs.xml b/src/engine/SCons/Tool/msvs.xml index c4701e1..2292522 100644 --- a/src/engine/SCons/Tool/msvs.xml +++ b/src/engine/SCons/Tool/msvs.xml @@ -17,160 +17,212 @@ See its __doc__ string for a discussion of the format. %variables-mod; ]> - -Sets construction variables for Microsoft Visual Studio. - MSVSPROJECTCOM MSVSSOLUTIONCOM -MSVSSCONSCRIPT MSVSSCONS MSVSSCONSFLAGS -MSVSSCONSCOM MSVSBUILDCOM -MSVSREBUILDCOM MSVSCLEANCOM -MSVSENCODING Builds a Microsoft Visual Studio project -file, and by default builds a solution file as well. 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 .dsp file. For Visual -Studio 7 (.NET) and later versions, it will generate a -.vcproj file. By default, this also -generates a solution file for the specified project, a -.dsw file for Visual Studio 6 or a -.sln file for Visual Studio 7 (.NET). This behavior may -be disabled by specifying auto_build_solution=0 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). -The &b-MSVSProject; builder takes several lists of filenames to be placed into -the project file. These are currently limited to srcs, -incs, localincs, -resources, and misc. 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. The above -filename lists are all optional, although at least one must be specified for -the resulting project file to be non-empty. In addition to the -above lists of values, the following values may be specified: - - - target - - - The name of the target .dsp or - .vcproj 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). - - - - - variant - - - 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 | - (vertical pipe) character: Debug|Xbox. 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. - - - - - cmdargs - - - Additional command line arguments for the different - variants. The number of cmdargs entries must match - the number of variant entries, or be empty (not - specified). If you give only one, it will automatically be propagated - to all variants. - - - - - buildtarget - - - 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 - buildtarget entries must match the number of - variant entries. - - - - - runfile - - - The name of the file that Visual Studio 7 and later will - run and debug. This appears as the value of the - Output field in the resulting Visual Studio project - file. If this is not specified, the default is the same as the - specified buildtarget value. - - - 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++ /FC -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. - Example usage: - + + + + Sets construction variables for Microsoft Visual Studio. + + + MSVSPROJECTCOM + MSVSSOLUTIONCOM + MSVSSCONSCRIPT + MSVSSCONS + MSVSSCONSFLAGS + MSVSSCONSCOM + MSVSBUILDCOM + MSVSREBUILDCOM + MSVSCLEANCOM + MSVSENCODING + + + + + + + Builds a Microsoft Visual Studio project file, and by default + builds a solution file as well. + + + 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 .dsp + file. For Visual Studio 7 (.NET) and later versions, it will + generate a .vcproj file. + + + By default, this also generates a solution file for the + specified project, a .dsw file for + Visual Studio 6 or a .sln file for + Visual Studio 7 (.NET). This behavior may be disabled by + specifying auto_build_solution=0 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). + + + The &b-MSVSProject; builder takes several lists of filenames + to be placed into the project file. These are currently + limited to srcs, incs, + localincs, resources, and + misc. 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. + + + The above filename lists are all optional, although at least + one must be specified for the resulting project file to + be non-empty. + + + In addition to the above lists of values, the following values + may be specified: + + + + target + + + The name of the target .dsp + or .vcproj 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). + + + + + variant + + + 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 | + (vertical pipe) character: Debug|Xbox. + 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. + + + + + cmdargs + + + Additional command line arguments + for the different variants. The number of + cmdargs entries must match the number + of variant entries, or be empty (not + specified). If you give only one, it will automatically + be propagated to all variants. + + + + + buildtarget + + + 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 + buildtarget entries must match the + number of variant entries. + + + + + runfile + + + The name of the file that Visual Studio 7 and + later will run and debug. This appears as the + value of the Output field in the + resulting Visual Studio project file. If this is not + specified, the default is the same as the specified + buildtarget value. + + + + + + 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++ /FC + 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. + + Example usage: + barsrcs = ['bar.cpp'] barincs = ['bar.h'] barlocalincs = ['StdAfx.h'] barresources = ['bar.rc','resource.h'] barmisc = ['bar_readme.txt'] -dll = env.SharedLibrary(target = 'bar.dll', - source = barsrcs) +dll = env.SharedLibrary(target='bar.dll', + source=barsrcs) buildtarget = [s for s in dll if str(s).endswith('dll')] -env.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'], - srcs = barsrcs, - incs = barincs, - localincs = barlocalincs, - resources = barresources, - misc = barmisc, - buildtarget = buildtarget, - variant = 'Release') - -Starting with version 2.4 of -SCons it's also possible to specify the optional argument -DebugSettings, which creates files for debugging under -Visual Studio: - - DebugSettings - - - A dictionary of debug settings that get written to the - .vcproj.user or the - .vcxproj.user file, depending on the version - installed. As it is done for cmdargs (see above), you can specify a - DebugSettings dictionary per variant. If you - give only one, it will be propagated to all variants. - - - 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 -DebugSettings 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.Following -is a more contrived example, involving the setup of a project for variants and -DebugSettings:# Assuming you store your defaults in a file +env.MSVSProject(target='Bar' + env['MSVSPROJECTSUFFIX'], + srcs=barsrcs, + incs=barincs, + localincs=barlocalincs, + resources=barresources, + misc=barmisc, + buildtarget=buildtarget, + variant='Release') + + + Starting with version 2.4 of SCons it is + also possible to specify the optional argument + DebugSettings, which creates files + for debugging under Visual Studio: + + + + DebugSettings + + + A dictionary of debug settings that get written + to the .vcproj.user or the + .vcxproj.user file, depending on the + version installed. As it is done for cmdargs (see above), + you can specify a DebugSettings + dictionary per variant. If you give only one, it will + be propagated to all variants. + + + + + + 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 DebugSettings 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. + + + Following is a more contrived example, involving the setup + of a project for variants and DebugSettings: + + +# Assuming you store your defaults in a file vars = Variables('variables.py') msvcver = vars.args.get('vc', '9') @@ -179,7 +231,7 @@ 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") @@ -214,10 +266,10 @@ V9DebugSettings = { } # -# 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 +# 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 = { @@ -249,7 +301,7 @@ V10DebugSettings = { } # -# 3. Select the dictionary you want depending on the version of visual Studio +# 3. Select the dictionary you want depending on the version of visual Studio # Files you want to generate. # if not env.GetOption('userfile'): @@ -258,7 +310,7 @@ elif env.get('MSVC_VERSION', None) == '9.0': dbgSettings = V9DebugSettings elif env.get('MSVC_VERSION', None) == '11.0': dbgSettings = V10DebugSettings -else: +else: dbgSettings = None # @@ -270,251 +322,362 @@ 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, {})) - Builds a Microsoft Visual Studio solution -file. 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 -.dsw file. For Visual Studio 7 (.NET), it will generate a -.sln file. The following values must be -specified: - - target - - - 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). - - - - - variant - - - 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. - - - - - projects - - - 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. - - - Example Usage: -env.MSVSSolution(target = 'Bar' + env['MSVSSOLUTIONSUFFIX'], projects = ['bar' -+ env['MSVSPROJECTSUFFIX']], variant = 'Release') - -When the Microsoft Visual Studio tools are initialized, they set up this -dictionary with the following keys: - - VERSION - - - the version of MSVS being used (can be set via - &cv-link-MSVS_VERSION;) - - - - - VERSIONS - - - the available versions of MSVS installed - - - - - VCINSTALLDIR - - - installed directory of Visual C++ - - - - - VSINSTALLDIR - - - installed directory of Visual Studio - - - - - FRAMEWORKDIR - - - installed directory of the .NET framework - - - - - FRAMEWORKVERSIONS - - - list of installed versions of the .NET framework, sorted - latest to oldest. - - - - - FRAMEWORKVERSION - - - latest installed version of the .NET - framework - - - - - FRAMEWORKSDKDIR - - - installed location of the .NET SDK. - - - - - PLATFORMSDKDIR - - - installed location of the Platform SDK. - - - - - PLATFORMSDK_MODULES - - - 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. - - - If a value isn't set, it wasn't available in the -registry. Sets -the architecture for which the generated project(s) should build. -The default value is x86. amd64 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. The string placed in a generated +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, {})) + + + + + + Builds a Microsoft Visual Studio solution file. + + 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 .dsw + file. For Visual Studio 7 (.NET), it will generate a + .sln file. + + The following values must be specified: + + + target + + + 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). + + + + variant + + 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. + + + + projects + + 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. + + + + + Example Usage: + +env.MSVSSolution(target='Bar' + env['MSVSSOLUTIONSUFFIX'], projects=['bar' + env['MSVSPROJECTSUFFIX']], variant='Release') + + + + + + When the Microsoft Visual Studio tools are initialized, + they set up this dictionary with the following keys: + + + + VERSION + the version of MSVS being used (can be set via + &cv-link-MSVS_VERSION;) + + + VERSIONS + the available versions of MSVS installed + + + VCINSTALLDIR + installed directory of Visual C++ + + + VSINSTALLDIR + installed directory of Visual Studio + + + FRAMEWORKDIR + installed directory of the .NET framework + + + FRAMEWORKVERSIONS + + list of installed versions of the .NET framework, + sorted latest to oldest. + + + + + FRAMEWORKVERSION + + latest installed version of the .NET framework + + + + FRAMEWORKSDKDIR + + installed location of the .NET SDK. + + + + PLATFORMSDKDIR + + installed location of the Platform SDK. + + + + PLATFORMSDK_MODULES + + + 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. + + + + + If a value is not set, it was not available in the registry. + + + + Sets the architecture for which the generated project(s) + should build. + The default value is x86. + amd64 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. + + + + + + The string placed in a generated Microsoft Visual Studio project file as the value of the -ProjectGUID attribute. There is no default value. If not -defined, a new GUID is generated. The path name placed in a generated + ProjectGUID attribute. There is no default + value. If not +defined, a new GUID is generated. + + + + + + + The path name placed in a generated Microsoft Visual Studio project file as the value of the -SccAuxPath attribute if the -MSVS_SCC_PROVIDER construction variable is also set. There is -no default value. 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 -SccLocalPath attribute of the project file and as the -values of the -SccProjectFilePathRelativizedFromConnection[i] (where [i] -ranges from 0 to the number of projects in the solution) attributes of the -GlobalSection(SourceCodeControl) section of the Microsoft -Visual Studio solution file. Similarly the relative solution file path is -placed as the values of the SccLocalPath[i] (where [i] -ranges from 0 to the number of projects in the solution) attributes of the -GlobalSection(SourceCodeControl) section of the Microsoft -Visual Studio solution file. This is used only if the -MSVS_SCC_PROVIDER construction variable is also set. The -default value is the current working directory. - The project name placed in -a generated Microsoft Visual Studio project file as the value of the -SccProjectName attribute if the -MSVS_SCC_PROVIDER construction variable is also set. In this -case the string is also placed in the SccProjectName0 -attribute of the GlobalSection(SourceCodeControl) section -of the Microsoft Visual Studio solution file. There is no default value. - The -string placed in a generated Microsoft Visual Studio project file as the value -of the SccProvider attribute. The string is also placed in -the SccProvider0 attribute of the -GlobalSection(SourceCodeControl) section of the Microsoft -Visual Studio solution file. There is no default value. - Sets the preferred version -of Microsoft Visual Studio to use. 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 -MSVS_VERSION 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. -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. -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. - 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. - The encoding string placed in a -generated Microsoft Visual Studio project file. The default is encoding -Windows-1252. The action used to generate Microsoft -Visual Studio project files. The suffix used for Microsoft Visual -Studio project (DSP) files. The default value is .vcproj -when using Visual Studio version 7.x (.NET) or later version, and -.dsp when using earlier versions of Visual Studio. - 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. -The SCons used in generated Microsoft Visual Studio project files. The -default is the version of SCons being used to generate the project file. - The -SCons flags used in generated Microsoft Visual Studio project files. - The default -SCons command used in generated Microsoft Visual Studio project files. - 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. The action used to generate Microsoft -Visual Studio solution files. The suffix used for Microsoft -Visual Studio solution (DSW) files. The default value is -.sln when using Visual Studio version 7.x (.NET), and -.dsw when using earlier versions of Visual Studio. - 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. + SccAuxPath attribute if the + MSVS_SCC_PROVIDER construction variable is + also set. There is +no default value. + + + + + + + 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 SccLocalPath + attribute of the project file and as the values of the + SccProjectFilePathRelativizedFromConnection[i] + (where [i] ranges from 0 to the number of projects in the solution) + attributes of the GlobalSection(SourceCodeControl) + section of the Microsoft Visual Studio solution file. Similarly + the relative solution file path is placed as the values of the + SccLocalPath[i] (where [i] ranges from 0 + to the number of projects in the solution) attributes of the + GlobalSection(SourceCodeControl) section of + the Microsoft Visual Studio solution file. This is used only if + the MSVS_SCC_PROVIDER construction variable is + also set. The default value is the current working directory. + + + + + + The project name placed in a generated Microsoft + Visual Studio project file as the value of the + SccProjectName attribute if the + MSVS_SCC_PROVIDER construction variable + is also set. In this case the string is also placed in + the SccProjectName0 attribute of the + GlobalSection(SourceCodeControl) section + of the Microsoft Visual Studio solution file. There is no + default value. + + + + + + The string placed in a generated Microsoft + Visual Studio project file as the value of the + SccProvider attribute. The string is + also placed in the SccProvider0 attribute + of the GlobalSection(SourceCodeControl) + section of the Microsoft Visual Studio solution file. There + is no default value. + + + + + Sets the preferred version of Microsoft Visual Studio to use. + + 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 MSVS_VERSION 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. + + + 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. + + + + + + + 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. + + + + + + + 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. + + + + + + The encoding string placed in a generated Microsoft + Visual Studio project file. The default is encoding + Windows-1252. + + + + + + The action used to generate Microsoft Visual Studio project files. + + + + + + The suffix used for Microsoft Visual Studio project (DSP) + files. The default value is .vcproj + when using Visual Studio version 7.x (.NET) or later version, + and .dsp when using earlier versions of + Visual Studio. + + + + + + + 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. + + + + + + + + The SCons used in generated Microsoft Visual Studio project + files. The default is the version of SCons being used to + generate the project file. + + + + + + + The SCons flags used in generated Microsoft Visual Studio project files. + + + + + + + The default SCons command used in generated Microsoft Visual + Studio project files. + + + + + + + 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. + + + + + + The action used to generate Microsoft Visual Studio solution files. + + + + + The suffix used for Microsoft Visual Studio solution (DSW) + files. The default value is .sln + when using Visual Studio version 7.x (.NET), and + .dsw when using earlier versions of + Visual Studio. + + + + + + + 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. + + + + -- cgit v0.12 From 68069af22c502e61439b006a1c6e0d2431f20949 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Feb 2019 21:21:16 -0600 Subject: fix for case where nothing is return from vswhere --- src/engine/SCons/Tool/MSCommon/vc.py | 15 +++++---- test/MSVC/no_msvc.py | 51 +++++++++++++++++++++++++++++ test/fixture/no_msvc/no_msvcs_sconstruct.py | 15 +++++++++ test/fixture/no_msvc/no_regs_sconstruct.py | 7 ++++ 4 files changed, 81 insertions(+), 7 deletions(-) create mode 100644 test/MSVC/no_msvc.py create mode 100644 test/fixture/no_msvc/no_msvcs_sconstruct.py create mode 100644 test/fixture/no_msvc/no_regs_sconstruct.py diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index c4ba803..0393885 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -298,13 +298,14 @@ def find_vc_pdir_vswhere(msvc_version): if os.path.exists(vswhere_path): sp = subprocess.Popen(vswhere_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) vsdir, err = sp.communicate() - vsdir = vsdir.decode("mbcs").splitlines() - # vswhere could easily return multiple lines - # we could define a way to pick the one we prefer, but since - # this data is currently only used to make a check for existence, - # returning the first hit should be good enough for now. - vc_pdir = os.path.join(vsdir[0], 'VC') - return vc_pdir + if vsdir: + vsdir = vsdir.decode("mbcs").splitlines() + # vswhere could easily return multiple lines + # we could define a way to pick the one we prefer, but since + # this data is currently only used to make a check for existence, + # returning the first hit should be good enough for now. + vc_pdir = os.path.join(vsdir[0], 'VC') + return vc_pdir else: # No vswhere on system, no install info available return None diff --git a/test/MSVC/no_msvc.py b/test/MSVC/no_msvc.py new file mode 100644 index 0000000..d1161c6 --- /dev/null +++ b/test/MSVC/no_msvc.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test scons when no MSVCs are present. +""" + +import sys + +import TestSCons + +test = TestSCons.TestSCons() + +if sys.platform != 'win32': + test.skip_test("Not win32 platform. Skipping test\n") + +# test find_vc_pdir_vswhere by removing all other VS's reg keys +test.file_fixture('no_msvc/no_regs_sconstruct.py', 'SConstruct') +test.run(arguments='-Q -s', stdout='') + +# test no msvc's +test.file_fixture('no_msvc/no_msvcs_sconstruct.py', 'SConstruct') +test.run(arguments='-Q -s') + +if 'MSVC_VERSION=None' not in test.stdout(): + test.fail_test() + +test.pass_test() \ No newline at end of file diff --git a/test/fixture/no_msvc/no_msvcs_sconstruct.py b/test/fixture/no_msvc/no_msvcs_sconstruct.py new file mode 100644 index 0000000..e0b59e6 --- /dev/null +++ b/test/fixture/no_msvc/no_msvcs_sconstruct.py @@ -0,0 +1,15 @@ +import SCons +import SCons.Tool.MSCommon + +def DummyVsWhere(msvc_version): + # not testing versions with vswhere, so return none + return None + +for key in SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR: + SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key]=[(SCons.Util.HKEY_LOCAL_MACHINE, r'')] + +SCons.Tool.MSCommon.vc.find_vc_pdir_vswhere = DummyVsWhere + +env = SCons.Environment.Environment() + +print('MSVC_VERSION='+str(env.get('MSVC_VERSION'))) \ No newline at end of file diff --git a/test/fixture/no_msvc/no_regs_sconstruct.py b/test/fixture/no_msvc/no_regs_sconstruct.py new file mode 100644 index 0000000..3eeca94 --- /dev/null +++ b/test/fixture/no_msvc/no_regs_sconstruct.py @@ -0,0 +1,7 @@ +import SCons +import SCons.Tool.MSCommon + +for key in SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR: + SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key]=[(SCons.Util.HKEY_LOCAL_MACHINE, r'')] + +env = SCons.Environment.Environment() \ No newline at end of file -- cgit v0.12 From 6a61fae91aa90f985294674852ecf2e569bf6b6e Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Feb 2019 22:19:03 -0600 Subject: update CHANGES.txt --- src/CHANGES.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 5fa5eab..bea98d1 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -18,6 +18,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER From Daniel Moody: - Change the default for AppendENVPath to delete_existing=0, so path order will not be changed, unless explicitly set (Issue #3276) + - fix bug where no msvc's are found and an empty list is indexed From Mats Wichmann: - Quiet open file ResourceWarnings on Python >= 3.6 caused by -- cgit v0.12 From b1bfa3bf999c7b9ae7ac971c2bd6d7c181a4684f Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Feb 2019 00:14:56 -0600 Subject: add sconstest.skip for test fixtures --- test/fixture/no_msvc/sconstest.skip | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test/fixture/no_msvc/sconstest.skip diff --git a/test/fixture/no_msvc/sconstest.skip b/test/fixture/no_msvc/sconstest.skip new file mode 100644 index 0000000..e69de29 -- cgit v0.12 From 441732b3b9fe8d2a47e8778c512b1c47d276fcfb Mon Sep 17 00:00:00 2001 From: William Deegan Date: Tue, 5 Feb 2019 12:08:40 -0500 Subject: [ci skip] update bugfix description --- src/CHANGES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index bea98d1..8bdafe7 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -18,7 +18,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER From Daniel Moody: - Change the default for AppendENVPath to delete_existing=0, so path order will not be changed, unless explicitly set (Issue #3276) - - fix bug where no msvc's are found and an empty list is indexed + - Fixed bug which threw error when running SCons on windows system with no MSVC installed. From Mats Wichmann: - Quiet open file ResourceWarnings on Python >= 3.6 caused by -- cgit v0.12 From 9556926b4113f2db91e1cf493c778b01edc03589 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Tue, 5 Feb 2019 11:41:24 -0700 Subject: PR #3289: add generated docs The three generated doc files, builders.gen, tools,gen and variables.gen are added to stay in sync with the msvs.xml change. Signed-off-by: Mats Wichmann --- doc/generated/builders.gen | 459 ++++++++++++++++++++++------------------ doc/generated/tools.gen | 17 +- doc/generated/variables.gen | 502 ++++++++++++++++++++++++-------------------- 3 files changed, 544 insertions(+), 434 deletions(-) diff --git a/doc/generated/builders.gen b/doc/generated/builders.gen index 680f72f..6f03cd3 100644 --- a/doc/generated/builders.gen +++ b/doc/generated/builders.gen @@ -838,148 +838,192 @@ Compile files for languages defined in LINGUAS file env.MSVSProject() - Builds a Microsoft Visual Studio project -file, and by default builds a solution file as well. 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 $MSVS_VERSION in the Environment constructor). For -Visual Studio 6, it will generate a .dsp file. For Visual -Studio 7 (.NET) and later versions, it will generate a -.vcproj file. By default, this also -generates a solution file for the specified project, a -.dsw file for Visual Studio 6 or a -.sln file for Visual Studio 7 (.NET). This behavior may -be disabled by specifying auto_build_solution=0 when you -call MSVSProject, in which case you presumably want to build the solution -file(s) by calling the MSVSSolution Builder (see below). -The MSVSProject builder takes several lists of filenames to be placed into -the project file. These are currently limited to srcs, -incs, localincs, -resources, and misc. These are pretty -self-explanatory, but it should be noted that these lists are added to the -$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. The above -filename lists are all optional, although at least one must be specified for -the resulting project file to be non-empty. In addition to the -above lists of values, the following values may be specified: - - - target - - - The name of the target .dsp or - .vcproj file. The correct suffix for the version - of Visual Studio must be used, but the $MSVSPROJECTSUFFIX - construction variable will be defined to the correct value (see - example below). - - - - - variant - - - 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 | - (vertical pipe) character: Debug|Xbox. The default - target platform is Win32. Multiple calls to MSVSProject with - different variants are allowed; all variants will be added to the - project file with their appropriate build targets and - sources. - - - - - cmdargs - - - Additional command line arguments for the different - variants. The number of cmdargs entries must match - the number of variant entries, or be empty (not - specified). If you give only one, it will automatically be propagated - to all variants. - - - - - buildtarget - - - 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 - buildtarget entries must match the number of - variant entries. - - - - - runfile - - - The name of the file that Visual Studio 7 and later will - run and debug. This appears as the value of the - Output field in the resulting Visual Studio project - file. If this is not specified, the default is the same as the - specified buildtarget value. - - - 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++ /FC -compiler option to the $CCFLAGS variable so that the compiler will -print the full path name of any files that cause compilation errors. - Example usage: - + + + Builds a Microsoft Visual Studio project file, and by default + builds a solution file as well. + + + 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 + $MSVS_VERSION in the Environment constructor). For + Visual Studio 6, it will generate a .dsp + file. For Visual Studio 7 (.NET) and later versions, it will + generate a .vcproj file. + + + By default, this also generates a solution file for the + specified project, a .dsw file for + Visual Studio 6 or a .sln file for + Visual Studio 7 (.NET). This behavior may be disabled by + specifying auto_build_solution=0 when you + call MSVSProject, in which case you presumably want to + build the solution file(s) by calling the MSVSSolution + Builder (see below). + + + The MSVSProject builder takes several lists of filenames + to be placed into the project file. These are currently + limited to srcs, incs, + localincs, resources, and + misc. These are pretty self-explanatory, + but it should be noted that these lists are added to the + $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. + + + The above filename lists are all optional, although at least + one must be specified for the resulting project file to + be non-empty. + + + In addition to the above lists of values, the following values + may be specified: + + + + target + + + The name of the target .dsp + or .vcproj file. + The correct suffix for the version of Visual Studio + must be used, but the $MSVSPROJECTSUFFIX + construction variable will be defined to the correct + value (see example below). + + + + + variant + + + 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 | + (vertical pipe) character: Debug|Xbox. + The default target platform is Win32. Multiple calls + to MSVSProject with different variants are allowed; + all variants will be added to the project file with + their appropriate build targets and sources. + + + + + cmdargs + + + Additional command line arguments + for the different variants. The number of + cmdargs entries must match the number + of variant entries, or be empty (not + specified). If you give only one, it will automatically + be propagated to all variants. + + + + + buildtarget + + + 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 + buildtarget entries must match the + number of variant entries. + + + + + runfile + + + The name of the file that Visual Studio 7 and + later will run and debug. This appears as the + value of the Output field in the + resulting Visual Studio project file. If this is not + specified, the default is the same as the specified + buildtarget value. + + + + + + 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++ /FC + compiler option to the $CCFLAGS variable so that + the compiler will print the full path name of any files that + cause compilation errors. + + Example usage: + barsrcs = ['bar.cpp'] barincs = ['bar.h'] barlocalincs = ['StdAfx.h'] barresources = ['bar.rc','resource.h'] barmisc = ['bar_readme.txt'] -dll = env.SharedLibrary(target = 'bar.dll', - source = barsrcs) +dll = env.SharedLibrary(target='bar.dll', + source=barsrcs) buildtarget = [s for s in dll if str(s).endswith('dll')] -env.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'], - srcs = barsrcs, - incs = barincs, - localincs = barlocalincs, - resources = barresources, - misc = barmisc, - buildtarget = buildtarget, - variant = 'Release') - -Starting with version 2.4 of -SCons it's also possible to specify the optional argument -DebugSettings, which creates files for debugging under -Visual Studio: - - DebugSettings - - - A dictionary of debug settings that get written to the - .vcproj.user or the - .vcxproj.user file, depending on the version - installed. As it is done for cmdargs (see above), you can specify a - DebugSettings dictionary per variant. If you - give only one, it will be propagated to all variants. - - - 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 -DebugSettings 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.Following -is a more contrived example, involving the setup of a project for variants and -DebugSettings:# Assuming you store your defaults in a file +env.MSVSProject(target='Bar' + env['MSVSPROJECTSUFFIX'], + srcs=barsrcs, + incs=barincs, + localincs=barlocalincs, + resources=barresources, + misc=barmisc, + buildtarget=buildtarget, + variant='Release') + + + Starting with version 2.4 of SCons it is + also possible to specify the optional argument + DebugSettings, which creates files + for debugging under Visual Studio: + + + + DebugSettings + + + A dictionary of debug settings that get written + to the .vcproj.user or the + .vcxproj.user file, depending on the + version installed. As it is done for cmdargs (see above), + you can specify a DebugSettings + dictionary per variant. If you give only one, it will + be propagated to all variants. + + + + + + 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 DebugSettings 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. + + + Following is a more contrived example, involving the setup + of a project for variants and DebugSettings: + + +# Assuming you store your defaults in a file vars = Variables('variables.py') msvcver = vars.args.get('vc', '9') @@ -988,7 +1032,7 @@ 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") @@ -1023,10 +1067,10 @@ V9DebugSettings = { } # -# 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 +# 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 = { @@ -1058,7 +1102,7 @@ V10DebugSettings = { } # -# 3. Select the dictionary you want depending on the version of visual Studio +# 3. Select the dictionary you want depending on the version of visual Studio # Files you want to generate. # if not env.GetOption('userfile'): @@ -1067,7 +1111,7 @@ elif env.get('MSVC_VERSION', None) == '9.0': dbgSettings = V9DebugSettings elif env.get('MSVC_VERSION', None) == '11.0': dbgSettings = V10DebugSettings -else: +else: dbgSettings = None # @@ -1079,20 +1123,21 @@ 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, {})) - +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, {})) + + @@ -1101,54 +1146,60 @@ env.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'], env.MSVSSolution() - Builds a Microsoft Visual Studio solution -file. 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 $MSVS_VERSION in the -construction environment). For Visual Studio 6, it will generate a -.dsw file. For Visual Studio 7 (.NET), it will generate a -.sln file. The following values must be -specified: - - target - - - The name of the target .dsw or .sln file. The correct - suffix for the version of Visual Studio must be used, but the value - $MSVSSOLUTIONSUFFIX will be defined to the correct value (see - example below). - - - - - variant - - - 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. - - - - - projects - - - A list of project file names, or Project nodes returned by - calls to the 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. - - - Example Usage: -env.MSVSSolution(target = 'Bar' + env['MSVSSOLUTIONSUFFIX'], projects = ['bar' -+ env['MSVSPROJECTSUFFIX']], variant = 'Release') - + + Builds a Microsoft Visual Studio solution file. + + 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 + $MSVS_VERSION in the construction environment). For + Visual Studio 6, it will generate a .dsw + file. For Visual Studio 7 (.NET), it will generate a + .sln file. + + The following values must be specified: + + + target + + + The name of the target .dsw or .sln file. The correct + suffix for the version of Visual Studio must be used, + but the value $MSVSSOLUTIONSUFFIX will be + defined to the correct value (see example below). + + + + variant + + 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. + + + + projects + + A list of project file names, or Project nodes returned + by calls to the 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. + + + + + Example Usage: + +env.MSVSSolution(target='Bar' + env['MSVSSOLUTIONSUFFIX'], projects=['bar' + env['MSVSPROJECTSUFFIX']], variant='Release') + + diff --git a/doc/generated/tools.gen b/doc/generated/tools.gen index 7661110..88bd11a 100644 --- a/doc/generated/tools.gen +++ b/doc/generated/tools.gen @@ -750,8 +750,9 @@ Sets construction variables for the Microsoft Visual C/C++ compiler. msvs - -Sets construction variables for Microsoft Visual Studio. 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;. + + Sets construction variables for Microsoft Visual Studio. + 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;. mwcc @@ -778,19 +779,19 @@ Sets construction variables for the Sets: &cv-link-AS;, &cv-link-ASCOM;, &cv-link-ASFLAGS;, &cv-link-ASPPCOM;, &cv-link-ASPPFLAGS;.Uses: &cv-link-ASCOMSTR;, &cv-link-ASPPCOMSTR;. - - packaging + + Packaging -A framework for building binary and source packages. +Sets construction variables for the Package Builder. - - Packaging + + packaging -Sets construction variables for the Package Builder. +A framework for building binary and source packages. diff --git a/doc/generated/variables.gen b/doc/generated/variables.gen index 4e84fbc..194fb72 100644 --- a/doc/generated/variables.gen +++ b/doc/generated/variables.gen @@ -3032,15 +3032,6 @@ is -dNOPAUSE -dBATCH -sDEVICE=pdfwrite HOST_ARCH - The name of the host hardware architecture used to create the Environment. - If a platform is specified when creating the Environment, then - that Platform's logic will handle setting this value. - This value is immutable, and should not be changed by the user after - the Environment is initialized. - Currently only set for Win32. - - - Sets the host architecture for Visual Studio compiler. If not set, default to the detected host architecture: note that this may depend on the python you are using. @@ -3056,7 +3047,16 @@ Valid values are the same as for This is currently only used on Windows, but in the future it will be used on other OSes as well. - + + + The name of the host hardware architecture used to create the Environment. + If a platform is specified when creating the Environment, then + that Platform's logic will handle setting this value. + This value is immutable, and should not be changed by the user after + the Environment is initialized. + Currently only set for Win32. + + HOST_OS @@ -3298,7 +3298,7 @@ The command line used to call the Java archive tool. The string displayed when the Java archive tool is called -If this is not set, then $JARCOM (the command line) is displayed. +If this is not set, then $JARCOM (the command line) is displayed. @@ -3308,7 +3308,7 @@ env = Environment(JARCOMSTR = "JARchiving $SOURCES into $TARGET") The string displayed when the Java archive tool is called -If this is not set, then $JARCOM (the command line) is displayed. +If this is not set, then $JARCOM (the command line) is displayed. @@ -4511,254 +4511,308 @@ Versions ending in Exp refer to "Express" or MSVS - -When the Microsoft Visual Studio tools are initialized, they set up this -dictionary with the following keys: - - VERSION - - - the version of MSVS being used (can be set via - $MSVS_VERSION) - - - - - VERSIONS - - - the available versions of MSVS installed - - - - - VCINSTALLDIR - - - installed directory of Visual C++ - - - - - VSINSTALLDIR - - - installed directory of Visual Studio - - - - - FRAMEWORKDIR - - - installed directory of the .NET framework - - - - - FRAMEWORKVERSIONS - - - list of installed versions of the .NET framework, sorted - latest to oldest. - - - - - FRAMEWORKVERSION - - - latest installed version of the .NET - framework - - - - - FRAMEWORKSDKDIR - - - installed location of the .NET SDK. - - - - - PLATFORMSDKDIR - - - installed location of the Platform SDK. - - - - - PLATFORMSDK_MODULES - - - 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. - - - If a value isn't set, it wasn't available in the -registry. + + + When the Microsoft Visual Studio tools are initialized, + they set up this dictionary with the following keys: + + + + VERSION + the version of MSVS being used (can be set via + $MSVS_VERSION) + + + VERSIONS + the available versions of MSVS installed + + + VCINSTALLDIR + installed directory of Visual C++ + + + VSINSTALLDIR + installed directory of Visual Studio + + + FRAMEWORKDIR + installed directory of the .NET framework + + + FRAMEWORKVERSIONS + + list of installed versions of the .NET framework, + sorted latest to oldest. + + + + + FRAMEWORKVERSION + + latest installed version of the .NET framework + + + + FRAMEWORKSDKDIR + + installed location of the .NET SDK. + + + + PLATFORMSDKDIR + + installed location of the Platform SDK. + + + + PLATFORMSDK_MODULES + + + 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. + + + + + If a value is not set, it was not available in the registry. + MSVS_ARCH - Sets -the architecture for which the generated project(s) should build. -The default value is x86. amd64 is -also supported by SCons for some Visual Studio versions. Trying to set -$MSVS_ARCH to an architecture that's not supported for a given Visual -Studio version will generate an error. + + Sets the architecture for which the generated project(s) + should build. + The default value is x86. + amd64 is also supported by SCons for + some Visual Studio versions. Trying to set $MSVS_ARCH + to an architecture that's not supported for a given Visual + Studio version will generate an error. + + MSVS_PROJECT_GUID - The string placed in a generated + + + The string placed in a generated Microsoft Visual Studio project file as the value of the -ProjectGUID attribute. There is no default value. If not -defined, a new GUID is generated. + ProjectGUID attribute. There is no default + value. If not +defined, a new GUID is generated. + + + MSVS_SCC_AUX_PATH - The path name placed in a generated + + + The path name placed in a generated Microsoft Visual Studio project file as the value of the -SccAuxPath attribute if the -MSVS_SCC_PROVIDER construction variable is also set. There is -no default value. + SccAuxPath attribute if the + MSVS_SCC_PROVIDER construction variable is + also set. There is +no default value. + + + MSVS_SCC_CONNECTION_ROOT - 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 -SccLocalPath attribute of the project file and as the -values of the -SccProjectFilePathRelativizedFromConnection[i] (where [i] -ranges from 0 to the number of projects in the solution) attributes of the -GlobalSection(SourceCodeControl) section of the Microsoft -Visual Studio solution file. Similarly the relative solution file path is -placed as the values of the SccLocalPath[i] (where [i] -ranges from 0 to the number of projects in the solution) attributes of the -GlobalSection(SourceCodeControl) section of the Microsoft -Visual Studio solution file. This is used only if the -MSVS_SCC_PROVIDER construction variable is also set. The -default value is the current working directory. + + + 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 SccLocalPath + attribute of the project file and as the values of the + SccProjectFilePathRelativizedFromConnection[i] + (where [i] ranges from 0 to the number of projects in the solution) + attributes of the GlobalSection(SourceCodeControl) + section of the Microsoft Visual Studio solution file. Similarly + the relative solution file path is placed as the values of the + SccLocalPath[i] (where [i] ranges from 0 + to the number of projects in the solution) attributes of the + GlobalSection(SourceCodeControl) section of + the Microsoft Visual Studio solution file. This is used only if + the MSVS_SCC_PROVIDER construction variable is + also set. The default value is the current working directory. + + MSVS_SCC_PROJECT_NAME - The project name placed in -a generated Microsoft Visual Studio project file as the value of the -SccProjectName attribute if the -MSVS_SCC_PROVIDER construction variable is also set. In this -case the string is also placed in the SccProjectName0 -attribute of the GlobalSection(SourceCodeControl) section -of the Microsoft Visual Studio solution file. There is no default value. - + + + The project name placed in a generated Microsoft + Visual Studio project file as the value of the + SccProjectName attribute if the + MSVS_SCC_PROVIDER construction variable + is also set. In this case the string is also placed in + the SccProjectName0 attribute of the + GlobalSection(SourceCodeControl) section + of the Microsoft Visual Studio solution file. There is no + default value. + + MSVS_SCC_PROVIDER - The -string placed in a generated Microsoft Visual Studio project file as the value -of the SccProvider attribute. The string is also placed in -the SccProvider0 attribute of the -GlobalSection(SourceCodeControl) section of the Microsoft -Visual Studio solution file. There is no default value. + + + The string placed in a generated Microsoft + Visual Studio project file as the value of the + SccProvider attribute. The string is + also placed in the SccProvider0 attribute + of the GlobalSection(SourceCodeControl) + section of the Microsoft Visual Studio solution file. There + is no default value. + + MSVS_VERSION - Sets the preferred version -of Microsoft Visual Studio to use. If $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 -MSVS_VERSION 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. -This is obsolete: use $MSVC_VERSION instead. If $MSVS_VERSION is -set and $MSVC_VERSION is not, $MSVC_VERSION will be set automatically -to $MSVS_VERSION. If both are set to different values, scons will raise an -error. + + Sets the preferred version of Microsoft Visual Studio to use. + + If $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 MSVS_VERSION 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. + + + This is obsolete: use $MSVC_VERSION instead. If + $MSVS_VERSION is set and $MSVC_VERSION is + not, $MSVC_VERSION will be set automatically to + $MSVS_VERSION. If both are set to different values, + scons will raise an error. + + MSVSBUILDCOM -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. + + 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. + + MSVSCLEANCOM - 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. + + + 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. + + MSVSENCODING - The encoding string placed in a -generated Microsoft Visual Studio project file. The default is encoding -Windows-1252. + + + The encoding string placed in a generated Microsoft + Visual Studio project file. The default is encoding + Windows-1252. + + MSVSPROJECTCOM - The action used to generate Microsoft -Visual Studio project files. + + The action used to generate Microsoft Visual Studio project files. + MSVSPROJECTSUFFIX - The suffix used for Microsoft Visual -Studio project (DSP) files. The default value is .vcproj -when using Visual Studio version 7.x (.NET) or later version, and -.dsp when using earlier versions of Visual Studio. - + + + The suffix used for Microsoft Visual Studio project (DSP) + files. The default value is .vcproj + when using Visual Studio version 7.x (.NET) or later version, + and .dsp when using earlier versions of + Visual Studio. + + MSVSREBUILDCOM - 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. + + + 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. + + + MSVSSCONS -The SCons used in generated Microsoft Visual Studio project files. The -default is the version of SCons being used to generate the project file. - + + The SCons used in generated Microsoft Visual Studio project + files. The default is the version of SCons being used to + generate the project file. + + MSVSSCONSCOM - The default -SCons command used in generated Microsoft Visual Studio project files. - + + + The default SCons command used in generated Microsoft Visual + Studio project files. + + MSVSSCONSCRIPT - The sconscript -file (that is, SConstruct or SConscript file) that will be invoked by -Visual Studio project files (through the $MSVSSCONSCOM variable). The -default is the same sconscript file that contains the call to MSVSProject -to build the project file. + + + The sconscript file (that is, SConstruct or SConscript + file) that will be invoked by Visual Studio project files + (through the $MSVSSCONSCOM variable). The default + is the same sconscript file that contains the call to + MSVSProject to build the project file. + + MSVSSCONSFLAGS - The -SCons flags used in generated Microsoft Visual Studio project files. - + + + The SCons flags used in generated Microsoft Visual Studio project files. + + MSVSSOLUTIONCOM - The action used to generate Microsoft -Visual Studio solution files. + + The action used to generate Microsoft Visual Studio solution files. + MSVSSOLUTIONSUFFIX - The suffix used for Microsoft -Visual Studio solution (DSW) files. The default value is -.sln when using Visual Studio version 7.x (.NET), and -.dsw when using earlier versions of Visual Studio. - + + + The suffix used for Microsoft Visual Studio solution (DSW) + files. The default value is .sln + when using Visual Studio version 7.x (.NET), and + .dsw when using earlier versions of + Visual Studio. + + MT @@ -5973,11 +6027,15 @@ below, for more information. SCONS_HOME - 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 $MSVSSCONS command line executed from Microsoft -Visual Studio project files. + + + 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 $MSVSSCONS command line executed from Microsoft + Visual Studio project files. + + SHCC @@ -6720,6 +6778,16 @@ Example + + SHLIBVERSIONFLAGS + + +Extra flags added to $SHLINKCOM when building versioned +SharedLibrary. These flags are only used when $SHLIBVERSION is +set. + + + _SHLIBVERSIONFLAGS @@ -6733,16 +6801,6 @@ and some extra dynamically generated options (such as - - SHLIBVERSIONFLAGS - - -Extra flags added to $SHLINKCOM when building versioned -SharedLibrary. These flags are only used when $SHLIBVERSION is -set. - - - SHLINK @@ -7206,13 +7264,6 @@ that may not be set or used in a construction environment. TARGET_ARCH - The name of the target hardware architecture for the compiled objects - created by this Environment. - This defaults to the value of HOST_ARCH, and the user can override it. - Currently only set for Win32. - - - Sets the target architecture for Visual Studio compiler (i.e. the arch of the binaries generated by the compiler). If not set, default to $HOST_ARCH, or, if that is unset, to the architecture of the @@ -7243,7 +7294,14 @@ and ia64 (Itanium). For example, if you want to compile 64-bit binaries, you would set TARGET_ARCH='x86_64' in your SCons environment. - + + + The name of the target hardware architecture for the compiled objects + created by this Environment. + This defaults to the value of HOST_ARCH, and the user can override it. + Currently only set for Win32. + + TARGET_OS -- cgit v0.12 From f04b4313cd4b96bdb01ff77294ca24ee9d9c0ebb Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 6 Feb 2019 09:10:21 -0700 Subject: Fix problem where API doc gen misses some files In doc/SConscript, the function in bootstrap.py to parse a manifest was called with an scons path (#src/engine) but bootstrap does not run in an scons context, it is run via subprocess.Popen. Preprocess the path. Along the way, change the function to open the file itself instead of being passed a list already read from the file, update the comment, and clean some whitespace issues. Signed-off-by: Mats Wichmann --- SConstruct | 8 +++----- bootstrap.py | 44 +++++++++++++++++++++++++++----------------- doc/SConscript | 17 +++++++++-------- 3 files changed, 39 insertions(+), 30 deletions(-) diff --git a/SConstruct b/SConstruct index 3d93d1e..8f7ceaf 100644 --- a/SConstruct +++ b/SConstruct @@ -335,7 +335,7 @@ python_scons = { 'debian_deps' : [ 'debian/changelog', 'debian/compat', - 'debian/control', + 'debian/control', 'debian/copyright', 'debian/dirs', 'debian/docs', @@ -499,8 +499,7 @@ for p in [ scons ]: # destination files. # manifest_in = File(os.path.join(src, 'MANIFEST.in')).rstr() - manifest_in_lines = open(manifest_in).readlines() - src_files = bootstrap.parseManifestLines(src, manifest_in_lines) + src_files = bootstrap.parseManifestLines(src, manifest_in) raw_files = src_files[:] dst_files = src_files[:] @@ -520,12 +519,11 @@ for p in [ scons ]: MANIFEST_in = File(os.path.join(src, ssubdir, 'MANIFEST.in')).rstr() MANIFEST_in_list.append(MANIFEST_in) - files = bootstrap.parseManifestLines(os.path.join(src, ssubdir), open(MANIFEST_in).readlines()) + files = bootstrap.parseManifestLines(os.path.join(src, ssubdir), MANIFEST_in) raw_files.extend(files) src_files.extend([os.path.join(ssubdir, x) for x in files]) - files = [os.path.join(isubdir, x) for x in files] dst_files.extend(files) for k, f in sp['filemap'].items(): diff --git a/bootstrap.py b/bootstrap.py index ea7e0c8..4ade361 100755 --- a/bootstrap.py +++ b/bootstrap.py @@ -21,6 +21,7 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # +from __future__ import print_function import os import os.path @@ -74,15 +75,24 @@ the following SCons options: "eaten" by the bootstrap.py script. """ -def parseManifestLines(basedir, lines): - """ Scans the single lines of a MANIFEST file, - and returns the list of source files. - Has basic support for recursive globs '**', - filename wildcards of the form '*.xml' and - comment lines, starting with a '#'. +def parseManifestLines(basedir, manifest): + """ + Scans a MANIFEST file, and returns the list of source files. + + Has basic support for recursive globs '**', + filename wildcards of the form '*.xml' and + comment lines, starting with a '#'. + + :param basedir: base path to find files in. Note this does not + run in an SCons context so path must not need + further processing (e.g. no '#' signs) + :param manifest: path to manifest file + :returns: list of files """ sources = [] basewd = os.path.abspath(basedir) + with open(manifest) as m: + lines = m.readlines() for l in lines: if l.startswith('#'): # Skip comments @@ -107,16 +117,16 @@ def parseManifestLines(basedir, lines): def main(): script_dir = os.path.abspath(os.path.dirname(__file__)) - + bootstrap_dir = os.path.join(script_dir, 'bootstrap') - + pass_through_args = [] update_only = None - + requires_an_argument = 'bootstrap.py: %s requires an argument\n' - + search = [script_dir] - + def find(filename, search=search): for dir_name in search: filepath = os.path.join(dir_name, filename) @@ -125,20 +135,20 @@ def main(): sys.stderr.write("could not find `%s' in search path:\n" % filename) sys.stderr.write("\t" + "\n\t".join(search) + "\n") sys.exit(2) - + def must_copy(dst, src): if not os.path.exists(dst): return 1 return not filecmp.cmp(dst,src) - + # Note: We don't use the getopt module to process the command-line # arguments because we'd have to teach it about all of the SCons options. - + command_line_args = sys.argv[1:] - + while command_line_args: arg = command_line_args.pop(0) - + if arg == '--bootstrap_dir': try: bootstrap_dir = command_line_args.pop(0) @@ -180,7 +190,7 @@ def main(): MANIFEST_in = find(os.path.join(src_engine, 'MANIFEST.in')) manifest_files = [os.path.join(src_engine, x) for x in parseManifestLines(os.path.join(script_dir, src_engine), - open(MANIFEST_in).readlines())] + MANIFEST_in)] files = [scons_py] + manifest_files diff --git a/doc/SConscript b/doc/SConscript index ad3eb9b..51ef2db 100644 --- a/doc/SConscript +++ b/doc/SConscript @@ -326,7 +326,7 @@ else: # get included by the document XML files in the subdirectories. # manifest = File('MANIFEST').rstr() - src_files = bootstrap.parseManifestLines('.', open(manifest).readlines()) + src_files = bootstrap.parseManifestLines('.', manifest) for s in src_files: if not s: continue @@ -351,7 +351,7 @@ else: if not os.path.exists(os.path.join(build, doc, 'titlepage')): env.Execute(Mkdir(os.path.join(build, doc, 'titlepage'))) manifest = File(os.path.join(doc, 'MANIFEST')).rstr() - src_files = bootstrap.parseManifestLines(doc, open(manifest).readlines()) + src_files = bootstrap.parseManifestLines(doc, manifest) for s in src_files: if not s: continue @@ -571,14 +571,15 @@ if not epydoc_cli and not epydoc: else: # XXX Should be in common with reading the same thing in # the SConstruct file. - e = os.path.join('#src', 'engine') - manifest_in = File(os.path.join(e, 'MANIFEST.in')).rstr() - sources = bootstrap.parseManifestLines(e, open(manifest_in).readlines()) - - # Don't omit this as we need Platform.virtualenv for the examples to be run + # bootstrap.py runs outside of SCons, so need to process the path + e = Dir(os.path.join('#src', 'engine')).rstr() + sources = bootstrap.parseManifestLines(e, os.path.join(e, 'MANIFEST.in')) + + # Omit some files: + # + # Don't omit Platform as we need Platform.virtualenv for the examples to be run # sources = [x for x in sources if x.find('Platform') == -1] sources = [x for x in sources if x.find('Tool') == -1] - # XXX sources = [x for x in sources if x.find('Options') == -1] e = os.path.join(build, '..', 'scons', 'engine') -- cgit v0.12 From 7813d8b9e219c6020ce9e462f3b1c6be741ed29c Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 6 Feb 2019 09:35:38 -0700 Subject: Add arm targets to doc for MSVS_ARCH Signed-off-by: Mats Wichmann --- doc/generated/variables.gen | 9 ++++++--- src/engine/SCons/Tool/msvs.xml | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/generated/variables.gen b/doc/generated/variables.gen index 194fb72..a6012b6 100644 --- a/doc/generated/variables.gen +++ b/doc/generated/variables.gen @@ -4582,11 +4582,14 @@ Versions ending in Exp refer to "Express" or MSVS_ARCH - Sets the architecture for which the generated project(s) - should build. + Sets the architecture for which the generated project(s) should build. + The default value is x86. amd64 is also supported by SCons for - some Visual Studio versions. Trying to set $MSVS_ARCH + most Visual Studio versions. Since Visual Studio 2015 + arm is supported, and since Visual Studio + 2017 arm64 is supported. + Trying to set $MSVS_ARCH to an architecture that's not supported for a given Visual Studio version will generate an error. diff --git a/src/engine/SCons/Tool/msvs.xml b/src/engine/SCons/Tool/msvs.xml index 2292522..6467a2b 100644 --- a/src/engine/SCons/Tool/msvs.xml +++ b/src/engine/SCons/Tool/msvs.xml @@ -463,11 +463,14 @@ env.MSVSSolution(target='Bar' + env['MSVSSOLUTIONSUFFIX'], projects=['bar' + env - Sets the architecture for which the generated project(s) - should build. + Sets the architecture for which the generated project(s) should build. + The default value is x86. amd64 is also supported by &SCons; for - some Visual Studio versions. Trying to set &cv-MSVS_ARCH; + most Visual Studio versions. Since Visual Studio 2015 + arm is supported, and since Visual Studio + 2017 arm64 is supported. + Trying to set &cv-MSVS_ARCH; to an architecture that's not supported for a given Visual Studio version will generate an error. -- cgit v0.12