Skip to content

Commit

Permalink
Macos take2
Browse files Browse the repository at this point in the history
draft because i need to get a todo list together.

Adds macos as a target for our ios runtime! Also adds a macos target for our example (which is a different app completely, very minimalistic right now).

<img width="331" alt="CleanShot 2023-05-17 at 20 32 45@2x" src="https://github.com/rive-app/rive/assets/1216025/7a6cadce-9763-41a3-b1a0-6d067dfc3eca">

macos, macos rosetta, macos (designed for ipad), and ios  all co existing in peace, from the same runtime project

![CleanShot 2023-05-17 at 18 32 04@2x](https://github.com/rive-app/rive/assets/1216025/eead319d-a16b-4098-a7db-d5f033b1ef8f)

todo:
- [x] update build scripts to build supporting macos (gotta do this)
- [x] run formatter
- [x] test out builds in forked version of ios? (gotta do this)
- [ ] one more stab at catalyst? (i think we can try that later...)
- [ ] do we need a more comprehensive example setup for macos (I think we can do this later & try to pull zach's examples in)
- [ ] I think we should restructure the ios project, but i think we can do that after this as well (i just think the folder structure/project structure can do with some work, now that we add macos (and should make room for tvos as well)
- [x] probably got tests to fix
- [ ] there's probably a bunch of looking at errors in the debugger and figuring those out, but i would hope that we can deploy with some warnings here too.

catalyst problem:

we get this error:
and the problem is basically that we can target a specific library for macos, but we need one for macos and one for macos catalyst. they share the same architecture, so i dont think we can lipo them into one file...

we could change the compiled binaries before creating the frameworks I guess though? .. maybe something to try..

`/Users/maxwelltalbot/development/rive/rive/packages/runtime_ios/dependencies/debug/librive_skia_renderer_macos.a(cg_factory.o), building for Mac Catalyst, but linking in object file built for macOS, file '/Users/maxwelltalbot/development/rive/rive/packages/runtime_ios/dependencies/debug/librive_skia_renderer_macos.a' for architecture arm64` basically

Diffs=
a9f8a1c5d Macos take2 (#5258)
  • Loading branch information
mjtalbot committed May 24, 2023
1 parent b8674c2 commit b6d48a1
Show file tree
Hide file tree
Showing 26 changed files with 987 additions and 193 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Package.swift.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PackageDescription

let package = Package(
name: "RiveRuntime",
platforms: [.iOS("14.0")],
platforms: [.iOS("14.0"), .macOS("13.1")],
products: [
.library(
name: "RiveRuntime",
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/RiveRuntime.podspec.template
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ Pod::Spec.new do |spec|
LICENSE
}
spec.authors = { "Luigi Rosso" => "luigi@rive.app" }
spec.platform = :ios, '14.0'
spec.ios.deployment_target = '14.0'
spec.osx.deployment_target = '13.1'
spec.swift_version = '5.0'
spec.source = {
:http => "https://github.com/rive-app/rive-ios/releases/download/$RELEASE_VERSION/RiveRuntime.xcframework.zip",
}
spec.ios.vendored_frameworks = 'RiveRuntime.xcframework'
spec.osx.vendored_frameworks = 'RiveRuntime.xcframework'
end
16 changes: 5 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,13 @@ jobs:
RiveRuntime.xcodeproj/project.pbxproj
Source/Info.plist
Tests/Info.plist
- id: build_iphoneos
name: Build release iphoneos framework
run: sh ./scripts/build_framework.sh -t iphoneos -c Release
- id: build_iphonesimulator
name: Build release iphonesimulator framework
run: sh ./scripts/build_framework.sh -t iphonesimulator -c Release
- id: merge_frameworks
if: steps.build_iphoneos.conclusion == 'success' && steps.build_iphonesimulator.conclusion == 'success'
name: Merge created frameworks
run: sh ./scripts/merge_frameworks.sh -c Release
- id: build_frameworks
name: Build frameworks
run: sh ./scripts/build_framework.sh -c Release
- id: zip
name: Zip the framework
run: zip -r RiveRuntime.xcframework.zip RiveRuntime.xcframework
# --symlinks is critical here to retain the structure of a macos framework.
run: zip --symlinks -r RiveRuntime.xcframework.zip RiveRuntime.xcframework
working-directory: ./archive
- id: get_checksum
name: Add the checksum of the zip file into our environment
Expand Down
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f2ecb824beea0dadfe7077accacb5cd246cac669
a9f8a1c5d351a72b4537a6b8a27962d130f0a97c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"images" : [
{
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions Example-iOS/Example (macOS)/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
25 changes: 25 additions & 0 deletions Example-iOS/Example (macOS)/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// ContentView.swift
// Example (macOS)
//
// Created by Maxwell Talbot on 17/05/2023.
// Copyright © 2023 Rive. All rights reserved.
//

import SwiftUI
import RiveRuntime

struct ContentView: View {
var body: some View {
VStack {
RiveViewModel(fileName: "magic_8-ball_v2").view()
}
.padding()
}
}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
10 changes: 10 additions & 0 deletions Example-iOS/Example (macOS)/Example__macOS_.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?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>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
</dict>
</plist>
18 changes: 18 additions & 0 deletions Example-iOS/Example (macOS)/Example__macOS_App.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// Example__macOS_App.swift
// Example (macOS)
//
// Created by Maxwell Talbot on 17/05/2023.
// Copyright © 2023 Rive. All rights reserved.
//

import SwiftUI

@main
struct Example__macOS_App: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading

0 comments on commit b6d48a1

Please sign in to comment.