Browse Source

Another sweep for tvOS conditional code branch.

Yao Wei Tjong 姚伟忠 8 years ago
parent
commit
c7a0149dc9

+ 1 - 1
CMake/Modules/CheckCompilerToolchain.cmake

@@ -169,7 +169,7 @@ else ()
     if (SIZEOF_POINTER EQUAL 8)
     if (SIZEOF_POINTER EQUAL 8)
         set (NATIVE_64BIT 1)
         set (NATIVE_64BIT 1)
     endif ()
     endif ()
-    # Android arm64 compiler only emits __aarch64__ while iOS arm64 emits __aarch64__, __arm64__, and __arm__; for armv7a all emit __arm__
+    # Android arm64 compiler only emits __aarch64__ while iOS/tvOS arm64 emits __aarch64__ and __arm64__; for armv7a all emit __arm__
     check_native_define ("__(arm|aarch64)__" ARM)
     check_native_define ("__(arm|aarch64)__" ARM)
     # For completeness sake as currently we do not support MIPS and PowerPC (yet)
     # For completeness sake as currently we do not support MIPS and PowerPC (yet)
     check_native_define (__MIPSEL__ MIPS)
     check_native_define (__MIPSEL__ MIPS)

+ 4 - 4
CMake/Modules/FindUrho3D.cmake

@@ -238,9 +238,9 @@ else ()
                 else ()
                 else ()
                     set (CMAKE_TRY_COMPILE_CONFIGURATION Debug)
                     set (CMAKE_TRY_COMPILE_CONFIGURATION Debug)
                 endif ()
                 endif ()
-            elseif (IOS)
+            elseif (APPLE AND ARM)
                 # Debug build does not produce universal binary library, so we could not test compile against the library
                 # Debug build does not produce universal binary library, so we could not test compile against the library
-                execute_process (COMMAND lipo -info ${URHO3D_LIBRARIES} COMMAND grep -cq armv7 RESULT_VARIABLE SKIP_COMPILE_TEST OUTPUT_QUIET ERROR_QUIET)
+                execute_process (COMMAND lipo -info ${URHO3D_LIBRARIES} COMMAND grep -cq arm RESULT_VARIABLE SKIP_COMPILE_TEST OUTPUT_QUIET ERROR_QUIET)
             endif ()
             endif ()
             set (COMPILER_FLAGS "${COMPILER_32BIT_FLAG} ${CMAKE_REQUIRED_FLAGS}")
             set (COMPILER_FLAGS "${COMPILER_32BIT_FLAG} ${CMAKE_REQUIRED_FLAGS}")
             if (SKIP_COMPILE_TEST OR URHO3D_LIB_TYPE STREQUAL MODULE)
             if (SKIP_COMPILE_TEST OR URHO3D_LIB_TYPE STREQUAL MODULE)
@@ -267,8 +267,8 @@ else ()
             if (URHO3D_COMPILE_RESULT)
             if (URHO3D_COMPILE_RESULT)
                 # Auto-discover build options used by the found library and export header
                 # Auto-discover build options used by the found library and export header
                 file (READ ${URHO3D_BASE_INCLUDE_DIR}/Urho3D.h EXPORT_HEADER)
                 file (READ ${URHO3D_BASE_INCLUDE_DIR}/Urho3D.h EXPORT_HEADER)
-                if (IOS)
-                    # Since Urho3D library for iOS is a universal binary (except when it was a Debug build), we need another way to find out the compiler ABI when the library was built
+                if (APPLE AND ARM)
+                    # Since Urho3D library for Apple/ARM platforms is a universal binary (except when it was a Debug build), we need another way to find out the compiler ABI the library was built for
                     execute_process (COMMAND lipo -info ${URHO3D_LIBRARIES} COMMAND grep -c x86_64 OUTPUT_VARIABLE ABI_64BIT ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
                     execute_process (COMMAND lipo -info ${URHO3D_LIBRARIES} COMMAND grep -c x86_64 OUTPUT_VARIABLE ABI_64BIT ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
                 elseif (MSVC)
                 elseif (MSVC)
                     if (COMPILER_STATIC_RUNTIME_FLAGS)
                     if (COMPILER_STATIC_RUNTIME_FLAGS)

+ 11 - 11
CMake/Modules/UrhoCommon.cmake

@@ -141,10 +141,10 @@ option (URHO3D_NAVIGATION "Enable navigation support" TRUE)
 cmake_dependent_option (URHO3D_NETWORK "Enable networking support" TRUE "NOT WEB AND EXCEPTIONS" FALSE)
 cmake_dependent_option (URHO3D_NETWORK "Enable networking support" TRUE "NOT WEB AND EXCEPTIONS" FALSE)
 option (URHO3D_PHYSICS "Enable physics support" TRUE)
 option (URHO3D_PHYSICS "Enable physics support" TRUE)
 option (URHO3D_URHO2D "Enable 2D graphics and physics support" TRUE)
 option (URHO3D_URHO2D "Enable 2D graphics and physics support" TRUE)
-if (ARM AND NOT ANDROID AND NOT RPI AND NOT IOS AND NOT TVOS)
+if (ARM AND NOT ANDROID AND NOT RPI AND NOT APPLE)
     set (ARM_ABI_FLAGS "" CACHE STRING "Specify ABI compiler flags (ARM on Linux platform only); e.g. Orange-Pi Mini 2 could use '-mcpu=cortex-a7 -mfpu=neon-vfpv4'")
     set (ARM_ABI_FLAGS "" CACHE STRING "Specify ABI compiler flags (ARM on Linux platform only); e.g. Orange-Pi Mini 2 could use '-mcpu=cortex-a7 -mfpu=neon-vfpv4'")
 endif ()
 endif ()
-if (IOS OR TVOS OR (RPI AND "${RPI_ABI}" MATCHES NEON) OR (ARM AND (URHO3D_64BIT OR "${ARM_ABI_FLAGS}" MATCHES neon)))    # Stringify in case RPI_ABI/ARM_ABI_FLAGS is not set explicitly
+if ((RPI AND "${RPI_ABI}" MATCHES NEON) OR (ARM AND (APPLE OR URHO3D_64BIT OR "${ARM_ABI_FLAGS}" MATCHES neon)))    # Stringify in case RPI_ABI/ARM_ABI_FLAGS is not set explicitly
     # TODO: remove this logic when the compiler flags are set in each toolchain file, such that the CheckCompilerToolchain can perform the check automatically
     # TODO: remove this logic when the compiler flags are set in each toolchain file, such that the CheckCompilerToolchain can perform the check automatically
     set (NEON 1)
     set (NEON 1)
 endif ()
 endif ()
@@ -261,9 +261,9 @@ endif ()
 cmake_dependent_option (URHO3D_MINIDUMPS "Enable minidumps on crash (VS only)" TRUE "MSVC" FALSE)
 cmake_dependent_option (URHO3D_MINIDUMPS "Enable minidumps on crash (VS only)" TRUE "MSVC" FALSE)
 # By default Windows platform setups main executable as Windows application with WinMain() as entry point
 # By default Windows platform setups main executable as Windows application with WinMain() as entry point
 cmake_dependent_option (URHO3D_WIN32_CONSOLE "Use console main() instead of WinMain() as entry point when setting up Windows executable targets (Windows platform only)" FALSE "WIN32" FALSE)
 cmake_dependent_option (URHO3D_WIN32_CONSOLE "Use console main() instead of WinMain() as entry point when setting up Windows executable targets (Windows platform only)" FALSE "WIN32" FALSE)
-cmake_dependent_option (URHO3D_MACOSX_BUNDLE "Use MACOSX_BUNDLE when setting up macOS executable targets (Xcode/macOS platform only)" FALSE "XCODE AND NOT IOS AND NOT TVOS" FALSE)
-if (CMAKE_CROSSCOMPILING AND NOT ANDROID AND NOT IOS AND NOT TVOS)
-    set (URHO3D_SCP_TO_TARGET "" CACHE STRING "Use scp to transfer executables to target system (non-Android cross-compiling build only), SSH digital key must be setup first for this to work, typical value has a pattern of usr@tgt:remote-loc")
+cmake_dependent_option (URHO3D_MACOSX_BUNDLE "Use MACOSX_BUNDLE when setting up macOS executable targets (Xcode/macOS platform only)" FALSE "XCODE AND NOT ARM" FALSE)
+if (CMAKE_CROSSCOMPILING AND NOT ANDROID AND NOT APPLE)
+    set (URHO3D_SCP_TO_TARGET "" CACHE STRING "Use scp to transfer executables to target system (RPI and generic ARM cross-compiling build only), SSH digital key must be setup first for this to work, typical value has a pattern of usr@tgt:remote-loc")
 else ()
 else ()
     unset (URHO3D_SCP_TO_TARGET CACHE)
     unset (URHO3D_SCP_TO_TARGET CACHE)
 endif ()
 endif ()
@@ -527,8 +527,8 @@ if (APPLE)
             endif ()
             endif ()
         endif ()
         endif ()
     endif ()
     endif ()
-    # Common OSX and iOS/tvOS bundle setup
-    if (IOS OR TVOS OR URHO3D_MACOSX_BUNDLE)
+    # Common macOS, iOS, and tvOS bundle setup
+    if (URHO3D_MACOSX_BUNDLE OR (APPLE AND ARM))
         # Only set the bundle properties to its default when they are not explicitly specified by user
         # Only set the bundle properties to its default when they are not explicitly specified by user
         if (NOT MACOSX_BUNDLE_GUI_IDENTIFIER)
         if (NOT MACOSX_BUNDLE_GUI_IDENTIFIER)
             set (MACOSX_BUNDLE_GUI_IDENTIFIER com.github.urho3d.\${PRODUCT_NAME:rfc1034identifier:lower})
             set (MACOSX_BUNDLE_GUI_IDENTIFIER com.github.urho3d.\${PRODUCT_NAME:rfc1034identifier:lower})
@@ -735,7 +735,7 @@ else ()
 endif ()
 endif ()
 # LuaJIT specific - extra linker flags for linking against LuaJIT (adapted from LuaJIT's original Makefile)
 # LuaJIT specific - extra linker flags for linking against LuaJIT (adapted from LuaJIT's original Makefile)
 if (URHO3D_LUAJIT)
 if (URHO3D_LUAJIT)
-    if (URHO3D_64BIT AND APPLE AND NOT IOS AND NOT TVOS)
+    if (URHO3D_64BIT AND APPLE AND NOT ARM)
         # 64-bit macOS: it simply won't work without these flags; if you are reading this comment then you may want to know the following also
         # 64-bit macOS: it simply won't work without these flags; if you are reading this comment then you may want to know the following also
         # it's recommended to rebase all (self-compiled) shared libraries which are loaded at runtime on OSX/x64 (e.g. C extension modules for Lua), see: man rebase
         # it's recommended to rebase all (self-compiled) shared libraries which are loaded at runtime on OSX/x64 (e.g. C extension modules for Lua), see: man rebase
         set (LUAJIT_EXE_LINKER_FLAGS_APPLE "-pagezero_size 10000 -image_base 100000000")
         set (LUAJIT_EXE_LINKER_FLAGS_APPLE "-pagezero_size 10000 -image_base 100000000")
@@ -876,7 +876,7 @@ macro (define_dependency_libs TARGET)
                 list (APPEND LIBS dbghelp)
                 list (APPEND LIBS dbghelp)
             endif ()
             endif ()
         elseif (APPLE)
         elseif (APPLE)
-            if (IOS OR TVOS)
+            if (ARM)
                 list (APPEND LIBS "-framework AudioToolbox" "-framework AVFoundation" "-framework CoreAudio" "-framework CoreGraphics" "-framework CoreMotion" "-framework Foundation" "-framework GameController" "-framework OpenGLES" "-framework QuartzCore" "-framework UIKit")
                 list (APPEND LIBS "-framework AudioToolbox" "-framework AVFoundation" "-framework CoreAudio" "-framework CoreGraphics" "-framework CoreMotion" "-framework Foundation" "-framework GameController" "-framework OpenGLES" "-framework QuartzCore" "-framework UIKit")
             else ()
             else ()
                 list (APPEND LIBS "-framework AudioToolbox" "-framework Carbon" "-framework Cocoa" "-framework CoreFoundation" "-framework SystemConfiguration" "-framework CoreAudio" "-framework CoreServices" "-framework CoreVideo" "-framework ForceFeedback" "-framework IOKit" "-framework OpenGL")
                 list (APPEND LIBS "-framework AudioToolbox" "-framework Carbon" "-framework Cocoa" "-framework CoreFoundation" "-framework SystemConfiguration" "-framework CoreAudio" "-framework CoreServices" "-framework CoreVideo" "-framework ForceFeedback" "-framework IOKit" "-framework OpenGL")
@@ -1053,7 +1053,7 @@ macro (define_resource_dirs)
         if (NOT RESOURCE_FILES)
         if (NOT RESOURCE_FILES)
             # Default app bundle icon
             # Default app bundle icon
             set (RESOURCE_FILES ${CMAKE_SOURCE_DIR}/bin/Data/Textures/UrhoIcon.icns)
             set (RESOURCE_FILES ${CMAKE_SOURCE_DIR}/bin/Data/Textures/UrhoIcon.icns)
-            if (IOS OR TVOS)
+            if (ARM)
                 # Default app icon on the iOS/tvOS home screen
                 # Default app icon on the iOS/tvOS home screen
                 list (APPEND RESOURCE_FILES ${CMAKE_SOURCE_DIR}/bin/Data/Textures/UrhoIcon.png)
                 list (APPEND RESOURCE_FILES ${CMAKE_SOURCE_DIR}/bin/Data/Textures/UrhoIcon.png)
             endif ()
             endif ()
@@ -1476,7 +1476,7 @@ macro (setup_executable)
                 list (APPEND FILES ${LOCATION}/${TARGET_NAME}.${EXT})
                 list (APPEND FILES ${LOCATION}/${TARGET_NAME}.${EXT})
             endforeach ()
             endforeach ()
             install (FILES ${FILES} DESTINATION ${DEST_BUNDLE_DIR} OPTIONAL)
             install (FILES ${FILES} DESTINATION ${DEST_BUNDLE_DIR} OPTIONAL)
-        elseif (DEST_RUNTIME_DIR AND (DEST_BUNDLE_DIR OR NOT IOS OR NOT TVOS))
+        elseif (DEST_RUNTIME_DIR AND (DEST_BUNDLE_DIR OR NOT (IOS OR TVOS)))
             install (TARGETS ${TARGET_NAME} RUNTIME DESTINATION ${DEST_RUNTIME_DIR} BUNDLE DESTINATION ${DEST_BUNDLE_DIR})
             install (TARGETS ${TARGET_NAME} RUNTIME DESTINATION ${DEST_RUNTIME_DIR} BUNDLE DESTINATION ${DEST_BUNDLE_DIR})
             if (WIN32 AND NOT ARG_NODEPS AND URHO3D_LIB_TYPE STREQUAL SHARED AND NOT URHO3D_DLL_INSTALLED)
             if (WIN32 AND NOT ARG_NODEPS AND URHO3D_LIB_TYPE STREQUAL SHARED AND NOT URHO3D_DLL_INSTALLED)
                 if (TARGET Urho3D)
                 if (TARGET Urho3D)

+ 2 - 2
CMakeLists.txt

@@ -166,8 +166,8 @@ if (NOT DEFINED ENV{RELEASE_TAG})
 endif ()
 endif ()
 include (CPack)
 include (CPack)
 
 
-# Setup MacOSX and iOS/tvOS bundle variables
-if (IOS OR TVOS OR URHO3D_MACOSX_BUNDLE)
+# Setup macOS, iOS, and tvOS bundle variables
+if (URHO3D_MACOSX_BUNDLE OR (APPLE AND ARM))
     if (NOT MACOSX_BUNDLE_ICON_FILE)
     if (NOT MACOSX_BUNDLE_ICON_FILE)
         set (MACOSX_BUNDLE_ICON_FILE UrhoIcon)
         set (MACOSX_BUNDLE_ICON_FILE UrhoIcon)
     endif ()
     endif ()

+ 1 - 1
Rakefile

@@ -617,7 +617,7 @@ task :ci_package_upload do
   # Make the package
   # Make the package
   puts "Packaging artifacts...\n\n"; $stdout.flush
   puts "Packaging artifacts...\n\n"; $stdout.flush
   if ENV['IOS'] || ENV['TVOS']
   if ENV['IOS'] || ENV['TVOS']
-    # There is a bug in CMake/CPack that causes the 'package' target failed to build for iOS and tvOS platforms, workaround by calling cpack directly; CMake 3.4 runs the target successfully, however, the result tarball is incomplete (somehow it misses packaging the library itself, another bug?)
+    # TODO: There is a bug in CMake/CPack that causes the 'package' target failed to build for iOS and tvOS platforms, workaround by calling cpack directly; CMake 3.4 runs the target successfully, however, the result tarball is incomplete (somehow it misses packaging the library itself, another bug?)
     system 'cd ../Build && cpack -G TGZ 2>/dev/null' or abort 'Failed to make binary package'
     system 'cd ../Build && cpack -G TGZ 2>/dev/null' or abort 'Failed to make binary package'
   else
   else
     if ENV['ANDROID']
     if ENV['ANDROID']

+ 1 - 1
Source/CMakeLists.txt

@@ -135,7 +135,7 @@ endif ()
 add_subdirectory (Tools)
 add_subdirectory (Tools)
 
 
 # Urho3D samples
 # Urho3D samples
-# Samples are built on iOS platform too when enabled. Currently there is no available mechanism to package each sample apps into individual *.apk
+# Samples are built on iOS/tvOS platform too when enabled. Currently there is no available mechanism to package each sample apps into individual *.apk
 # for Android platform, so we deploy all samples into one apk and use a simple list view activity launcher to select the sample to run
 # for Android platform, so we deploy all samples into one apk and use a simple list view activity launcher to select the sample to run
 if (URHO3D_SAMPLES)
 if (URHO3D_SAMPLES)
     add_subdirectory (Samples)
     add_subdirectory (Samples)

+ 3 - 3
Source/ThirdParty/LuaJIT/CMakeLists.txt

@@ -203,7 +203,7 @@ if (NOT LUAJIT_CACHE STREQUAL "${URHO3D_64BIT}-${LUAJIT_DISABLE_FFI}-${LUAJIT_DI
         if (XCODE)
         if (XCODE)
             if (ARCH)    # The ARCH variable is defined only when we are building LuaJIT for non-native archs using external project
             if (ARCH)    # The ARCH variable is defined only when we are building LuaJIT for non-native archs using external project
                 set (ARCH_FLAGS -arch ${ARCH})
                 set (ARCH_FLAGS -arch ${ARCH})
-            elseif (IOS OR TVOS)
+            elseif (ARM)
                 if (URHO3D_64BIT)
                 if (URHO3D_64BIT)
                     set (ARCH_FLAGS -arch arm64)
                     set (ARCH_FLAGS -arch arm64)
                 else ()
                 else ()
@@ -476,10 +476,10 @@ set (INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/generated)
 if (XCODE)
 if (XCODE)
     if (ARCH)
     if (ARCH)
         list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_ARCHS ${ARCH})
         list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_ARCHS ${ARCH})
-    elseif (URHO3D_64BIT OR IOS OR TVOS)
+    elseif (URHO3D_64BIT OR ARM)
         set (EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL)
         set (EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL)
         list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH YES)
         list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH YES)
-        if (URHO3D_64BIT AND (IOS OR TVOS))
+        if (URHO3D_64BIT AND ARM)
             list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_ARCHS arm64)     # The ARCHS_STANDARD builds armv7 first, but we have setup LuaJIT target detection to detect arm64 as the default arch so we override Xcode to build arm64 first
             list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_ARCHS arm64)     # The ARCHS_STANDARD builds armv7 first, but we have setup LuaJIT target detection to detect arm64 as the default arch so we override Xcode to build arm64 first
         endif ()
         endif ()
     endif ()
     endif ()

+ 7 - 7
Source/ThirdParty/SDL/CMakeLists.txt

@@ -177,7 +177,7 @@ set (SDL_CFLAGS)
 # in this file need to change that, so remember the original value, and
 # in this file need to change that, so remember the original value, and
 # restore back to that afterwards. For check_function_exists() to work in
 # restore back to that afterwards. For check_function_exists() to work in
 # Emscripten, this value must be at its default value.
 # Emscripten, this value must be at its default value.
-# Urho3D - also due to a CMake's try_compile() bug on iOS platform, the CMAKE_REQUIRED_FLAGS contains our SmileyHack-injection on iOS platform
+# Urho3D - also due to a CMake's try_compile() bug on iOS/tvOS platform, the CMAKE_REQUIRED_FLAGS contains our SmileyHack-injection on iOS/tvOS platform
 set (ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
 set (ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
 # Urho3D - save the original CMake global settings, do not leave them to chances
 # Urho3D - save the original CMake global settings, do not leave them to chances
 set (ORIG_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
 set (ORIG_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
@@ -269,7 +269,7 @@ dep_option(VIDEO_OPENGLES      "Include OpenGL ES support" ON "NOT MINGW" OFF)
 dep_option(PTHREADS            "Use POSIX threads for multi-threading" ON UNIX OFF)
 dep_option(PTHREADS            "Use POSIX threads for multi-threading" ON UNIX OFF)
 dep_option(PTHREADS_SEM        "Use pthread semaphores" ON PTHREADS OFF)
 dep_option(PTHREADS_SEM        "Use pthread semaphores" ON PTHREADS OFF)
 # Urho3D - SDL_DLOPEN was originally set as option twice (one here and one in the subsystem section above), we keep the one here so that we can make the option dependent on other conditions
 # Urho3D - SDL_DLOPEN was originally set as option twice (one here and one in the subsystem section above), we keep the one here so that we can make the option dependent on other conditions
-dep_option(SDL_DLOPEN          "Use dlopen for shared object loading" ON "UNIX\;NOT IOS OR NOT IPHONEOS_DEPLOYMENT_TARGET OR NOT IPHONEOS_DEPLOYMENT_TARGET VERSION_LESS 8" OFF)
+dep_option(SDL_DLOPEN          "Use dlopen for shared object loading" ON "UNIX\;NOT IOS OR NOT IPHONEOS_DEPLOYMENT_TARGET OR NOT IPHONEOS_DEPLOYMENT_TARGET VERSION_LESS 8" OFF)    # No need to check for tvOS as its target version is 9 or above
 # Urho3D - hide Unix-specific audio driver options from Android platform
 # Urho3D - hide Unix-specific audio driver options from Android platform
 dep_option(OSS                 "Support the OSS audio API" ON UNIX_SYS OFF)
 dep_option(OSS                 "Support the OSS audio API" ON UNIX_SYS OFF)
 dep_option(ALSA                "Support the ALSA audio API" ON UNIX_SYS OFF)
 dep_option(ALSA                "Support the ALSA audio API" ON UNIX_SYS OFF)
@@ -514,7 +514,7 @@ if(LIBC)
     set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SYS_TYPES_SAVED})
     set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SYS_TYPES_SAVED})
     # Urho3D - no fix required - it seems all the compiler toolchains (native and X-compiling) that have been tested are able to find these headers correctly
     # Urho3D - no fix required - it seems all the compiler toolchains (native and X-compiling) that have been tested are able to find these headers correctly
     #          Android NDK is able to find these headers with the help of "--sysroot" compiler flags, while others like MinGW and Linaro GCC for RPI work out of box
     #          Android NDK is able to find these headers with the help of "--sysroot" compiler flags, while others like MinGW and Linaro GCC for RPI work out of box
-    #          However, AppleClang when targeting iOS platform can only find these headers correctly AFTER applying a CMake hack from our common module to workaround a CMake bug so that try_compile() command works well on iOS platform
+    #          However, AppleClang when targeting iOS/tvOS platform can only find these headers correctly AFTER applying a CMake hack from our common module to workaround a CMake bug so that try_compile() command works well on iOS/tvOS platform
     foreach(_HEADER
     foreach(_HEADER
             stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h
             stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h
             strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h)
             strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h)
@@ -735,7 +735,7 @@ elseif(APPLE)
   endif()
   endif()
 
 
   if(SDL_JOYSTICK)
   if(SDL_JOYSTICK)
-    # Urho3D - bug fix - make it work for iOS platform
+    # Urho3D - bug fix - make it work for iOS/tvOS platform
     if (IOS OR TVOS)
     if (IOS OR TVOS)
       set (SDL_JOYSTICK_MFI 1)
       set (SDL_JOYSTICK_MFI 1)
       file (GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m)
       file (GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m)
@@ -751,7 +751,7 @@ elseif(APPLE)
   endif()
   endif()
 
 
   if(SDL_HAPTIC)
   if(SDL_HAPTIC)
-    # Urho3d - bug fix - make it work for iOS platform
+    # Urho3d - bug fix - make it work for iOS/tvOS platform
     if (IOS OR TVOS)
     if (IOS OR TVOS)
       set (SDL_HAPTIC_DUMMY 1)
       set (SDL_HAPTIC_DUMMY 1)
       file (GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c)
       file (GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c)
@@ -769,7 +769,7 @@ elseif(APPLE)
   endif()
   endif()
 
 
   if(SDL_POWER)
   if(SDL_POWER)
-    # Urho3d - bug fix - make it work for iOS platform
+    # Urho3d - bug fix - make it work for iOS/tvOS platform
     if (IOS OR TVOS)
     if (IOS OR TVOS)
       set (SDL_POWER_UIKIT 1)
       set (SDL_POWER_UIKIT 1)
       file (GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/uikit/*.m)
       file (GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/uikit/*.m)
@@ -823,7 +823,7 @@ elseif(APPLE)
     list(APPEND EXTRA_LIBS ${AUDIOTOOLBOX})
     list(APPEND EXTRA_LIBS ${AUDIOTOOLBOX})
   endif()
   endif()
 
 
-  # Urho3d - bug fix - make it work for iOS platform
+  # Urho3d - bug fix - make it work for iOS/tvOS platform
   if(SDL_VIDEO)
   if(SDL_VIDEO)
     if (VIDEO_COCOA)
     if (VIDEO_COCOA)
       # Urho3D - these are moved from commented CheckCOCOA macro
       # Urho3D - these are moved from commented CheckCOCOA macro

+ 1 - 1
Source/ThirdParty/SDL/cmake/sdlchecks.cmake

@@ -763,7 +763,7 @@ endmacro()
 
 
 # Requires:
 # Requires:
 # - nada
 # - nada
-# Urho3D - rename the macro to be generic OpenGLES check and make it also work for iOS platform
+# Urho3D - rename the macro to be generic OpenGLES check and make it also work for iOS/tvOS platform
 macro(CheckOpenGLES)
 macro(CheckOpenGLES)
   if(VIDEO_OPENGLES)
   if(VIDEO_OPENGLES)
     check_c_source_compiles("
     check_c_source_compiles("

+ 3 - 3
Source/ThirdParty/SDL/include/SDL_config.h.cmake

@@ -277,7 +277,7 @@
 #cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@
 #cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@
 #cmakedefine SDL_VIDEO_DRIVER_HAIKU @SDL_VIDEO_DRIVER_HAIKU@
 #cmakedefine SDL_VIDEO_DRIVER_HAIKU @SDL_VIDEO_DRIVER_HAIKU@
 #cmakedefine SDL_VIDEO_DRIVER_COCOA @SDL_VIDEO_DRIVER_COCOA@
 #cmakedefine SDL_VIDEO_DRIVER_COCOA @SDL_VIDEO_DRIVER_COCOA@
-// Urho3D - needed on iOS platform
+// Urho3D - needed on iOS/tvOS platform
 #cmakedefine SDL_VIDEO_DRIVER_UIKIT @SDL_VIDEO_DRIVER_UIKIT@
 #cmakedefine SDL_VIDEO_DRIVER_UIKIT @SDL_VIDEO_DRIVER_UIKIT@
 #cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@
 #cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@
 #cmakedefine SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC @SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC@
 #cmakedefine SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC @SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC@
@@ -344,7 +344,7 @@
 #cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@
 #cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@
 #cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@
 #cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@
 #cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@
 #cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@
-// Urho3D - needed on iOS platform
+// Urho3D - needed on iOS/tvOS platform
 #cmakedefine SDL_POWER_UIKIT @SDL_POWER_UIKIT@
 #cmakedefine SDL_POWER_UIKIT @SDL_POWER_UIKIT@
 #cmakedefine SDL_POWER_HAIKU @SDL_POWER_HAIKU@
 #cmakedefine SDL_POWER_HAIKU @SDL_POWER_HAIKU@
 #cmakedefine SDL_POWER_EMSCRIPTEN @SDL_POWER_EMSCRIPTEN@
 #cmakedefine SDL_POWER_EMSCRIPTEN @SDL_POWER_EMSCRIPTEN@
@@ -372,7 +372,7 @@
 /* Enable dynamic libsamplerate support */
 /* Enable dynamic libsamplerate support */
 #cmakedefine SDL_LIBSAMPLERATE_DYNAMIC @SDL_LIBSAMPLERATE_DYNAMIC@
 #cmakedefine SDL_LIBSAMPLERATE_DYNAMIC @SDL_LIBSAMPLERATE_DYNAMIC@
 
 
-// Urho3D - needed on iOS platform
+// Urho3D - needed on iOS/tvOS platform
 #cmakedefine SDL_IPHONE_KEYBOARD @SDL_IPHONE_KEYBOARD@
 #cmakedefine SDL_IPHONE_KEYBOARD @SDL_IPHONE_KEYBOARD@
 #cmakedefine SDL_IPHONE_LAUNCHSCREEN @SDL_IPHONE_LAUNCHSCREEN@
 #cmakedefine SDL_IPHONE_LAUNCHSCREEN @SDL_IPHONE_LAUNCHSCREEN@
 #cmakedefine SDL_IPHONE_MAX_GFORCE @SDL_IPHONE_MAX_GFORCE@
 #cmakedefine SDL_IPHONE_MAX_GFORCE @SDL_IPHONE_MAX_GFORCE@

+ 2 - 2
Source/Urho3D/CMakeLists.txt

@@ -129,8 +129,8 @@ else ()
         list (APPEND EXCLUDED_SOURCE_DIRS Graphics/Direct3D11)
         list (APPEND EXCLUDED_SOURCE_DIRS Graphics/Direct3D11)
     endif ()
     endif ()
 endif ()
 endif ()
-if (APPLE AND NOT IOS AND NOT TVOS)
-    set (GLOB_OBJC_PATTERN *.m)     # Should only pick up MacFileWatcher.m for MacOSX platform at the moment
+if (APPLE AND NOT ARM)
+    set (GLOB_OBJC_PATTERN *.m)     # Should only pick up MacFileWatcher.m for macOS platform at the moment
 endif ()
 endif ()
 string (REPLACE ";" "/[^;]+;" EXCLUDE_PATTERNS "${EXCLUDED_SOURCE_DIRS};")
 string (REPLACE ";" "/[^;]+;" EXCLUDE_PATTERNS "${EXCLUDED_SOURCE_DIRS};")
 define_source_files (EXCLUDE_PATTERNS ${EXCLUDE_PATTERNS} GLOB_CPP_PATTERNS *.cpp ${GLOB_OBJC_PATTERN} RECURSE GROUP PCH Precompiled.h)
 define_source_files (EXCLUDE_PATTERNS ${EXCLUDE_PATTERNS} GLOB_CPP_PATTERNS *.cpp ${GLOB_OBJC_PATTERN} RECURSE GROUP PCH Precompiled.h)

+ 1 - 1
Source/Urho3D/Core/ProcessUtils.h

@@ -59,7 +59,7 @@ URHO3D_API const Vector<String>& ParseArguments(int argc, char** argv);
 URHO3D_API const Vector<String>& GetArguments();
 URHO3D_API const Vector<String>& GetArguments();
 /// Read input from the console window. Return empty if no input.
 /// Read input from the console window. Return empty if no input.
 URHO3D_API String GetConsoleInput();
 URHO3D_API String GetConsoleInput();
-/// Return the runtime platform identifier, one of "Windows", "Linux", "Mac OS X", "Android", "iOS", "Web" or "Raspberry Pi".
+/// Return the runtime platform identifier.
 URHO3D_API String GetPlatform();
 URHO3D_API String GetPlatform();
 /// Return the number of physical CPU cores.
 /// Return the number of physical CPU cores.
 URHO3D_API unsigned GetNumPhysicalCPUs();
 URHO3D_API unsigned GetNumPhysicalCPUs();

+ 2 - 2
Source/Urho3D/Engine/Engine.cpp

@@ -735,10 +735,10 @@ void Engine::ApplyFrameLimit()
 
 
 #ifndef __EMSCRIPTEN__
 #ifndef __EMSCRIPTEN__
     // Perform waiting loop if maximum FPS set
     // Perform waiting loop if maximum FPS set
-#ifndef IOS
+#if !defined(IOS) && !defined(TVOS)
     if (maxFps)
     if (maxFps)
 #else
 #else
-    // If on iOS and target framerate is 60 or above, just let the animation callback handle frame timing
+    // If on iOS/tvOS and target framerate is 60 or above, just let the animation callback handle frame timing
     // instead of waiting ourselves
     // instead of waiting ourselves
     if (maxFps < 60)
     if (maxFps < 60)
 #endif
 #endif

+ 1 - 1
Source/Urho3D/Engine/Engine.h

@@ -66,7 +66,7 @@ public:
     void SetAutoExit(bool enable);
     void SetAutoExit(bool enable);
     /// Override timestep of the next frame. Should be called in between RunFrame() calls.
     /// Override timestep of the next frame. Should be called in between RunFrame() calls.
     void SetNextTimeStep(float seconds);
     void SetNextTimeStep(float seconds);
-    /// Close the graphics window and set the exit flag. No-op on iOS, as an iOS application can not legally exit.
+    /// Close the graphics window and set the exit flag. No-op on iOS/tvOS, as an iOS/tvOS application can not legally exit.
     void Exit();
     void Exit();
     /// Dump profiling information to the log.
     /// Dump profiling information to the log.
     void DumpProfiler();
     void DumpProfiler();

+ 1 - 1
Source/Urho3D/Graphics/OpenGL/OGLGraphics.cpp

@@ -2795,7 +2795,7 @@ void Graphics::CheckFeatureSupport()
         deferredSupport_ = true;
         deferredSupport_ = true;
 
 
 #if defined(__APPLE__) && !defined(IOS) && !defined(TVOS)
 #if defined(__APPLE__) && !defined(IOS) && !defined(TVOS)
-    // On OS X check for an Intel driver and use shadow map RGBA dummy color textures, because mixing
+    // On macOS check for an Intel driver and use shadow map RGBA dummy color textures, because mixing
     // depth-only FBO rendering and backbuffer rendering will bug, resulting in a black screen in full
     // depth-only FBO rendering and backbuffer rendering will bug, resulting in a black screen in full
     // screen mode, and incomplete shadow maps in windowed mode
     // screen mode, and incomplete shadow maps in windowed mode
     String renderer((const char*)glGetString(GL_RENDERER));
     String renderer((const char*)glGetString(GL_RENDERER));

+ 2 - 2
Source/Urho3D/Graphics/OpenGL/OGLTexture2D.cpp

@@ -460,8 +460,8 @@ bool Texture2D::Create()
         requestedLevels_ = 1;
         requestedLevels_ = 1;
     else if (usage_ == TEXTURE_RENDERTARGET)
     else if (usage_ == TEXTURE_RENDERTARGET)
     {
     {
-#if defined(__EMSCRIPTEN__) || defined(IOS)
-        // glGenerateMipmap appears to not be working on WebGL or iOS, disable rendertarget mipmaps for now
+#if defined(__EMSCRIPTEN__) || defined(IOS) || defined(TVOS)
+        // glGenerateMipmap appears to not be working on WebGL or iOS/tvOS, disable rendertarget mipmaps for now
         requestedLevels_ = 1;
         requestedLevels_ = 1;
 #else
 #else
         if (requestedLevels_ != 1)
         if (requestedLevels_ != 1)

+ 2 - 2
Source/Urho3D/Graphics/OpenGL/OGLTextureCube.cpp

@@ -485,8 +485,8 @@ bool TextureCube::Create()
         requestedLevels_ = 1;
         requestedLevels_ = 1;
     else if (usage_ == TEXTURE_RENDERTARGET)
     else if (usage_ == TEXTURE_RENDERTARGET)
     {
     {
-#if defined(__EMSCRIPTEN__) || defined(IOS)
-        // glGenerateMipmap appears to not be working on WebGL or iOS, disable rendertarget mipmaps for now
+#if defined(__EMSCRIPTEN__) || defined(IOS) || defined(TVOS)
+        // glGenerateMipmap appears to not be working on WebGL or iOS/tvOS, disable rendertarget mipmaps for now
         requestedLevels_ = 1;
         requestedLevels_ = 1;
 #else
 #else
         if (requestedLevels_ != 1)
         if (requestedLevels_ != 1)

+ 2 - 2
Source/Urho3D/Input/Input.cpp

@@ -1157,7 +1157,7 @@ void Input::SetScreenKeyboardVisible(bool enable)
 
 
 void Input::SetTouchEmulation(bool enable)
 void Input::SetTouchEmulation(bool enable)
 {
 {
-#if !defined(__ANDROID__) && !defined(IOS) && !defined(TVOS)
+#if !defined(__ANDROID__) && !defined(IOS)
     if (enable != touchEmulation_)
     if (enable != touchEmulation_)
     {
     {
         if (enable)
         if (enable)
@@ -2305,7 +2305,7 @@ void Input::HandleSDLEvent(void* sdlEvent)
             case SDL_WINDOWEVENT_MAXIMIZED:
             case SDL_WINDOWEVENT_MAXIMIZED:
             case SDL_WINDOWEVENT_RESTORED:
             case SDL_WINDOWEVENT_RESTORED:
 #if defined(IOS) || defined(TVOS) || defined (__ANDROID__)
 #if defined(IOS) || defined(TVOS) || defined (__ANDROID__)
-                // On iOS we never lose the GL context, but may have done GPU object changes that could not be applied yet. Apply them now
+                // On iOS/tvOS we never lose the GL context, but may have done GPU object changes that could not be applied yet. Apply them now
                 // On Android the old GL context may be lost already, restore GPU objects to the new GL context
                 // On Android the old GL context may be lost already, restore GPU objects to the new GL context
                 graphics_->Restore();
                 graphics_->Restore();
 #endif
 #endif