mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
CMake: tvOS support/fixes
To use, set the following CMake variables when running CMake's configuration stage: - CMAKE_SYSTEM_NAME=tvOS - CMAKE_OSX_SYSROOT=<SDK> (examples: appletvos, appletvsimulator, appletvos12.4, /full/path/to/AppleTVOS.sdk, etc.) - CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures> (example: "arm64;x86_64")
This commit is contained in:
parent
b13c951cca
commit
ec65a34b8e
@ -118,6 +118,8 @@ elseif(APPLE)
|
||||
set(DARWIN TRUE)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*")
|
||||
set(MACOSX TRUE)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES ".*tvOS.*")
|
||||
set(TVOS TRUE)
|
||||
endif()
|
||||
# TODO: iOS?
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*")
|
||||
@ -159,7 +161,7 @@ endif()
|
||||
# so we'll just use libusb when it's available. libusb does not support iOS,
|
||||
# so we default to yes on iOS.
|
||||
# TODO: Windows can support libusb, the hid.c file just depends on Unix APIs
|
||||
if(WINDOWS OR IOS OR ANDROID)
|
||||
if(WINDOWS OR IOS OR TVOS OR ANDROID)
|
||||
set(HIDAPI_SKIP_LIBUSB TRUE)
|
||||
else()
|
||||
set(HIDAPI_SKIP_LIBUSB FALSE)
|
||||
@ -1449,7 +1451,7 @@ elseif(APPLE)
|
||||
# !!! FIXME: we need Carbon for some very old API calls in
|
||||
# !!! FIXME: src/video/cocoa/SDL_cocoakeyboard.c, but we should figure out
|
||||
# !!! FIXME: how to dump those.
|
||||
if(NOT IOS)
|
||||
if(DARWIN OR MACOSX)
|
||||
set(SDL_FRAMEWORK_COCOA 1)
|
||||
set(SDL_FRAMEWORK_CARBON 1)
|
||||
endif()
|
||||
@ -1483,15 +1485,17 @@ elseif(APPLE)
|
||||
if(SDL_JOYSTICK)
|
||||
CheckHIDAPI()
|
||||
if(HAVE_HIDAPI)
|
||||
if(IOS)
|
||||
if(IOS OR TVOS)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/ios/hid.m)
|
||||
set(SDL_FRAMEWORK_COREBLUETOOTH 1)
|
||||
endif()
|
||||
endif()
|
||||
if (IOS)
|
||||
if(IOS OR TVOS)
|
||||
file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c)
|
||||
set(SDL_JOYSTICK_MFI 1)
|
||||
set(SDL_FRAMEWORK_COREMOTION 1)
|
||||
if(IOS)
|
||||
set(SDL_FRAMEWORK_COREMOTION 1)
|
||||
endif()
|
||||
set(SDL_FRAMEWORK_GAMECONTROLLER 1)
|
||||
set(HAVE_SDL_SENSORS 1)
|
||||
else()
|
||||
@ -1505,7 +1509,7 @@ elseif(APPLE)
|
||||
endif()
|
||||
|
||||
if(SDL_HAPTIC)
|
||||
if (IOS)
|
||||
if (IOS OR TVOS)
|
||||
file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c)
|
||||
set(SDL_HAPTIC_DUMMY 1)
|
||||
else()
|
||||
@ -1522,7 +1526,7 @@ elseif(APPLE)
|
||||
endif()
|
||||
|
||||
if(SDL_POWER)
|
||||
if (IOS)
|
||||
if (IOS OR TVOS)
|
||||
file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/uikit/*.m)
|
||||
set(SDL_POWER_UIKIT 1)
|
||||
else()
|
||||
@ -1561,7 +1565,7 @@ elseif(APPLE)
|
||||
|
||||
# iOS hack needed - http://code.google.com/p/ios-cmake/ ?
|
||||
if(SDL_VIDEO)
|
||||
if (IOS)
|
||||
if (IOS OR TVOS)
|
||||
set(SDL_VIDEO_DRIVER_UIKIT 1)
|
||||
set(SDL_FRAMEWORK_COREGRAPHICS 1)
|
||||
set(SDL_FRAMEWORK_QUARTZCORE 1)
|
||||
@ -1581,7 +1585,7 @@ elseif(APPLE)
|
||||
endif()
|
||||
|
||||
if(VIDEO_OPENGLES)
|
||||
if(IOS)
|
||||
if(IOS OR TVOS)
|
||||
set(SDL_FRAMEWORK_OPENGLES 1)
|
||||
set(SDL_VIDEO_OPENGL_ES 1)
|
||||
set(SDL_VIDEO_RENDER_OGL_ES 1)
|
||||
@ -1687,7 +1691,7 @@ elseif(APPLE)
|
||||
list(APPEND EXTRA_LIBS ${GAMECONTROLLER})
|
||||
endif()
|
||||
if(SDL_FRAMEWORK_METAL)
|
||||
if(IOS)
|
||||
if(IOS OR TVOS)
|
||||
find_library(METAL Metal)
|
||||
list(APPEND EXTRA_LIBS ${METAL})
|
||||
else()
|
||||
@ -1699,7 +1703,7 @@ elseif(APPLE)
|
||||
list(APPEND EXTRA_LIBS ${OPENGLES})
|
||||
endif()
|
||||
if(SDL_FRAMEWORK_QUARTZCORE)
|
||||
if(IOS)
|
||||
if(IOS OR TVOS)
|
||||
find_library(QUARTZCORE QuartzCore)
|
||||
list(APPEND EXTRA_LIBS ${QUARTZCORE})
|
||||
else()
|
||||
@ -1960,7 +1964,7 @@ if(SDL_SHARED)
|
||||
if (NOT ANDROID)
|
||||
set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
|
||||
endif()
|
||||
if(IOS)
|
||||
if(IOS OR TVOS)
|
||||
set_property(TARGET SDL2 APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc")
|
||||
target_compile_definitions(SDL2 PRIVATE IOS_DYLIB=1)
|
||||
endif()
|
||||
@ -2006,7 +2010,7 @@ if(SDL_STATIC)
|
||||
if (NOT ANDROID)
|
||||
set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
|
||||
endif()
|
||||
if(IOS)
|
||||
if(IOS OR TVOS)
|
||||
set_property(TARGET SDL2-static APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc")
|
||||
endif()
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user