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

Add a warning if msvc config cache may be outdated. #3546

Merged
merged 2 commits into from Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/CHANGES.txt
Expand Up @@ -62,6 +62,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
- Accommodate VS 2017 Express - it's got a more liberal license then VS
Community, so some people prefer it (from 2019, no more Express)
- vswhere call should also now work even if programs aren't on the C: drive.
- Add an alternate warning message cl.exe is not found and msvc config
cache is in use (SCONS_CACHE_MSVC_CONFIG was given) - config cache
may be out of date.


RELEASE 3.1.2 - Mon, 17 Dec 2019 02:06:27 +0000
Expand Down
23 changes: 12 additions & 11 deletions src/engine/SCons/Tool/MSCommon/vc.py
Expand Up @@ -22,6 +22,9 @@
#

# TODO:
# * gather all the information from a single vswhere call instead
# of calling repeatedly (use json format?)
# * support passing/setting location for vswhere in env.
# * supported arch for versions: for old versions of batch file without
# argument, giving bogus argument cannot be detected, so we have to hardcode
# this here
Expand All @@ -41,7 +44,6 @@
import os
import platform
import sys
from contextlib import suppress
from string import digits as string_digits
from subprocess import PIPE
#TODO: Python 2 cleanup
Expand All @@ -52,12 +54,8 @@
from SCons.Tool import find_program_path

from . import common

debug = common.debug

from . import sdk

get_installed_sdks = sdk.get_installed_sdks
from .common import CONFIG_CACHE, debug
from .sdk import get_installed_sdks


class VisualCException(Exception):
Expand Down Expand Up @@ -921,11 +919,14 @@ def msvc_setup_env(env):
debug("msvc_setup_env() env['ENV']['%s'] = %s" % (k, env['ENV'][k]))

# final check to issue a warning if the compiler is not present
msvc_cl = find_program_path(env, 'cl')
if not msvc_cl:
if not find_program_path(env, 'cl'):
debug("msvc_setup_env() did not find 'cl'")
SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning,
"Could not find MSVC compiler 'cl', it may need to be installed separately with Visual Studio")
if CONFIG_CACHE:
propose = "SCONS_CACHE_MSVC_CONFIG caching enabled, remove cache file {} if out of date.".format(CONFIG_CACHE)
else:
propose = "It may need to be installed separately with Visual Studio."
warn_msg = "Could not find MSVC compiler 'cl'. {}".format(propose)
SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg)

def msvc_exists(env=None, version=None):
vcs = cached_get_installed_vcs(env)
Expand Down