Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for MSVC 2022 series #4030

Merged
merged 8 commits into from
Oct 16, 2021
Merged

Conversation

jcbrill
Copy link
Contributor

@jcbrill jcbrill commented Oct 5, 2021

New functionality and fixes:

Contributor Checklist:

  • I have created a new test or updated the unit tests to cover the new/changed functionality.
  • I have updated CHANGES.txt (and read the README.rst)
  • I have updated the appropriate documentation

@jcbrill
Copy link
Contributor Author

jcbrill commented Oct 5, 2021

MSVC prerelease versions of Visual Studion 2022 are enabled via an environment variable:

# Enable prerelease version(s) via vswhere query argument.
# When enabled, an installed prerelease version will likely be the default msvc version.
_MSVC_CHECK_PRERELEASE = os.environ.get('MSVC_CHECK_PRERELEASE') in ('1', 'true', 'True')

The implementation is based (in spirit) on the implementation of SCONS_CONFIG_CACHE in common.py:

# SCONS_CACHE_MSVC_CONFIG is public, and is documented.
CONFIG_CACHE = os.environ.get('SCONS_CACHE_MSVC_CONFIG')
if CONFIG_CACHE in ('1', 'true', 'True'):
    CONFIG_CACHE = os.path.join(os.path.expanduser('~'), '.scons_msvc_cache')

Notes as implemented:

  • Visual Studio 2022 should be correctly detected when released.
  • Prerelease versions of Visual Studio will be detected when the environment variable "MSVC_CHECK_PRERELEASE=1" is defined in the system environment.
  • The MSVC_CHECK_PRERELEASE environment variable is considered "internal" and was not added to the documentation.
  • The overhead of the pre-release version implementation is minimal (near-zero) when the pre-release environment variable is not configured:
    • looking up the system environment variable and checking if the value enables pre-release versions
    • adding an empty list to the release vswhere queries via a python ternary expression (if/else expression)
  • When the environment variable is configured, released versions will take precedence over pre-release versions (e.g., a release version of the Build Tools would be selected before a pre-release Community version) should both release and pre-release versions of Visual Studio 2022 be installed.
  • The intent is that once Visual Studio 2022 is released, the list addition via the ternary expression can be excised from the code. As the environment variable is internal and the release versions take precedence over pre-release versions there is no pressing need to remove the pre-release query addition code immediately.

Copied from the issue #3988 discussion as a reminder:

  • The added test script test\MSVS\test-14.3-exec.py failed on the test computer and in a vmware vm with the following message: Visual Studio has encountered an unexpected error.

    The target executable was successfully built. There is a hidden empty folder tree following failure. Curiously, when adding either /RunExit or /Upgrade after /Build Release in the test script command argument list, the build is successful. I'm not sure what else to do at this point.

    The generated SConstruct file, code, and visual studio files build successfully when moved to another folder and scons is invoked from the command line.

  • With the exception of test\MSVS\test-14.3-exec.py, the following tests are either skipped or pass:

    • SCons\Tool\MSCommon\vcTests.py
    • SCons\Tool\msvsTests.py
    • Test\MSVC\*.py
    • Test\MSVS\*.py
  • Unrelated to VS 2022, import os was added to the test-N.N-exec.py scripts for MSVS versions 6.0, 7.0, and 7.1 to fix a NameError exception raised in each script.

@bdbaddog bdbaddog merged commit f6cefb2 into SCons:master Oct 16, 2021
@mwichmann mwichmann added Tools Issues related to tools subsystem MSVC Microsoft Visual C++ Support labels Oct 18, 2021
@mwichmann mwichmann added this to the 4.3 milestone Oct 18, 2021
@LeonarddeR
Copy link

I hope a release can be considered shortly so we can start building with Visual Studio 2022 when it arrives next week.

@bdbaddog
Copy link
Contributor

bdbaddog commented Nov 1, 2021

I hope a release can be considered shortly so we can start building with Visual Studio 2022 when it arrives next week.

It's in the works.

@jcbrill jcbrill deleted the jbrill-msvs-2022 branch November 5, 2021 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MSVC Microsoft Visual C++ Support Tools Issues related to tools subsystem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants