diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-06-18 14:06:12 +1000 |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-06-18 14:06:12 +1000 |
commit | c8ff876789a6dc1721706036de837dd8bea2ca39 (patch) | |
tree | ed825b2e98ae690ddc1d81b07bbfb54531d6f089 | |
parent | 3bb3ad5931d72a83ce5a29b741ad24afe992e49b (diff) |
Detect OpenCL 1.1 at configure time.
-rw-r--r-- | config.tests/unix/opencl11/opencl11.cpp | 60 | ||||
-rw-r--r-- | config.tests/unix/opencl11/opencl11.pro | 2 | ||||
-rwxr-xr-x | configure | 16 | ||||
-rw-r--r-- | src/opencl/opencl.pro | 4 |
4 files changed, 81 insertions, 1 deletions
diff --git a/config.tests/unix/opencl11/opencl11.cpp b/config.tests/unix/opencl11/opencl11.cpp new file mode 100644 index 0000000..3290b2e --- /dev/null +++ b/config.tests/unix/opencl11/opencl11.cpp @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#if defined(__APPLE__) || defined(__MACOSX) +#include <OpenCL/cl_platform.h> +#include <OpenCL/cl.h> +#else +#include <CL/cl_platform.h> +#include <CL/cl.h> +#endif + +// Try to link against the function in the library, even if the +// installed system header happens to be for OpenCL 1.0. +#if !defined(CL_VERSION_1_1) +extern cl_event clCreateUserEvent(cl_context, cl_int *); +#endif + +int main(int, char **) +{ + clCreateUserEvent(0, 0); + return 0; +} diff --git a/config.tests/unix/opencl11/opencl11.pro b/config.tests/unix/opencl11/opencl11.pro new file mode 100644 index 0000000..78d78d7 --- /dev/null +++ b/config.tests/unix/opencl11/opencl11.pro @@ -0,0 +1,2 @@ +SOURCES += opencl11.cpp +CONFIG -= qt @@ -101,6 +101,7 @@ unset QTDIR # initalize internal variables CFG_OPENCL=yes +CFG_OPENCL_1_1=auto CFG_OPENCLGL=auto CFG_GCOV=no @@ -464,13 +465,23 @@ if [ "${CFG_OPENCLGL}" = "auto" ]; then fi fi +# detect OpenCL 1.1 +if [ "${CFG_OPENCL_1_1}" = "auto" ]; then + if "$unixtests/compile.test" "$OPT_QMAKE" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opencl11 "opencl11" $L_FLAGS $I_FLAGS $l_FLAGS $D_FLAGS; then + CFG_OPENCL_1_1=yes + else + CFG_OPENCL_1_1=no + fi +fi + #------------------------------------------------------------------------------- # give feedback on configuration #------------------------------------------------------------------------------- echo "Qt version ............. $QMAKE_VERSION" echo "qmake .................. $OPT_QMAKE" -echo "OpenCL ................. $CFG_OPENCL" +echo "OpenCL 1.0 ............. $CFG_OPENCL" +echo "OpenCL 1.1 ............. $CFG_OPENCL_1_1" echo "OpenCL/OpenGL interop .. $CFG_OPENCLGL" echo "Extra QMAKE_CXXFLAGS ...$D_FLAGS" | sed 's/"//g' echo "Extra INCLUDEPATH ......$INCLUDEPATH" | sed 's/"//g' @@ -493,6 +504,9 @@ QMAKE_OPTIONS="" if [ "x$CFG_OPENCLGL" != "xyes" ] ; then QMAKE_OPTIONS="$QMAKE_OPTIONS CONFIG+=no_cl_gl" fi +if [ "x$CFG_OPENCL_1_1" != "xyes" ] ; then + QMAKE_OPTIONS="$QMAKE_OPTIONS CONFIG+=opencl_1_1" +fi if [ "x$CFG_GCOV" = "xyes" ] ; then QMAKE_OPTIONS="$QMAKE_OPTIONS LIBS*=-fprofile-arcs" QMAKE_OPTIONS="$QMAKE_OPTIONS LIBS*=-ftest-coverage" diff --git a/src/opencl/opencl.pro b/src/opencl/opencl.pro index 81ec045..7258b4b 100644 --- a/src/opencl/opencl.pro +++ b/src/opencl/opencl.pro @@ -64,3 +64,7 @@ PRIVATE_HEADERS += \ HEADERS += $$PRIVATE_HEADERS DEFINES += QT_BUILD_CL_LIB + +opencl_1_1 { + DEFINES += QT_OPENCL_1_1 +} |