Skip to content

Commit cd8952b

Browse files
authored
Merge pull request SCons#4564 from mwichmann/doc/vswhere
Update $VSWHERE description
2 parents f77b851 + 547140f commit cd8952b

File tree

6 files changed

+274
-172
lines changed

6 files changed

+274
-172
lines changed

SCons/Tool/msvc.xml

Lines changed: 79 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,38 @@ If the specified version is unavailable and/or unknown to &SCons;,
394394
a warning is issued showing the versions actually discovered,
395395
and the build will eventually fail indicating a missing compiler binary.
396396
If &cv-MSVC_VERSION; is not set, &SCons; will (by default) select the
397-
latest version of &MSVC; installed on your system.
397+
latest version of &MSVC; installed on your system
398+
(excluding any preview versions).
398399
</para>
399400

401+
<note>
402+
<para>
403+
In order to take effect, &cv-MSVC_VERSION; must be set before
404+
the initial &MSVC; compiler discovery takes place.
405+
Discovery happens, at the latest, during the first call to the
406+
&f-link-Environment; function, unless a <parameter>tools</parameter>
407+
list is specified which excludes the entire &MSVC; toolchain -
408+
that is, omits <literal>"defaults"</literal>
409+
and any specific tool module that refers to parts of the toolchain
410+
(&t-link-msvc;, &t-link-mslink;, &t-link-masm;, &t-link-midl;
411+
and &t-link-msvs;). In this case, detection is deferred until
412+
any one of those tool modules is invoked manually.
413+
The following two examples illustrate this:
414+
</para>
415+
416+
<programlisting>
417+
# MSVC_VERSION set as Environment is created
418+
env = Environment(MSVC_VERSION='14.2')
419+
420+
# Initialization deferred with empty tools, triggered manually
421+
env = Environment(tools=[])
422+
env['MSVC_VERSION'] = '14.2
423+
env.Tool('msvc')
424+
env.Tool('mslink')
425+
env.Tool('msvs')
426+
</programlisting>
427+
</note>
428+
400429
<para>
401430
The valid values for &cv-MSVC_VERSION; represent major versions
402431
of the compiler, except that versions ending in <literal>Exp</literal>
@@ -405,23 +434,6 @@ Values that do not look like a valid compiler version
405434
<emphasis>string</emphasis> are not supported.
406435
</para>
407436

408-
<para>
409-
To have the desired effect, &cv-MSVC_VERSION; must be set before an msvc &f-link-Tool;
410-
(e.g., &t-link-msvc;) or an msvc-dependent &f-link-Tool; (e.g., &t-link-midl;) is loaded
411-
into the &consenv;.
412-
</para>
413-
414-
<para>
415-
If the default tools list or an explicit tools list is used that includes an
416-
msvc &f-link-Tool; (e.g., &t-link-msvc;) or an msvc-dependent &f-link-Tool; (e.g., &t-link-midl;);
417-
the &cv-MSVC_VERSION; is resolved when the &consenv; is created.
418-
In this case, passing &cv-MSVC_VERSION; as an argument in the &f-link-Environment; call
419-
is the effective solution.
420-
Otherwise, &cv-MSVC_VERSION; must be set before the first msvc &f-link-Tool; or
421-
msvc-dependent &f-link-Tool; is loaded into the environment.
422-
See the manpage section "Construction Environments" for an example.
423-
</para>
424-
425437
<para>
426438
The following table shows the correspondence
427439
of &cv-MSVC_VERSION; values to various version indicators
@@ -607,7 +619,7 @@ Visual Studio </literallayout></entry>
607619
"Express" or "Express for Desktop" Visual Studio editions,
608620
which had feature limitations compared to the full editions.
609621
It is only necessary to specify the <literal>Exp</literal>
610-
suffix to select the express edition when both express and
622+
suffix to select the express edition when both express and
611623
non-express editions of the same product are installed
612624
simulaneously. The <literal>Exp</literal> suffix is unnecessary,
613625
but accepted, when only the express edition is installed.
@@ -860,56 +872,65 @@ The burden is on the user to ensure the requisite UWP libraries are installed.
860872
<cvar name="VSWHERE">
861873
<summary>
862874
<para>
863-
Specify the location of <filename>vswhere.exe</filename>.
875+
Specify the location of <command>vswhere.exe</command>.
864876
</para>
865877

866878
<para>
867-
The <filename>vswhere.exe</filename> executable is distributed with Microsoft Visual Studio and Build
868-
Tools since the 2017 edition, but is also available as a standalone installation.
869-
It provides full information about installations of 2017 and later editions.
870-
With the <option>-legacy</option> argument, <filename>vswhere.exe</filename> can detect installations of the 2010 through 2015
871-
editions with limited data returned.
879+
The <command>vswhere.exe</command> executable is distributed with
880+
Microsoft Visual Studio and Build Tools since the 2017 edition,
881+
but is also available as a standalone installation.
882+
It allows queries to obtain detailed information about
883+
installations of 2017 and later editions.
884+
&SCons; makes use of this information to determine
885+
the state of compiler support for those editions.
872886
</para>
873887
<para>
874-
If &cv-VSWHERE; is set to a <filename>vswhere.exe</filename> location, &SCons; will use that location.
875-
When &cv-VSWHERE; is undefined, &SCons; will look in the following locations and set &cv-VSWHERE; to the path
876-
of the first <filename>vswhere.exe</filename> located:
888+
Setting the &cv-VSWHERE; variable to the path to a specific
889+
<command>vswhere.exe</command> binary
890+
causes &SCons; to use that binary.
891+
If not set, &SCons; will search for one,
892+
looking in the following locations in order,
893+
using the first found
894+
(&cv-VSWHERE; is updated with the location):
877895
</para>
878896

879-
<itemizedlist>
880-
<listitem><para><literal>%ProgramFiles(x86)%\Microsoft Visual Studio\Installer</literal></para></listitem>
881-
<listitem><para><literal>%ProgramFiles%\Microsoft Visual Studio\Installer</literal></para></listitem>
882-
<listitem><para><literal>%ChocolateyInstall%\bin</literal></para></listitem>
883-
<listitem><para><literal>%LOCALAPPDATA%\Microsoft\WinGet\Links</literal></para></listitem>
884-
<listitem><para><literal>~\scoop\shims</literal></para></listitem>
885-
<listitem><para><literal>%SCOOP%\shims</literal></para></listitem>
886-
</itemizedlist>
897+
<simplelist type="vert">
898+
<member><literal>%ProgramFiles(x86)%\Microsoft Visual Studio\Installer</literal></member>
899+
<member><literal>%ProgramFiles%\Microsoft Visual Studio\Installer</literal></member>
900+
<member><literal>%ChocolateyInstall%\bin</literal></member>
901+
<member><literal>%LOCALAPPDATA%\Microsoft\WinGet\Links</literal></member>
902+
<member><literal>%USERPROFILE%\scoop\shims</literal></member>
903+
<member><literal>%SCOOP%\shims</literal></member>
904+
</simplelist>
887905

888-
<para>
889-
Note that &cv-VSWHERE; must be set prior to the initial &MSVC; compiler discovery.
890-
For example, &cv-VSWHERE; must be set at the same time or before the first msvc &f-link-Tool;
891-
(e.g., &t-link-msvc;) or msvc-dependent &f-link-Tool; (e.g., &t-link-midl;) is initialized.
892-
</para>
893906

894-
<para>
895-
Either set it as follows:
896-
<programlisting>
907+
<note>
908+
<para>
909+
In order to take effect, &cv-VSWHERE; must be set before
910+
the initial &MSVC; compiler discovery takes place.
911+
Discovery happens, at the latest, during the first call to the
912+
&f-link-Environment; function, unless a <parameter>tools</parameter>
913+
list is specified which excludes the entire &MSVC; toolchain -
914+
that is, omits <literal>"defaults"</literal>
915+
and any specific tool module that refers to parts of the toolchain
916+
(&t-link-msvc;, &t-link-mslink;, &t-link-masm;, &t-link-midl;
917+
and &t-link-msvs;). In this case, detection is deferred until
918+
any one of those tool modules is invoked manually.
919+
The following two examples illustrate this:
920+
</para>
921+
922+
<programlisting>
923+
# VSWHERE set as Environment is created
897924
env = Environment(VSWHERE='c:/my/path/to/vswhere')
898-
</programlisting>
899-
900-
Or, if your &consenv; is created specifying: (a) an empty tools list, or (b)
901-
a list of tools which omits all of default, msvc (e.g., &t-link-msvc;), and
902-
msvc-dependent tools (e.g., &t-link-midl;); and before &f-link-env-Tool;
903-
is called to initialize any of those tools:
904925

905-
<programlisting>
906-
env = Environment(tools=[])
907-
env['VSWHERE'] = r'c:/my/vswhere/install/location/vswhere.exe'
908-
env.Tool('msvc')
909-
env.Tool('mslink')
910-
env.Tool('msvs')
911-
</programlisting>
912-
</para>
926+
# Initialization deferred with empty tools, triggered manually
927+
env = Environment(tools=[])
928+
env['VSWHERE'] = r'c:/my/vswhere/install/location/vswhere.exe'
929+
env.Tool('msvc')
930+
env.Tool('mslink')
931+
env.Tool('msvs')
932+
</programlisting>
933+
</note>
913934

914935
</summary>
915936
</cvar>

doc/generated/builders.gen

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ languages defined in <filename>LINGUAS</filename> file:
823823

824824
<para>
825825
<emphasis>Example 4</emphasis>.
826-
Compile files for languages defined in <filename>LINGUAS</filename> file
826+
Compile files for languages defined in <filename>LINGUAS</filename> file
827827
(another version):
828828
</para>
829829
<example_commands>
@@ -1650,7 +1650,7 @@ Initialize <filename>en.po</filename> and <filename>pl.po</filename> from
16501650
</para>
16511651
<example_commands>
16521652
# ...
1653-
env.POInit(['en', 'pl']) # messages.pot --&gt; [en.po, pl.po]
1653+
env.POInit(['en', 'pl']) # messages.pot --&gt; [en.po, pl.po]
16541654
</example_commands>
16551655

16561656
<para>
@@ -1660,7 +1660,7 @@ Initialize <filename>en.po</filename> and <filename>pl.po</filename> from
16601660
</para>
16611661
<example_commands>
16621662
# ...
1663-
env.POInit(['en', 'pl'], ['foo']) # foo.pot --&gt; [en.po, pl.po]
1663+
env.POInit(['en', 'pl'], ['foo']) # foo.pot --&gt; [en.po, pl.po]
16641664
</example_commands>
16651665

16661666
<para>
@@ -1671,7 +1671,7 @@ variable:
16711671
</para>
16721672
<example_commands>
16731673
# ...
1674-
env.POInit(['en', 'pl'], POTDOMAIN='foo') # foo.pot --&gt; [en.po, pl.po]
1674+
env.POInit(['en', 'pl'], POTDOMAIN='foo') # foo.pot --&gt; [en.po, pl.po]
16751675
</example_commands>
16761676

16771677
<para>
@@ -1756,7 +1756,7 @@ special alias (<literal>pot-update</literal> by default, see
17561756
&cv-link-POTUPDATE_ALIAS;) so you can update/create them easily with
17571757
<command>scons pot-update</command>. The file is not written until there is no
17581758
real change in internationalized messages (or in comments that enter
1759-
<literal>POT</literal> file).
1759+
<literal>POT</literal> file).
17601760
</para>
17611761

17621762
<para>
@@ -1779,7 +1779,7 @@ Let's create <filename>po/</filename> directory and place following
17791779
env = Environment( tools = ['default', 'xgettext'] )
17801780
env.POTUpdate(['foo'], ['../a.cpp', '../b.cpp'])
17811781
env.POTUpdate(['bar'], ['../c.cpp', '../d.cpp'])
1782-
</example_commands>
1782+
</example_commands>
17831783
<para>
17841784
Then invoke scons few times:
17851785
</para>
@@ -1800,7 +1800,7 @@ case default target <filename>messages.pot</filename> will be used. The
18001800
default target may also be overridden by setting &cv-link-POTDOMAIN; construction
18011801
variable or providing it as an override to &b-POTUpdate; builder:
18021802
</para>
1803-
<example_commands>
1803+
<example_commands>
18041804
# SConstruct script
18051805
env = Environment( tools = ['default', 'xgettext'] )
18061806
env['POTDOMAIN'] = "foo"
@@ -1813,21 +1813,21 @@ variable or providing it as an override to &b-POTUpdate; builder:
18131813
The sources may be specified within separate file, for example
18141814
<filename>POTFILES.in</filename>:
18151815
</para>
1816-
<example_commands>
1816+
<example_commands>
18171817
# POTFILES.in in 'po/' subdirectory
18181818
../a.cpp
18191819
../b.cpp
18201820
# end of file
1821-
</example_commands>
1821+
</example_commands>
18221822
<para>
18231823
The name of the file (<filename>POTFILES.in</filename>) containing the list of
18241824
sources is provided via &cv-link-XGETTEXTFROM;:
18251825
</para>
1826-
<example_commands>
1826+
<example_commands>
18271827
# SConstruct file in 'po/' subdirectory
18281828
env = Environment( tools = ['default', 'xgettext'] )
18291829
env.POTUpdate(XGETTEXTFROM = 'POTFILES.in')
1830-
</example_commands>
1830+
</example_commands>
18311831

18321832
<para>
18331833
<emphasis>Example 4.</emphasis>
@@ -1898,10 +1898,10 @@ message <literal>"Hello from ../a.cpp"</literal>. When you reverse order in
18981898
# SConstruct file in '0/1/po/' subdirectory
18991899
env = Environment( tools = ['default', 'xgettext'] )
19001900
env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../../', '../'])
1901-
</example_commands>
1901+
</example_commands>
19021902
<para>
19031903
then the <filename>messages.pot</filename> will contain
1904-
<literal>msgid "Hello from ../../a.cpp"</literal> line and not
1904+
<literal>msgid "Hello from ../../a.cpp"</literal> line and not
19051905
<literal>msgid "Hello from ../a.cpp"</literal>.
19061906
</para>
19071907

@@ -1923,9 +1923,9 @@ does.
19231923
<para>
19241924
Target nodes defined through &b-POUpdate; are not built by default
19251925
(they're <literal>Ignore</literal>d from <literal>'.'</literal> node). Instead,
1926-
they are added automatically to special <literal>Alias</literal>
1926+
they are added automatically to special <literal>Alias</literal>
19271927
(<literal>'po-update'</literal> by default). The alias name may be changed
1928-
through the &cv-link-POUPDATE_ALIAS; construction variable. You can easily
1928+
through the &cv-link-POUPDATE_ALIAS; construction variable. You can easily
19291929
update <literal>PO</literal> files in your project by <command>scons
19301930
po-update</command>.
19311931
</para>
@@ -1989,7 +1989,7 @@ from <filename>messages.pot</filename> template:
19891989
</para>
19901990
<example_commands>
19911991
# produce 'en.po', 'pl.po' + files defined in 'LINGUAS':
1992-
env.POUpdate(['en', 'pl' ], LINGUAS_FILE = 1)
1992+
env.POUpdate(['en', 'pl' ], LINGUAS_FILE = 1)
19931993
</example_commands>
19941994

19951995
<para>
@@ -2724,7 +2724,7 @@ a SCons script when invoking &b-Translate;
27242724
# SConscript in 'po/' directory
27252725
env = Environment( tools = ["default", "gettext"] )
27262726
env['POAUTOINIT'] = 1
2727-
env.Translate(['en','pl'], ['../a.cpp','../b.cpp'])
2727+
env.Translate(['en','pl'], ['../a.cpp','../b.cpp'])
27282728
</example_commands>
27292729

27302730
<para>
@@ -2735,7 +2735,7 @@ If you wish, you may also stick to conventional style known from
27352735
</para>
27362736
<example_commands>
27372737
# LINGUAS
2738-
en pl
2738+
en pl
27392739
#end
27402740
</example_commands>
27412741

@@ -2751,7 +2751,7 @@ b.cpp
27512751
env = Environment( tools = ["default", "gettext"] )
27522752
env['POAUTOINIT'] = 1
27532753
env['XGETTEXTPATH'] = ['../']
2754-
env.Translate(LINGUAS_FILE = 1, XGETTEXTFROM = 'POTFILES.in')
2754+
env.Translate(LINGUAS_FILE = 1, XGETTEXTFROM = 'POTFILES.in')
27552755
</example_commands>
27562756

27572757
<para>
@@ -2778,7 +2778,7 @@ Let's prepare a development tree as below
27782778
<example_commands>
27792779
project/
27802780
+ SConstruct
2781-
+ build/
2781+
+ build/
27822782
+ src/
27832783
+ po/
27842784
+ SConscript

0 commit comments

Comments
 (0)