CMakeLists.txt
changeset 11071 a4c90708251c
parent 11070 61401688628e
child 11081 eea7f98a37e4
     1.1 --- a/CMakeLists.txt	Tue Jun 06 13:39:29 2017 -0400
     1.2 +++ b/CMakeLists.txt	Sun Jun 04 21:25:57 2017 +0300
     1.3 @@ -137,7 +137,9 @@
     1.4  
     1.5  # Default option knobs
     1.6  if(APPLE OR ARCH_64)
     1.7 -  set(OPT_DEF_SSEMATH ON)
     1.8 +  if(NOT "${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm")
     1.9 +    set(OPT_DEF_SSEMATH ON)
    1.10 +  endif()
    1.11  endif()
    1.12  if(UNIX OR MINGW OR MSYS)
    1.13    set(OPT_DEF_LIBC ON)
    1.14 @@ -543,7 +545,10 @@
    1.15      if(NOT SSEMATH)
    1.16        if(SSE OR SSE2 OR SSE3)
    1.17          if(USE_GCC)
    1.18 -          list(APPEND EXTRA_CFLAGS "-mfpmath=387")
    1.19 +          check_c_compiler_flag(-mfpmath=387 HAVE_FP_387)
    1.20 +          if(HAVE_FP_387)
    1.21 +            list(APPEND EXTRA_CFLAGS "-mfpmath=387")
    1.22 +          endif()
    1.23          endif()
    1.24          set(HAVE_SSEMATH TRUE)
    1.25        endif()
    1.26 @@ -752,8 +757,19 @@
    1.27  if(ANDROID)
    1.28    file(GLOB ANDROID_CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/android/*.c)
    1.29    set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_CORE_SOURCES})
    1.30 +
    1.31 +  # SDL_spinlock.c Needs to be compiled in ARM mode.
    1.32 +  # There seems to be no better way currently to set the ARM mode.
    1.33 +  # see: https://issuetracker.google.com/issues/62264618
    1.34 +  # Another option would be to set ARM mode to all compiled files
    1.35 +  check_c_compiler_flag(-marm HAVE_ARM_MODE)
    1.36 +  if(HAVE_ARM_MODE)
    1.37 +    set_source_files_properties(${SDL2_SOURCE_DIR}/src/atomic/SDL_spinlock.c PROPERTIES COMPILE_FLAGS -marm)
    1.38 +  endif()
    1.39 +
    1.40    file(GLOB ANDROID_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/android/*.c)
    1.41 -  set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_MAIN_SOURCES})
    1.42 +  set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${ANDROID_MAIN_SOURCES})
    1.43 +
    1.44    if(SDL_AUDIO)
    1.45      set(SDL_AUDIO_DRIVER_ANDROID 1)
    1.46      file(GLOB ANDROID_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/android/*.c)
    1.47 @@ -784,12 +800,23 @@
    1.48      set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_VIDEO_SOURCES})
    1.49      set(HAVE_SDL_VIDEO TRUE)
    1.50  
    1.51 +    # Core stuff
    1.52 +    find_library(ANDROID_DL_LIBRARY dl)
    1.53 +    find_library(ANDROID_LOG_LIBRARY log)
    1.54 +    find_library(ANDROID_LIBRARY_LIBRARY android)
    1.55 +    list(APPEND EXTRA_LIBS ${ANDROID_DL_LIBRARY} ${ANDROID_LOG_LIBRARY} ${ANDROID_LIBRARY_LIBRARY})
    1.56 +    add_definitions(-DGL_GLEXT_PROTOTYPES)
    1.57 +
    1.58      #enable gles
    1.59      if(VIDEO_OPENGLES)
    1.60        set(SDL_VIDEO_OPENGL_EGL 1)
    1.61        set(HAVE_VIDEO_OPENGLES TRUE)
    1.62        set(SDL_VIDEO_OPENGL_ES2 1)
    1.63        set(SDL_VIDEO_RENDER_OGL_ES2 1)
    1.64 +
    1.65 +      find_library(OpenGLES1_LIBRARY GLESv1_CM)
    1.66 +      find_library(OpenGLES2_LIBRARY GLESv2)
    1.67 +      list(APPEND EXTRA_LIBS ${OpenGLES1_LIBRARY} ${OpenGLES2_LIBRARY})
    1.68      endif()
    1.69    endif()
    1.70    list(APPEND EXTRA_LDFLAGS "-Wl,--undefined=Java_org_libsdl_app_SDLActivity_nativeInit")
    1.71 @@ -848,7 +875,7 @@
    1.72        set(SDL_VIDEO_RENDER_OGL_ES2 1)
    1.73      endif()
    1.74    endif()
    1.75 -elseif(UNIX AND NOT APPLE)
    1.76 +elseif(UNIX AND NOT APPLE AND NOT ANDROID)
    1.77    if(SDL_AUDIO)
    1.78      if(SYSV5 OR SOLARIS OR HPUX)
    1.79          set(SDL_AUDIO_DRIVER_SUNAUDIO 1)
    1.80 @@ -1573,7 +1600,7 @@
    1.81  
    1.82  if(SDL_SHARED)
    1.83    add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES})
    1.84 -  if(UNIX)
    1.85 +  if(UNIX AND NOT ANDROID)
    1.86      set_target_properties(SDL2 PROPERTIES
    1.87        VERSION ${LT_VERSION}
    1.88        SOVERSION ${LT_REVISION}