aboutsummaryrefslogtreecommitdiff
path: root/run_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'run_tests.py')
-rwxr-xr-xrun_tests.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/run_tests.py b/run_tests.py
index 7e95643..dbb21df 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -38,9 +38,7 @@ def guess_backend(backend, msbuild_exe: str):
# Auto-detect backend if unspecified
backend_flags = []
if backend is None:
- if (msbuild_exe is not None and
- mesonlib.is_windows() and not
- (os.environ.get('CC') == 'icl' or os.environ.get('CXX') == 'icl' or os.environ.get('FC') == 'ifort')):
+ if msbuild_exe is not None and (mesonlib.is_windows() and not _using_intelcl()):
backend = 'vs' # Meson will auto-detect VS version to use
else:
backend = 'ninja'
@@ -59,6 +57,32 @@ def guess_backend(backend, msbuild_exe: str):
return (backend, backend_flags)
+def _using_intelcl() -> bool:
+ """
+ detect if intending to using Intel-Cl compilers (Intel compilers on Windows)
+ Sufficient evidence of intent is that user is working in the Intel compiler
+ shell environment, otherwise this function returns False
+ """
+ if not mesonlib.is_windows():
+ return False
+ # handle where user tried to "blank" MKLROOT and left space(s)
+ if not os.environ.get('MKLROOT', '').strip():
+ return False
+ if (os.environ.get('CC') == 'icl' or
+ os.environ.get('CXX') == 'icl' or
+ os.environ.get('FC') == 'ifort'):
+ return True
+ # Intel-Cl users might not have the CC,CXX,FC envvars set,
+ # but because they're in Intel shell, the exe's below are on PATH
+ if shutil.which('icl') or shutil.which('ifort'):
+ return True
+ mlog.warning('It appears you might be intending to use Intel compiler on Windows '
+ 'since non-empty environment variable MKLROOT is set to {} '
+ 'However, Meson cannot find the Intel WIndows compiler executables (icl,ifort).'
+ 'Please try using the Intel shell.'.format(os.environ.get('MKLROOT')))
+ return False
+
+
# Fake classes and objects for mocking
class FakeBuild:
def __init__(self, env):