diff options
author | Daniel <dmoody256@gmail.com> | 2019-01-10 09:05:24 (GMT) |
---|---|---|
committer | Daniel <dmoody256@gmail.com> | 2019-01-10 09:15:14 (GMT) |
commit | 3e68e53b03e531f453edba8bc0443b5c19dde211 (patch) | |
tree | d857b675f6903e5df90ee6e053ba33a0c4dba393 | |
parent | a362956e9af4095ff946bffd32ae275030806ac5 (diff) | |
download | SCons-3e68e53b03e531f453edba8bc0443b5c19dde211.zip SCons-3e68e53b03e531f453edba8bc0443b5c19dde211.tar.gz SCons-3e68e53b03e531f453edba8bc0443b5c19dde211.tar.bz2 |
added name for cl.exe and have older versions walk for cl.exe
fixed syntax error
removed debug print
-rw-r--r-- | src/engine/SCons/Tool/MSCommon/vc.py | 29 | ||||
-rw-r--r-- | test/MSVC/MSVC_UWP_APP.py | 7 |
2 files changed, 20 insertions, 16 deletions
diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 7401f5c..007a80d 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -106,6 +106,8 @@ _HOST_TARGET_ARCH_TO_BAT_ARCH = { ("amd64", "arm64"): "amd64_arm64", # since 14.1 } +_CL_EXE_NAME = 'cl.exe' + def get_msvc_version_numeric(msvc_version): return ''.join([x for x in msvc_version if x in string_digits + '.']) @@ -436,10 +438,10 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): debug('_check_cl_exists_in_vc_dir(): unsupported target platform ' + target_platform) return False - cl_path = os.path.join(vc_dir, r'Tools\MSVC', vc_specific_version, 'bin', host_dir, target_dir, 'cl.exe') - debug('_check_cl_exists_in_vc_dir(): checking for cl.exe at ' + cl_path) + cl_path = os.path.join(vc_dir, r'Tools\MSVC', vc_specific_version, 'bin', host_dir, target_dir, _CL_EXE_NAME) + debug('_check_cl_exists_in_vc_dir(): checking for ' + _CL_EXE_NAME + ' at ' + cl_path) if os.path.exists(cl_path): - debug('_check_cl_exists_in_vc_dir(): found cl.exe!') + debug('_check_cl_exists_in_vc_dir(): found ' + _CL_EXE_NAME + '!') return True elif ver_num <= 14 and ver_num >= 8: @@ -452,24 +454,27 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): debug('_check_cl_exists_in_vc_dir(): unsupported target platform ' + target_platform) return False - cl_path = os.path.join(vc_dir, 'bin\\' + _get_host_target_dir(host_platform, target_platform) + 'cl.exe') - debug('_check_cl_exists_in_vc_dir(): checking for cl.exe at ' + cl_path) + cl_path = os.path.join(vc_dir, 'bin\\' + _get_host_target_dir(host_platform, target_platform) + _CL_EXE_NAME) + debug('_check_cl_exists_in_vc_dir(): checking for ' + _CL_EXE_NAME + ' at ' + cl_path) cl_path_exists = os.path.exists(cl_path) if not cl_path_exists and host_platform == 'amd64': # older versions of visual studio only had x86 binaries, so if the host platform is amd64, we need to check cross compile options (x86 binary compiles some other target on a 64 bit os) - cl_path = os.path.join(vc_dir, 'bin\\' + _get_host_target_dir('x86', target_platform) + 'cl.exe') - debug('_check_cl_exists_in_vc_dir(): checking for cl.exe at ' + cl_path) + cl_path = os.path.join(vc_dir, 'bin\\' + _get_host_target_dir('x86', target_platform) + _CL_EXE_NAME) + debug('_check_cl_exists_in_vc_dir(): checking for ' + _CL_EXE_NAME + ' at ' + cl_path) cl_path_exists = os.path.exists(cl_path) if cl_path_exists: - debug('_check_cl_exists_in_vc_dir(): found cl.exe!') + debug('_check_cl_exists_in_vc_dir(): found ' + _CL_EXE_NAME + '!') return True elif ver_num < 8 and ver_num >= 6: - # not sure about these versions so if a VC dir was found, consider it possibly valid - # and let the batch script run, and any issues can get caught there - return os.path.exists(vc_dir) + # not sure about these versions so if a walk the VC dir (could be slow) + for root, _, files in os.walk(vc_dir): + if _CL_EXE_NAME in files: + debug('get_installed_vcs ' + _CL_EXE_NAME + ' found %s' % os.path.join(root, _CL_EXE_NAME)) + return True + return False else: # version not support return false debug('_check_cl_exists_in_vc_dir(): unsupported MSVC version: ' + str(ver_num)) @@ -712,7 +717,7 @@ def msvc_setup_env(env): msvc_cl = find_program_path(env, 'cl') if not msvc_cl: SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, - "Could not find MSVC compiler 'cl.exe', it may need to be installed separately with Visual Studio") + "Could not find MSVC compiler 'cl', it may need to be installed separately with Visual Studio") def msvc_exists(env=None, version=None): vcs = cached_get_installed_vcs(env) diff --git a/test/MSVC/MSVC_UWP_APP.py b/test/MSVC/MSVC_UWP_APP.py index cdd260c..861edcd 100644 --- a/test/MSVC/MSVC_UWP_APP.py +++ b/test/MSVC/MSVC_UWP_APP.py @@ -108,7 +108,7 @@ env = Environment(tools=['default', 'msvc'], variables=help_vars, MSVC_VERSION=' # Print the ENV LIBPATH to stdout print('env[ENV][LIBPATH]=%s' % env.get('ENV').get('LIBPATH')) print('env[MSVC_VERSION]=%s' % env.get('MSVC_VERSION')) - """) +""") # Test setting MSVC_UWP_APP is '1' (True) test.run(arguments = "MSVC_UWP_APP=1") @@ -142,13 +142,12 @@ else: help_vars = None env = Environment(tools=['default', 'msvc'], variables=help_vars, MSVC_VERSION='14.1') # Print the ENV LIBPATH to stdout -print(str(env.get('ENV'))) print('env[ENV][LIBPATH]=%s' % env.get('ENV').get('LIBPATH')) print('env[MSVC_VERSION]=%s' % env.get('MSVC_VERSION')) print('env[ENV][VSCMD_ARG_app_plat]=%s' % env.get('ENV').get('VSCMD_ARG_app_plat')) - """) +""") - # 2017 adds + # Test setting MSVC_UWP_APP is '1' (True) test.run(arguments = "MSVC_UWP_APP=1") (vclibstore_path_present, vclibstorerefs_path_present, msvc_version) = AreVCStoreLibPathsInLIBPATH(test.stdout()) test.fail_test((vclibstore_path_present is False) or (vclibstorerefs_path_present is False), |