Fixed bug 3268 - CMAKE: ios fixes
authorSam Lantinga
Sat, 01 Oct 2016 12:54:48 -0700
changeset 1042155fd4e519a58
parent 10420 0d91817f35e9
child 10422 34fb2e531f7c
Fixed bug 3268 - CMAKE: ios fixes

Martin Gerhardy

ios is not properly handled in the cmake file.

this patch is a start to do so - it properly builds for me with it.
CMakeLists.txt
     1.1 --- a/CMakeLists.txt	Sat Oct 01 12:52:55 2016 -0700
     1.2 +++ b/CMakeLists.txt	Sat Oct 01 12:54:48 2016 -0700
     1.3 @@ -1229,7 +1229,11 @@
     1.4  
     1.5    if(SDL_JOYSTICK)
     1.6      set(SDL_JOYSTICK_IOKIT 1)
     1.7 -    file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c)
     1.8 +    if (IOS)
     1.9 +      file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m)
    1.10 +    else()
    1.11 +      file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c)
    1.12 +    endif()
    1.13      set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
    1.14      set(HAVE_SDL_JOYSTICK TRUE)
    1.15      set(SDL_FRAMEWORK_IOKIT 1)
    1.16 @@ -1238,7 +1242,12 @@
    1.17  
    1.18    if(SDL_HAPTIC)
    1.19      set(SDL_HAPTIC_IOKIT 1)
    1.20 -    file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/darwin/*.c)
    1.21 +    if (IOS)
    1.22 +      file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/dummy/*.c)
    1.23 +      set(SDL_HAPTIC_DUMMY 1)
    1.24 +    else()
    1.25 +      file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/darwin/*.c)
    1.26 +    endif()
    1.27      set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
    1.28      set(HAVE_SDL_HAPTIC TRUE)
    1.29      set(SDL_FRAMEWORK_IOKIT 1)
    1.30 @@ -1250,7 +1259,11 @@
    1.31  
    1.32    if(SDL_POWER)
    1.33      set(SDL_POWER_MACOSX 1)
    1.34 -    file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/macosx/*.c)
    1.35 +    if (IOS)
    1.36 +      file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/uikit/*.m)
    1.37 +    else()
    1.38 +      file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/macosx/*.c)
    1.39 +    endif()
    1.40      set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES})
    1.41      set(HAVE_SDL_POWER TRUE)
    1.42      set(SDL_FRAMEWORK_CARBON 1)
    1.43 @@ -1304,12 +1317,18 @@
    1.44  
    1.45    # iOS hack needed - http://code.google.com/p/ios-cmake/ ?
    1.46    if(SDL_VIDEO)
    1.47 -    CheckCOCOA()
    1.48 -    if(VIDEO_OPENGL)
    1.49 -      set(SDL_VIDEO_OPENGL 1)
    1.50 -      set(SDL_VIDEO_OPENGL_CGL 1)
    1.51 -      set(SDL_VIDEO_RENDER_OGL 1)
    1.52 -      set(HAVE_VIDEO_OPENGL TRUE)
    1.53 +    if (IOS)
    1.54 +      set(SDL_VIDEO_DRIVER_HAIKU 1)
    1.55 +      file(GLOB UIKITVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/uikit/*.m)
    1.56 +      set(SOURCE_FILES ${SOURCE_FILES} ${UIKITVIDEO_SOURCES})
    1.57 +    else()
    1.58 +      CheckCOCOA()
    1.59 +      if(VIDEO_OPENGL)
    1.60 +        set(SDL_VIDEO_OPENGL 1)
    1.61 +        set(SDL_VIDEO_OPENGL_CGL 1)
    1.62 +        set(SDL_VIDEO_RENDER_OGL 1)
    1.63 +        set(HAVE_VIDEO_OPENGL TRUE)
    1.64 +      endif()
    1.65      endif()
    1.66    endif()
    1.67