Commit d4e96e1153906c458a53c38ccc11a3b64b0dc06a

Sylvain 2021-04-16T09:44:07

Android: enable audio driver OpenSLES when building with CMake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b3a018f..ef53c71 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -999,6 +999,9 @@ if(ANDROID)
     file(GLOB OPENSLES_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/openslES/*.c)
     set(SOURCE_FILES ${SOURCE_FILES} ${OPENSLES_AUDIO_SOURCES})
 
+    find_library(ANDROID_OPENSLES_LIBRARY OpenSLES)
+    list(APPEND EXTRA_LIBS ${ANDROID_DL_LIBRARY} ${ANDROID_OPENSLES_LIBRARY})
+
     set(SDL_AUDIO_DRIVER_AAUDIO 0)
     file(GLOB AAUDIO_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/aaudio/*.c)
     set(SOURCE_FILES ${SOURCE_FILES} ${AAUDIO_AUDIO_SOURCES})
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index d2a4f40..6c7275a 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -264,6 +264,7 @@
 #cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@
 #cmakedefine SDL_AUDIO_DRIVER_ALSA_DYNAMIC @SDL_AUDIO_DRIVER_ALSA_DYNAMIC@
 #cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@
+#cmakedefine SDL_AUDIO_DRIVER_OPENSLES @SDL_AUDIO_DRIVER_OPENSLES@
 #cmakedefine SDL_AUDIO_DRIVER_ARTS @SDL_AUDIO_DRIVER_ARTS@
 #cmakedefine SDL_AUDIO_DRIVER_ARTS_DYNAMIC @SDL_AUDIO_DRIVER_ARTS_DYNAMIC@
 #cmakedefine SDL_AUDIO_DRIVER_COREAUDIO @SDL_AUDIO_DRIVER_COREAUDIO@