From 3f823b5e7414b8aa16460af4248edeb6a76efc9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lorenz=20H=C3=BCdepohl?= <lorenz.huedepohl@rzg.mpg.de>
Date: Wed, 10 Jul 2019 10:28:15 +0200
Subject: [PATCH] Madness for Sebastian

In order to be able to figure out the matching MKL version for a given
compiler/MPI repository we emit a new macro '%matching_mkl_version' in
the cases this makes sense
---
 mpcdf_common.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/mpcdf_common.py b/mpcdf_common.py
index da606c9..57e70f9 100644
--- a/mpcdf_common.py
+++ b/mpcdf_common.py
@@ -480,9 +480,16 @@ Macros:
         a.tail = "\n  "
         r.tail = "\n  "
 
+        # In order to be able to figure out the matching MKL version for a given
+        # compiler/MPI repository we emit a new macro '%matching_mkl_version' in
+        # the cases this makes sense
+        matching_mkl = []
         prjconf.append("%if %_repository == {0}".format(name))
         for prefer in prefers(name):
+            if prefer.startswith("mkl_"):
+                matching_mkl.append(prefer)
             prjconf.append("Prefer: " + prefer)
+
         prjconf.append("Macros:")
 
         prjconf.append("%is_compiler_repository {0}".format(1 if is_compiler else 0))
@@ -497,6 +504,12 @@ Macros:
         if is_cuda:
             prjconf.append("%cuda_repository {0}".format(cuda_repo))
 
+        if matching_mkl:
+            matching_mkl, = matching_mkl
+            matching_mkl, _ = matching_mkl[len("mkl_"):].split("-module")
+            matching_mkl = matching_mkl.replace("_", ".")
+            prjconf.append("%matching_mkl_version {0}".format(matching_mkl))
+
         for macro, value in kwargs.items():
             prjconf.append("%{0} {1}".format(macro, value))
 
-- 
GitLab