diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-11-17 14:35:36 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-11-17 15:43:18 +0300 |
commit | 80d1d624d378d4d8c03fb26ef286baf5479b6497 (patch) | |
tree | d5ae6545d0318d8e0448d3a084a15e72aff6e2a5 /source/blender/makesrna | |
parent | 90bf426554a7cc1d429f2dd9a02edbcbeb51ceec (diff) |
Support dynamic loading of SDL libraries
This is mainly to address old issue when one need to have SDL library installed
in order to use our official builds. Some hip distros already installs SDL,
but it's not quite the same across all the variety of the distros.
We also now switching to SDL-2.0, most of the distros have it in repositories
already, so it shouldn't be huge deal to install it if needed.
Reviewers: campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D878
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/SConscript | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/CMakeLists.txt | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/SConscript | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 47 |
4 files changed, 38 insertions, 21 deletions
diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index 4e7a564e9d4..0d215fbcf81 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -122,6 +122,9 @@ if env['WITH_BF_CYCLES']: defs.append('WITH_CYCLES_DEBUG') if env['WITH_BF_SDL']: + if env['WITH_BF_SDL_DYNLOAD']: + defs.append('WITH_SDL_DYNLOAD') + incs += ' #extern/sdlew/include' defs.append('WITH_SDL') if env['WITH_BF_OPENAL']: diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 5d736f9c011..e64743c5536 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -241,6 +241,12 @@ if(WITH_MOD_OCEANSIM) endif() if(WITH_SDL) + if(WITH_SDL_DYNLOAD) + add_definitions(-DWITH_SDL_DYNLOAD) + list(APPEND INC + ../../../../extern/sdlew/include + ) + endif() add_definitions(-DWITH_SDL) endif() diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index d1eab5ca9db..28151fe5db1 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -123,6 +123,9 @@ if env['WITH_BF_FFTW3']: defs.append('WITH_FFTW3') if env['WITH_BF_SDL']: + if env['WITH_BF_SDL_DYNLOAD']: + defs.append('WITH_SDL_DYNLOAD') + incs += ' #extern/sdlew/include' defs.append('WITH_SDL') if env['WITH_BF_OPENAL']: diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 5c713e8de75..ab5039df627 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -104,6 +104,10 @@ EnumPropertyItem navigation_mode_items[] = { #include "BKE_addon.h" +#ifdef WITH_SDL_DYNLOAD +# include "sdlew.h" +#endif + static void rna_userdef_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { WM_main_add_notifier(NC_WINDOW, NULL); @@ -510,37 +514,38 @@ static EnumPropertyItem *rna_userdef_compute_device_itemf(bContext *UNUSED(C), P static EnumPropertyItem *rna_userdef_audio_device_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { -#ifdef WITH_JACK - int jack_supported = sound_is_jack_supported(); - - if (jack_supported) { - return audio_device_items; - } - else { - int index = 0; - int totitem = 0; - EnumPropertyItem *item = NULL; + int index = 0; + int totitem = 0; + EnumPropertyItem *item = NULL; - /* NONE */ - RNA_enum_item_add(&item, &totitem, &audio_device_items[index++]); + /* NONE */ + RNA_enum_item_add(&item, &totitem, &audio_device_items[index++]); #ifdef WITH_SDL - RNA_enum_item_add(&item, &totitem, &audio_device_items[index++]); +# ifdef WITH_SDL_DYNLOAD + if (sdlewInit() == SDLEW_SUCCESS) +# endif + { + RNA_enum_item_add(&item, &totitem, &audio_device_items[index]); + } + index++; #endif #ifdef WITH_OPENAL - RNA_enum_item_add(&item, &totitem, &audio_device_items[index++]); + RNA_enum_item_add(&item, &totitem, &audio_device_items[index++]); #endif - RNA_enum_item_end(&item, &totitem); - *r_free = true; - - return item; +#ifdef WITH_JACK + if (sound_is_jack_supported()) { + RNA_enum_item_add(&item, &totitem, &audio_device_items[index]); } -#else - (void)r_free; - return audio_device_items; + index++; #endif + + RNA_enum_item_end(&item, &totitem); + *r_free = true; + + return item; } #ifdef WITH_INTERNATIONAL |