Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-01-13 22:25:35 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-01-13 22:26:43 +0300
commit653c6f2edd82bdb9b9c4f8357be1ae0ed528b824 (patch)
tree833b68bd376a766a51be745cbc19c367cce46b2f /extern/sdlew
parent45d131ff08a577272dcd3177e8bfd230f7d8e3c9 (diff)
SDL wrangler: Support loading SDL2 libraries of different names
Seems different distros might have different naming rules, so need to adopt our code for that.
Diffstat (limited to 'extern/sdlew')
-rw-r--r--extern/sdlew/src/sdlew.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/extern/sdlew/src/sdlew.c b/extern/sdlew/src/sdlew.c
index 6444e6b6081..3b19f0cef47 100644
--- a/extern/sdlew/src/sdlew.c
+++ b/extern/sdlew/src/sdlew.c
@@ -565,16 +565,20 @@ int sdlewInit(void) {
/* Library paths. */
#ifdef _WIN32
/* Expected in c:/windows/system or similar, no path needed. */
- const char *path = "SDL2.dll";
+ const char *paths[] = {"SDL2.dll", NULL};
#elif defined(__APPLE__)
/* Default installation path. */
- const char *path = "/usr/local/cuda/lib/libSDL2.dylib";
+ const char *paths[] = {"/usr/local/cuda/lib/libSDL2.dylib", NULL};
#else
- const char *path = "libSDL2.so";
+ const char *paths[] = {"libSDL2.so",
+ "libSDL2-2.0.so.0",
+ "libSDL.so",
+ NULL};
#endif
static int initialized = 0;
static int result = 0;
- int error;
+ int a, error;
+ SDL_version version;
if (initialized) {
return result;
@@ -589,7 +593,9 @@ int sdlewInit(void) {
}
/* Load library. */
- lib = dynamic_library_open(path);
+ for (a = 0; paths[a] != NULL && lib == NULL; ++a) {
+ lib = dynamic_library_open(paths[a]);
+ }
if (lib == NULL) {
result = SDLEW_ERROR_OPEN_FAILED;
@@ -1089,7 +1095,18 @@ int sdlewInit(void) {
SDL_LIBRARY_FIND(SDL_HasClipboardText);
SDL_LIBRARY_FIND(SDL_GetWindowWMInfo);
- result = SDLEW_SUCCESS;
+ if (SDL_GetVersion == NULL) {
+ result = SDLEW_ERROR_VERSION;
+ }
+ else {
+ SDL_GetVersion(&version);
+ if(version.major < 2) {
+ result = SDLEW_ERROR_VERSION;
+ }
+ else {
+ result = SDLEW_SUCCESS;
+ }
+ }
return result;
}