Skip to content

Commit

Permalink
WIP: tvOS support
Browse files Browse the repository at this point in the history
Change-Id: I7cd92058d618a1d883954c6944a20f9374e2dc12
  • Loading branch information
kakashidinho committed Apr 19, 2020
1 parent deab262 commit 6048c79
Show file tree
Hide file tree
Showing 27 changed files with 3,710 additions and 90 deletions.
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,20 @@ jobs:
on:
tags: true

- name: "macos xcode project 11.2"
- name: "macos & tvos xcode project 11.2"
osx_image: xcode11.2
python: "3.5"
script:
- mac/xcode/travis_build_mac.sh Release macosx ${TRAVIS_BUILD_DIR}/build_mac
- ios/xcode/travis_build_ios.sh Release appletvos ${TRAVIS_BUILD_DIR}/build_tvos
- cd ${TRAVIS_BUILD_DIR}/build_mac/Build/Products/Release && zip --symlinks -r ${TRAVIS_BUILD_DIR}/MetalANGLE.framework.mac.zip MetalANGLE.framework
- cd ${TRAVIS_BUILD_DIR}/build_tvos/Build/Products/Release && zip --symlinks -r ${TRAVIS_BUILD_DIR}/MetalANGLE.framework.tvos.zip MetalANGLE.framework
deploy:
provider: releases
api_key: ${GITHUB_TOKEN}
file: ${TRAVIS_BUILD_DIR}/MetalANGLE.framework.mac.zip
file:
- ${TRAVIS_BUILD_DIR}/MetalANGLE.framework.mac.zip
- ${TRAVIS_BUILD_DIR}/MetalANGLE.framework.tvos.zip
draft: true
skip_cleanup: true
overwrite: true
Expand Down Expand Up @@ -67,10 +71,11 @@ jobs:
script:
- ios/xcode/travis_build_ios.sh Release
osx_image: xcode9.4
- name: "macos xcode project 9.4"
- name: "macos & tvos xcode project 9.4"
python: "3.5"
script:
- mac/xcode/travis_build_mac.sh Release
- ios/xcode/travis_build_ios.sh Release appletvos
osx_image: xcode9.4
- name: "macos gn xcode 9.4"
python: "3.5"
Expand Down
2 changes: 1 addition & 1 deletion ios/xcode/MGLKit/MGLKView.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
// Return the size of the OpenGL default framebuffer.
@property(readonly) CGSize drawableSize;

#if TARGET_OS_IOS
#if TARGET_OS_IOS || TARGET_OS_TV
@property(readonly, strong) UIImage *snapshot;
#endif

Expand Down
4 changes: 2 additions & 2 deletions ios/xcode/MGLKit/MGLKView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ - (void)drawRect:(CGRect)rect andCapture:(uint8_t **)pPixels
_drawing = NO;
}

#if TARGET_OS_IOS
#if TARGET_OS_IOS || TARGET_OS_TV
static void freeImageData(void *info, const void *data, size_t size)
{
delete[] static_cast<uint8_t *>(info);
Expand Down Expand Up @@ -242,6 +242,6 @@ - (UIImage *)snapshot
CGImageRelease(imageRef);
return image;
}
#endif // TARGET_OS_IOS
#endif // TARGET_OS_IOS || TARGET_OS_TV

@end
2 changes: 1 addition & 1 deletion ios/xcode/MGLKit/MGLKitPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <TargetConditionals.h>

#if TARGET_OS_IOS || TARGET_OS_MACCATALYST
#if TARGET_OS_IOS || TARGET_OS_MACCATALYST || TARGET_OS_TV
# include <UIKit/UIKit.h>

@compatibility_alias MGLKNativeView UIView;
Expand Down
2 changes: 1 addition & 1 deletion ios/xcode/MGLKitSampleApp/GLViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ - (void)loadResources
[self compileShaders];
[self setupVBOs];

#if TARGET_OS_IOS
#if TARGET_OS_IOS || TARGET_OS_TV
if (strstr((const char *)glGetString(GL_EXTENSIONS), "IMG_texture_compression_pvrtc"))
{
_floorTexture = [PVRTexture glTextureWithContentsOfFile:@"tile_floor.pvr"];
Expand Down
34 changes: 34 additions & 0 deletions ios/xcode/MGLKitSampleApp/Info_tvos.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>MetalCaptureEnabled</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen_tvos</string>
<key>UIMainStoryboardFile</key>
<string>Main_tvos</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
</dict>
</plist>
39 changes: 39 additions & 0 deletions ios/xcode/MGLKitSampleApp/LaunchScreen_tvos.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="16096" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="vYY-Fe-IIA">
<device id="appleTV" appearance="light"/>
<dependencies>
<deployment version="2304" identifier="tvOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="ixa-9a-MGQ">
<objects>
<viewController id="vYY-Fe-IIA" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="mjK-lA-mga"/>
<viewControllerLayoutGuide type="bottom" id="Xkf-wi-MMd"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="HWx-i3-rzE">
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="LOADING ..." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2Ou-L4-Dik">
<rect key="frame" x="106" y="378" width="1708" height="325"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<viewLayoutGuide key="safeArea" id="PIe-lw-ehb"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="I4k-ZG-DxX" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-4408" y="-2237"/>
</scene>
</scenes>
</document>
30 changes: 30 additions & 0 deletions ios/xcode/MGLKitSampleApp/Main_tvos.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="16096" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Xbo-W6-wkD">
<device id="appleTV" appearance="light"/>
<dependencies>
<deployment version="2304" identifier="tvOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="Vhj-pq-GBi">
<objects>
<viewController id="Xbo-W6-wkD" customClass="GLViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="NIh-Ap-cjI"/>
<viewControllerLayoutGuide type="bottom" id="0vl-CD-EbB"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="blW-6r-bKt" customClass="MGLKView">
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<viewLayoutGuide key="safeArea" id="46C-Gg-ekh"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="mYo-kv-Ide" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="51" y="64"/>
</scene>
</scenes>
</document>
2 changes: 1 addition & 1 deletion ios/xcode/MGLKitSampleApp/ccTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#import <Availability.h>
#import <Foundation/Foundation.h>

#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) || defined(__TV_OS_VERSION_MAX_ALLOWED)
# import <CoreGraphics/CGGeometry.h> // CGPoint
#endif

Expand Down
Loading

0 comments on commit 6048c79

Please sign in to comment.