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