From ef0bb6fe6bfe06dd5d4d8b8634863f60a70e37b1 Mon Sep 17 00:00:00 2001 From: "John W. Parent" <45471568+johnwparent@users.noreply.github.com> Date: Thu, 4 Apr 2024 14:14:44 -0400 Subject: [PATCH] Msvc: Determine OneAPI_ROOT from fc compiler path (#43131) If ONEAPI_ROOT is not set as an environment variable, the current approach will raise an error. Instead we can compute the OneAPI_ROOT from the compiler paths like we do with vcvarsall. --- lib/spack/spack/compilers/msvc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spack/spack/compilers/msvc.py b/lib/spack/spack/compilers/msvc.py index cba2b6e41c..d34ef83c3e 100644 --- a/lib/spack/spack/compilers/msvc.py +++ b/lib/spack/spack/compilers/msvc.py @@ -199,7 +199,7 @@ def __init__(self, *args, **kwargs): # for a fortran compiler if paths[2]: # If this found, it sets all the vars - oneapi_root = os.getenv("ONEAPI_ROOT") + oneapi_root = os.path.join(self.cc, "../../..") oneapi_root_setvars = os.path.join(oneapi_root, "setvars.bat") oneapi_version_setvars = os.path.join( oneapi_root, "compiler", str(self.ifx_version), "env", "vars.bat"