aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-06-21 12:06:47 +0200
committerThomas White <taw@physics.org>2018-06-21 12:06:47 +0200
commit3400d1416d8eb07b21595638c6d6e738bd6b1ccc (patch)
tree2d275b76cbfbdb36878ad3e63b790c64fdf9a5a7
parent9564ff6039f73ef5840e1b545189fea50e3ab188 (diff)
Fix OpenCL tests and includes
-rw-r--r--CMakeLists.txt1
-rw-r--r--config.h.cmake.in1
-rw-r--r--libcrystfel/config.h.cmake.in1
-rw-r--r--src/cl-utils.c4
-rw-r--r--src/diffraction-gpu.c4
5 files changed, 10 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dfd1afa6..63ef99f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,6 +64,7 @@ check_include_file(fcntl.h HAVE_FCNTL_H)
check_include_file(stdlib.h HAVE_STDLIB_H)
check_include_file(unistd.h HAVE_UNISTD_H)
+# If we supposedly have OpenCL, check if the header is actually "CL/cl.h"
if (OpenCL_FOUND)
check_include_file(CL/cl.h HAVE_CL_CL_H "-I${OpenCL_INCLUDE_DIRS}")
endif (OpenCL_FOUND)
diff --git a/config.h.cmake.in b/config.h.cmake.in
index a218026c..2dd5d5dd 100644
--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -6,6 +6,7 @@
#cmakedefine HAVE_TIFF
#cmakedefine HAVE_CAIRO
#cmakedefine HAVE_OPENCL
+#cmakedefine HAVE_CL_CL_H
#cmakedefine HAVE_CLOCK_GETTIME
#define PACKAGE_VERSION "${CRYSTFEL_VERSION}"
diff --git a/libcrystfel/config.h.cmake.in b/libcrystfel/config.h.cmake.in
index d1e27a9a..61f458f8 100644
--- a/libcrystfel/config.h.cmake.in
+++ b/libcrystfel/config.h.cmake.in
@@ -3,7 +3,6 @@
#cmakedefine HAVE_CLOCK_GETTIME
#cmakedefine HAVE_CPU_AFFINITY
#cmakedefine HAVE_FFTW
-#cmakedefine HAVE_CL_CL_H
#cmakedefine HAVE_XGANDALF
#cmakedefine HAVE_FDIP
#cmakedefine HAVE_CURSES
diff --git a/src/cl-utils.c b/src/cl-utils.c
index b3ce0de0..a7e500cd 100644
--- a/src/cl-utils.c
+++ b/src/cl-utils.c
@@ -34,7 +34,11 @@
#include <stdio.h>
#include <string.h>
+#ifdef HAVE_CL_CL_H
#include <CL/cl.h>
+#else
+#include <cl.h>
+#endif
#include "utils.h"
diff --git a/src/diffraction-gpu.c b/src/diffraction-gpu.c
index 8c21586a..ea50b3fa 100644
--- a/src/diffraction-gpu.c
+++ b/src/diffraction-gpu.c
@@ -38,7 +38,11 @@
#include <string.h>
#include <complex.h>
+#ifdef HAVE_CL_CL_H
#include <CL/cl.h>
+#else
+#include <cl.h>
+#endif
#include "image.h"
#include "utils.h"