1 if(NOT CMAKE_TOOLCHAIN_FILE)
2 message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for ios/tvos. See ${CMAKE_SOURCE_DIR}/cmake/README.md")
5 set(CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/darwin/${CORE_PLATFORM_NAME_LC}/XBMCApplication.mm)
6 set(PLATFORM_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/xbmc/platform/darwin/${CORE_PLATFORM_NAME_LC}/Info.plist.in)
8 list(APPEND ARCH_DEFINES -DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_EMBEDDED)
9 set(SYSTEM_DEFINES -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
10 -D__STDC_CONSTANT_MACROS -DHAS_IOS_NETWORK -DHAS_ZEROCONF)
11 set(PLATFORM_DIR platform/darwin)
12 set(PLATFORMDEFS_DIR platform/posix)
13 set(CMAKE_SYSTEM_NAME Darwin)
15 set(ARCH ${WITH_ARCH})
17 if(CPU STREQUAL arm64)
20 message(SEND_ERROR "Unknown CPU: ${CPU}")
22 set(CMAKE_OSX_ARCHITECTURES ${CPU})
26 if(NOT APP_RENDER_SYSTEM OR APP_RENDER_SYSTEM STREQUAL "gles")
27 set(PLATFORM_REQUIRED_DEPS OpenGLES)
28 set(APP_RENDER_SYSTEM gles)
29 list(APPEND SYSTEM_DEFINES -DGL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
30 -DGLES_SILENCE_DEPRECATION)
32 message(SEND_ERROR "Currently only OpenGLES rendering is supported. Please set APP_RENDER_SYSTEM to \"gles\"")
35 list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${NATIVEPREFIX})
37 list(APPEND DEPLIBS "-framework CoreFoundation" "-framework CoreVideo"
38 "-framework CoreAudio" "-framework AudioToolbox"
39 "-framework QuartzCore" "-framework MediaPlayer"
40 "-framework CFNetwork" "-framework CoreGraphics"
41 "-framework Foundation" "-framework UIKit"
42 "-framework CoreMedia" "-framework AVFoundation"
43 "-framework VideoToolbox" "-lresolv" "-ObjC"
44 "-framework AVKit" "-framework GameController")
46 # Speech not available on tvOS
47 if(NOT CORE_PLATFORM_NAME_LC STREQUAL tvos)
48 list(APPEND DEPLIBS "-framework Speech")
51 set(ENABLE_OPTICAL OFF CACHE BOOL "" FORCE)
52 set(CMAKE_XCODE_ATTRIBUTE_INLINES_ARE_PRIVATE_EXTERN OFF)
53 set(CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN OFF)
54 set(CMAKE_XCODE_ATTRIBUTE_COPY_PHASE_STRIP OFF)
56 include(cmake/scripts/darwin/Macros.cmake)
59 # Xcode strips dead code by default which breaks wrapping
60 set(CMAKE_XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING OFF)
62 option(ENABLE_XCODE_ADDONBUILD "Enable Xcode automatic addon building?" OFF)
64 # Unify output directories for iOS/tvOS packaging scripts
65 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CORE_BUILD_DIR}/${CORE_BUILD_CONFIG})
66 foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
67 string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
68 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CORE_BUILD_DIR}/${CORE_BUILD_CONFIG})