Skip to content

Commit e4be09a

Browse files
authored
Merge pull request #8991 from elpaso/opencl-runtime-library-check
Check for libOpenCL.so at runtime
2 parents aef0b65 + 1ae1e72 commit e4be09a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/core/qgsopenclutils.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#include "qgsmessagelog.h"
1919
#include "qgslogger.h"
2020

21+
#include <QLibrary>
22+
2123
#include <QTextStream>
2224
#include <QFile>
2325
#include <QDebug>
@@ -70,6 +72,15 @@ void QgsOpenClUtils::init()
7072
static std::once_flag initialized;
7173
std::call_once( initialized, [ = ]( )
7274
{
75+
QLibrary openCLLib{ QStringLiteral( "OpenCL" ) };
76+
openCLLib.setLoadHints( QLibrary::LoadHint::ResolveAllSymbolsHint );
77+
if ( ! openCLLib.load() )
78+
{
79+
QgsMessageLog::logMessage( QObject::tr( "Error loading OpenCL library: %1" )
80+
.arg( openCLLib.errorString() ),
81+
LOGMESSAGE_TAG, Qgis::Critical );
82+
return;
83+
}
7384
try
7485
{
7586
activate( preferredDevice() );

0 commit comments

Comments
 (0)