[Commits] SDL: Android build fixes

libsdl.org revision control commits-owner at libsdl.org
Wed Aug 9 16:21:51 PDT 2017


details:   https://hg.libsdl.org/SDL/rev/4ed2e42b7497
changeset: 11207:4ed2e42b7497
user:      Olli Kallioinen <olli.kallioinen at iki.fi>
date:      Thu Jun 08 22:07:55 2017 +0300
description:
Android build fixes
 -Enabling checking for GCC_ATOMICS also on clang by default. This way all Android ABIs build successfully
 -Android cmake: Threading was not enabled correctly
 -Android cmake: Timers and dynamic lib loading were not included in the sources

diffstat:

 CMakeLists.txt        |  21 ++++++++++++++++++++-
 cmake/sdlchecks.cmake |   2 ++
 2 files changed, 22 insertions(+), 1 deletions(-)

diffs (70 lines):

diff -r 946452867513 -r 4ed2e42b7497 CMakeLists.txt
--- a/CMakeLists.txt	Wed Aug 09 16:20:04 2017 -0700
+++ b/CMakeLists.txt	Thu Jun 08 22:07:55 2017 +0300
@@ -159,6 +159,10 @@
   set(OPT_DEF_ASM FALSE)
 endif()
 
+if(USE_GCC OR USE_CLANG)
+  set(OPT_DEF_GCC_ATOMICS ON)
+endif()
+
 # Default flags, if not set otherwise
 if("$ENV{CFLAGS}" STREQUAL "")
   if(CMAKE_BUILD_TYPE STREQUAL "")
@@ -257,7 +261,7 @@
 option_string(ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto")
 #set_option(DEPENDENCY_TRACKING "Use gcc -MMD -MT dependency tracking" ON)
 set_option(LIBC                "Use the system C library" ${OPT_DEF_LIBC})
-set_option(GCC_ATOMICS         "Use gcc builtin atomics" ${USE_GCC})
+set_option(GCC_ATOMICS         "Use gcc builtin atomics" ${OPT_DEF_GCC_ATOMICS})
 set_option(ASSEMBLY            "Enable assembly routines" ${OPT_DEF_ASM})
 set_option(SSEMATH             "Allow GCC to use SSE floating point math" ${OPT_DEF_SSEMATH})
 set_option(MMX                 "Use MMX assembly routines" ${OPT_DEF_ASM})
@@ -792,12 +796,24 @@
     set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_JOYSTICK_SOURCES})
     set(HAVE_SDL_JOYSTICK TRUE)
   endif()
+  if(SDL_LOADSO)
+    set(SDL_LOADSO_DLOPEN 1)
+    file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dlopen/*.c)
+    set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES})
+    set(HAVE_SDL_LOADSO TRUE)
+  endif()
   if(SDL_POWER)
     set(SDL_POWER_ANDROID 1)
     file(GLOB ANDROID_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/android/*.c)
     set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_POWER_SOURCES})
     set(HAVE_SDL_POWER TRUE)
   endif()
+  if(SDL_TIMERS)
+    set(SDL_TIMER_UNIX 1)
+    file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c)
+    set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES})
+    set(HAVE_SDL_TIMERS TRUE)
+  endif()
   if(SDL_VIDEO)
     set(SDL_VIDEO_DRIVER_ANDROID 1)
     file(GLOB ANDROID_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/android/*.c)
@@ -823,6 +839,9 @@
       list(APPEND EXTRA_LIBS ${OpenGLES1_LIBRARY} ${OpenGLES2_LIBRARY})
     endif()
   endif()
+
+  CheckPTHREAD()
+
   list(APPEND EXTRA_LDFLAGS "-Wl,--undefined=Java_org_libsdl_app_SDLActivity_nativeInit")
 endif()
 
diff -r 946452867513 -r 4ed2e42b7497 cmake/sdlchecks.cmake
--- a/cmake/sdlchecks.cmake	Wed Aug 09 16:20:04 2017 -0700
+++ b/cmake/sdlchecks.cmake	Thu Jun 08 22:07:55 2017 +0300
@@ -859,6 +859,8 @@
     if(LINUX)
       set(PTHREAD_CFLAGS "-D_REENTRANT")
       set(PTHREAD_LDFLAGS "-pthread")
+    elseif(ANDROID)
+      # pthreads are builtin
     elseif(BSDI)
       set(PTHREAD_CFLAGS "-D_REENTRANT -D_THREAD_SAFE")
       set(PTHREAD_LDFLAGS "")


More information about the commits mailing list