Skip to content

Commit 4d7b5ab

Browse files
committed
Further tweak $VSWHERE, also $MSVC_VERSION [skip appveyor]
Apply the same note to $MSVC_VERSION about discovery, for consistency. Signed-off-by: Mats Wichmann <[email protected]>
1 parent a16a071 commit 4d7b5ab

File tree

2 files changed

+81
-68
lines changed

2 files changed

+81
-68
lines changed

SCons/Tool/msvc.xml

Lines changed: 39 additions & 31 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
@@ -873,10 +885,10 @@ Specify the location of <command>vswhere.exe</command>.
873885
the state of compiler support for those editions.
874886
</para>
875887
<para>
876-
You can set the &cv-VSWHERE; variable to the path to a specific
888+
Satting the &cv-VSWHERE; variable to the path to a specific
877889
<command>vswhere.exe</command> binary,
878-
and &SCons; will use that.
879-
If undefined (the default), &SCons; will search for one,
890+
causes &SCons; to use that binary.
891+
If not set (the default), &SCons; will search for one,
880892
looking in the following locations in order,
881893
using the first found, and updating &cv-VSWHERE; with the location.
882894
</para>
@@ -897,10 +909,12 @@ Specify the location of <command>vswhere.exe</command>.
897909
the initial &MSVC; compiler discovery takes place.
898910
Discovery happens, at the latest, during the first call to the
899911
&f-link-Environment; function, unless a <parameter>tools</parameter>
900-
list is specified which excludes the entire MSVC toolchain
901-
(that is, does not include <literal>"defaults"</literal>
902-
or any of the specific tools),
903-
in which case it happens when one of the tools is invoked manually.
912+
list is specified which excludes the entire &MSVC; toolchain -
913+
that is, omits <literal>"defaults"</literal>
914+
and any specific tool module that refers to parts of the toolchain
915+
(&t-link-msvc;, &t-link-mslink;, &t-link-masm;, &t-link-midl;
916+
and &t-link-msvs;). In this case, detection is deferred until
917+
any one of those tool modules is invoked manually.
904918
The following two examples illustrate this:
905919
</para>
906920

@@ -915,12 +929,6 @@ env.Tool('msvc')
915929
env.Tool('mslink')
916930
env.Tool('msvs')
917931
</programlisting>
918-
919-
<para>
920-
The tool modules that trigger detection are
921-
&t-link-msvc;, &t-link-mslink;, &t-link-masm;, &t-link-midl;
922-
and &t-link-msvs;.
923-
</para>
924932
</note>
925933

926934
</summary>

doc/generated/variables.gen

Lines changed: 42 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5979,9 +5979,38 @@ If the specified version is unavailable and/or unknown to &SCons;,
59795979
a warning is issued showing the versions actually discovered,
59805980
and the build will eventually fail indicating a missing compiler binary.
59815981
If &cv-MSVC_VERSION; is not set, &SCons; will (by default) select the
5982-
latest version of &MSVC; installed on your system.
5982+
latest version of &MSVC; installed on your system
5983+
(excluding any preview versions).
59835984
</para>
59845985

5986+
<note>
5987+
<para>
5988+
In order to take effect, &cv-MSVC_VERSION; must be set before
5989+
the initial &MSVC; compiler discovery takes place.
5990+
Discovery happens, at the latest, during the first call to the
5991+
&f-link-Environment; function, unless a <parameter>tools</parameter>
5992+
list is specified which excludes the entire &MSVC; toolchain -
5993+
that is, omits <literal>"defaults"</literal>
5994+
and any specific tool module that refers to parts of the toolchain
5995+
(&t-link-msvc;, &t-link-mslink;, &t-link-masm;, &t-link-midl;
5996+
and &t-link-msvs;). In this case, detection is deferred until
5997+
any one of those tool modules is invoked manually.
5998+
The following two examples illustrate this:
5999+
</para>
6000+
6001+
<programlisting>
6002+
# MSVC_VERSION set as Environment is created
6003+
env = Environment(MSVC_VERSION='14.2')
6004+
6005+
# Initialization deferred with empty tools, triggered manually
6006+
env = Environment(tools=[])
6007+
env['MSVC_VERSION'] = '14.2
6008+
env.Tool('msvc')
6009+
env.Tool('mslink')
6010+
env.Tool('msvs')
6011+
</programlisting>
6012+
</note>
6013+
59856014
<para>
59866015
The valid values for &cv-MSVC_VERSION; represent major versions
59876016
of the compiler, except that versions ending in <literal>Exp</literal>
@@ -5990,23 +6019,6 @@ Values that do not look like a valid compiler version
59906019
<emphasis>string</emphasis> are not supported.
59916020
</para>
59926021

5993-
<para>
5994-
To have the desired effect, &cv-MSVC_VERSION; must be set before an msvc &f-link-Tool;
5995-
(e.g., &t-link-msvc;) or an msvc-dependent &f-link-Tool; (e.g., &t-link-midl;) is loaded
5996-
into the &consenv;.
5997-
</para>
5998-
5999-
<para>
6000-
If the default tools list or an explicit tools list is used that includes an
6001-
msvc &f-link-Tool; (e.g., &t-link-msvc;) or an msvc-dependent &f-link-Tool; (e.g., &t-link-midl;);
6002-
the &cv-MSVC_VERSION; is resolved when the &consenv; is created.
6003-
In this case, passing &cv-MSVC_VERSION; as an argument in the &f-link-Environment; call
6004-
is the effective solution.
6005-
Otherwise, &cv-MSVC_VERSION; must be set before the first msvc &f-link-Tool; or
6006-
msvc-dependent &f-link-Tool; is loaded into the environment.
6007-
See the manpage section "Construction Environments" for an example.
6008-
</para>
6009-
60106022
<para>
60116023
The following table shows the correspondence
60126024
of &cv-MSVC_VERSION; values to various version indicators
@@ -9895,18 +9907,15 @@ Specify the location of <command>vswhere.exe</command>.
98959907
Microsoft Visual Studio and Build Tools since the 2017 edition,
98969908
but is also available as a standalone installation.
98979909
It allows queries to obtain detailed information about
9898-
installations of 2017 and later editions;
9899-
with the <option>-legacy</option> argument,
9900-
it can return limited information for
9901-
installations of the 2010 through 2015 editions.
9902-
&SCons; makes use of this information to help determine
9903-
the state of compiler support.
9910+
installations of 2017 and later editions.
9911+
&SCons; makes use of this information to determine
9912+
the state of compiler support for those editions.
99049913
</para>
99059914
<para>
9906-
You can set the &cv-VSWHERE; variable to the path to a specific
9915+
Satting the &cv-VSWHERE; variable to the path to a specific
99079916
<command>vswhere.exe</command> binary,
9908-
and &SCons; will use that.
9909-
If undefined (the default), &SCons; will search for one,
9917+
causes &SCons; to use that binary.
9918+
If not set (the default), &SCons; will search for one,
99109919
looking in the following locations in order,
99119920
using the first found, and updating &cv-VSWHERE; with the location.
99129921
</para>
@@ -9927,10 +9936,12 @@ Specify the location of <command>vswhere.exe</command>.
99279936
the initial &MSVC; compiler discovery takes place.
99289937
Discovery happens, at the latest, during the first call to the
99299938
&f-link-Environment; function, unless a <parameter>tools</parameter>
9930-
list is specified which excludes the entire MSVC toolchain
9931-
(that is, does not include <literal>"defaults"</literal>
9932-
or any of the specific tools),
9933-
in which case it happens when one of the tools is invoked manually.
9939+
list is specified which excludes the entire &MSVC; toolchain -
9940+
that is, omits <literal>"defaults"</literal>
9941+
and any specific tool module that refers to parts of the toolchain
9942+
(&t-link-msvc;, &t-link-mslink;, &t-link-masm;, &t-link-midl;
9943+
and &t-link-msvs;). In this case, detection is deferred until
9944+
any one of those tool modules is invoked manually.
99349945
The following two examples illustrate this:
99359946
</para>
99369947

@@ -9945,12 +9956,6 @@ env.Tool('msvc')
99459956
env.Tool('mslink')
99469957
env.Tool('msvs')
99479958
</programlisting>
9948-
9949-
<para>
9950-
The tool modules that trigger detection are
9951-
&t-link-msvc;, &t-link-mslink;, &t-link-masm;, &t-link-midl;
9952-
and &t-link-msvs;.
9953-
</para>
99549959
</note>
99559960

99569961
</listitem>

0 commit comments

Comments
 (0)