From 80d116605ce2d91ec2f1663e6be526d4fd9df73f Mon Sep 17 00:00:00 2001
From: JM Etancelin <jean-matthieu.etancelin@univ-pau.fr>
Date: Wed, 25 Mar 2020 17:27:04 +0100
Subject: [PATCH] improve cmake finding python packages that depends on
 libOpenCL.so when configuring on a frontend machine

---
 CMakeLists.txt | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 91fa7e617..3efd57bc9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -117,7 +117,7 @@ if(USE_CXX)
 endif()
 
 if(USE_FORTRAN)
-  set(LANGLIST ${LANGLIST} Fortran)
+  set(LANGLIST ${LANGLIST} C Fortran)
 endif()
 
 include(HysopVersion)
@@ -148,12 +148,19 @@ find_python_module(colors       REQUIRED) # ansicolor package
 find_python_module(argparse_color_formatter REQUIRED)
 find_python_module(primefac     REQUIRED)
 find_python_module(graph_tool   REQUIRED)
-find_python_module(pyopencl     REQUIRED)
 find_python_module(pyfftw       REQUIRED)
-find_python_module(gpyfft       REQUIRED)
 find_python_module(matplotlib REQUIRED)
 find_python_module(backports.weakref REQUIRED) # python-backports.weakref
 #find_python_module(backports.functools-lru-cache REQUIRED) # python-backports.functools-lru-cache
+
+find_package( OpenCL  )
+if(${OpenCL_LIBRARY})  # Some opencl related python package fails to import on non OpenCL machines (cluster's frontend for instance)
+  find_python_module(pyopencl     REQUIRED)
+  find_python_module(gpyfft       REQUIRED)
+else()
+  find_python_module(pyopencl     )
+  find_python_module(gpyfft       )
+endif()
 # --- MPI ---
 if(USE_MPI)
   find_package(MPI REQUIRED)
-- 
GitLab