OpenCL: Support multiple ABI libraries on Linux
Solves issue reported in T49144.
This commit is contained in:
parent
e2f323c3ec
commit
f732293147
2
extern/clew/README.blender
vendored
2
extern/clew/README.blender
vendored
@ -1,5 +1,5 @@
|
||||
Project: OpenCL Wrangler
|
||||
URL: https://github.com/OpenCLWrangler/clew
|
||||
License: Apache 2.0
|
||||
Upstream version: 277db43
|
||||
Upstream version: 309a653
|
||||
Local modifications: None
|
||||
|
23
extern/clew/src/clew.c
vendored
23
extern/clew/src/clew.c
vendored
@ -137,6 +137,17 @@ PFNCLCREATEFROMGLTEXTURE3D __clewCreateFromGLTexture3D = NULL;
|
||||
#endif
|
||||
PFNCLGETGLCONTEXTINFOKHR __clewGetGLContextInfoKHR = NULL;
|
||||
|
||||
static CLEW_DYNLIB_HANDLE dynamic_library_open_find(const char **paths) {
|
||||
int i = 0;
|
||||
while (paths[i] != NULL) {
|
||||
CLEW_DYNLIB_HANDLE lib = CLEW_DYNLIB_OPEN(paths[i]);
|
||||
if (lib != NULL) {
|
||||
return lib;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void clewExit(void)
|
||||
{
|
||||
@ -151,11 +162,15 @@ static void clewExit(void)
|
||||
int clewInit()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
const char *path = "OpenCL.dll";
|
||||
const char *paths[] = {"OpenCL.dll", NULL};
|
||||
#elif defined(__APPLE__)
|
||||
const char *path = "/Library/Frameworks/OpenCL.framework/OpenCL";
|
||||
const char *paths[] = {"/Library/Frameworks/OpenCL.framework/OpenCL", NULL};
|
||||
#else
|
||||
const char *path = "libOpenCL.so";
|
||||
const char *paths[] = {"libOpenCL.so",
|
||||
"libOpenCL.so.0",
|
||||
"libOpenCL.so.1",
|
||||
"libOpenCL.so.2",
|
||||
NULL};
|
||||
#endif
|
||||
|
||||
int error = 0;
|
||||
@ -167,7 +182,7 @@ int clewInit()
|
||||
}
|
||||
|
||||
// Load library
|
||||
module = CLEW_DYNLIB_OPEN(path);
|
||||
module = dynamic_library_open_find(paths);
|
||||
|
||||
// Check for errors
|
||||
if (module == NULL)
|
||||
|
Loading…
x
Reference in New Issue
Block a user