From 40e92ce7530f56b64f4bc5fbf64c42280e5140bf Mon Sep 17 00:00:00 2001 From: Eric Warmenhoven Date: Tue, 7 Feb 2023 12:11:35 -0500 Subject: [PATCH] Build for tvOS as a libretro core --- .gitlab-ci.yml | 13 +++++++++++++ cmake/Toolchains/ios.cmake | 19 +++++++++++++++---- libretro/libretro_vulkan.cpp | 1 - 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e97fab6fee..ec27838610 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -53,6 +53,10 @@ include: - project: 'libretro-infrastructure/ci-templates' file: '/ios-cmake.yml' + # tvOS + - project: 'libretro-infrastructure/ci-templates' + file: '/tvos-cmake.yml' + ################################## CONSOLES ################################ #################################### MISC ################################## @@ -146,3 +150,12 @@ libretro-build-ios-arm64: - .cmake-defs variables: CORE_ARGS: -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/ios.cmake -DLIBRETRO=ON + +# tvOS arm64 +libretro-build-tvos-arm64: + extends: + - .libretro-tvos-cmake-arm64 + - .core-defs + - .cmake-defs + variables: + CORE_ARGS: -DIOS_PLATFORM=TVOS -DUSE_FFMPEG=NO -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/ios.cmake -DLIBRETRO=ON diff --git a/cmake/Toolchains/ios.cmake b/cmake/Toolchains/ios.cmake index a8041ec376..2e5dca4ca2 100644 --- a/cmake/Toolchains/ios.cmake +++ b/cmake/Toolchains/ios.cmake @@ -19,9 +19,14 @@ add_definitions( ) set(OPENGL_LIBRARIES "-framework OpenGLES") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET}") +if(IOS_PLATFORM STREQUAL "TVOS") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mappletvos-version-min=${IPHONEOS_DEPLOYMENT_TARGET}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mappletvos-version-min=${IPHONEOS_DEPLOYMENT_TARGET}") +else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET}") +endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET}") set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") # Standard settings @@ -31,7 +36,11 @@ set(CMAKE_SYSTEM_PROCESSOR aarch64) set(IOS ON) set(CMAKE_CROSSCOMPILING ON) set(CMAKE_MACOSX_BUNDLE YES) -set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${IPHONEOS_DEPLOYMENT_TARGET}) +if(IOS_PLATFORM STREQUAL "TVOS") + #set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${IPHONEOS_DEPLOYMENT_TARGET}) +else() + set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${IPHONEOS_DEPLOYMENT_TARGET}) +endif() # Setup iOS platform unless specified manually with IOS_PLATFORM if(NOT DEFINED IOS_PLATFORM) @@ -44,6 +53,8 @@ if(IOS_PLATFORM STREQUAL "OS") set(IOS_SDK_NAME "iphoneos") elseif(IOS_PLATFORM STREQUAL "SIMULATOR") set(IOS_SDK_NAME "iphonesimulator") +elseif(IOS_PLATFORM STREQUAL "TVOS") + set(IOS_SDK_NAME "appletvos") else() message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected '${IOS_PLATFORM}'. Please choose OS or leave default") endif() @@ -63,7 +74,7 @@ set(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selecte set(CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support") # set the architecture for iOS -if(IOS_PLATFORM STREQUAL "OS") +if(IOS_PLATFORM STREQUAL "OS" OR IOS_PLATFORM STREQUAL "TVOS") set(IOS_ARCH "arm64") else() set(IOS_ARCH "i386;x86_64") diff --git a/libretro/libretro_vulkan.cpp b/libretro/libretro_vulkan.cpp index 8fc3faabd3..45269649b4 100644 --- a/libretro/libretro_vulkan.cpp +++ b/libretro/libretro_vulkan.cpp @@ -98,7 +98,6 @@ static VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice_libretro(VkPhysicalDevice p for (unsigned i = 0; i < vk_init_info.num_required_device_extensions; i++) add_name_unique(EnabledExtensionNames, vk_init_info.required_device_extensions[i]); - add_name_unique(EnabledExtensionNames, VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME); for (unsigned i = 0; i < sizeof(VkPhysicalDeviceFeatures) / sizeof(VkBool32); i++) { if (((VkBool32 *)vk_init_info.required_features)[i]) ((VkBool32 *)&EnabledFeatures)[i] = VK_TRUE;