Skip to content

iOS/iPad Support#1692

Draft
colincornaby wants to merge 4 commits intoH-uru:masterfrom
colincornaby:ios-metal
Draft

iOS/iPad Support#1692
colincornaby wants to merge 4 commits intoH-uru:masterfrom
colincornaby:ios-metal

Conversation

@colincornaby
Copy link
Copy Markdown
Contributor

@colincornaby colincornaby commented Apr 26, 2025

This PR is very much a draft - but is at that point I should probably start getting feedback. The Python integration is a pain point.

This PR enables Plasma to run on iPhone and iPad. This version supports mouse, keyboard, and stylus input.

The oldest device I have run this on is an A12X. This PR includes changes to manually decompress DX compressed textures on devices that don't support that in hardware. M series or A17 class hardware, or better, do not need this hack and can decompress in hardware just like the Mac.

Changes:

  • Adds a new SwiftUI front end. SwiftUI is the modern multiplatform framework that supports all of Apple's platforms. This frontend runs on iOS and sets things up for visionOS
    • I'm not moving the Mac client to the new frontend - there are some missing features in the framework and higher platform requirements. But it could in the future.
  • Touch enabled view that includes Apple Pencil support
  • Support for the Game Controller framework for keyboards. Provides HID key codes.
    • Could also be used for macOS in the future
    • Does not provide characters so KI chat does not work
  • Adds support for the Python 3.13 iOS build.

This version will not build entirely with vcpkg. The iOS build of Python does not align with how vcpkg includes files. Vcpkg integration would take some thought. iOS 15 is required - I've only tested on iOS 18.

There is no self patching available in this version.

To build:

  1. Download and build the iOS version of Python as detailed here: https://docs.python.org/3/using/ios.html
  2. Copy the resulting arm64-iphoneos folder and dylib-Info-template.plist file to the root of the Plasma folder.
  3. Invoke CMake - here's the build command I use: cmake -G Xcode -DPLASMA_APPLE_DEVELOPMENT_TEAM_ID={Your team ID here} -DUSE_VCPKG=1 -DCMAKE_SYSTEM_NAME=iOS -DPLASMA_BUILD_TOOLS=OFF -DPLASMA_PIPELINE_GL=OFF -DVCPKG_CMAKE_SYSTEM_NAME=iOS -DVCPKG_DEBUG=1 -DVCPKG_TARGET_TRIPLET="arm64-ios-plasma" ../
  4. Build/install/run Plasma on your iOS device. This run will fail because Uru data has to be loaded on the device.
  5. Using the iOS Files app (or other method of choice) load an Uru data install into the documents folder of the plClient application. This should include a server.ini.
    _6. In the device's Uru data, also copy the Python System folder into the Python directory, like you would on Windows and Linux. You must use the iOS version of System.

@colincornaby
Copy link
Copy Markdown
Contributor Author

The Python integration is kind of tortured because of how we need to integrate:

  • We must integrate as an Apple framework bundle instead of a library and headers.
  • That also means we have to copy it into the bundle resources and sign it.
  • We need to also convert all of Python's dynamic library modules into frameworks and then bundle those frameworks (which Python provides us a script for that I've integrated.)

I started working on a find package path for integration - but it was unclear how to handle the bundling of the Python framework.

CURL::libcurl
"$<$<PLATFORM_ID:Darwin>:-framework Cocoa>"
"$<$<PLATFORM_ID:Darwin>:-framework QuartzCore>"
"$<$<PLATFORM_ID:iOS>:-framework Accelerate>"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On macOS, Accelerate is pulled in via CoreLib (due to its use in hsMatrix44)

@@ -241,7 +306,12 @@ target_link_libraries(
CURL::libcurl
"$<$<PLATFORM_ID:Darwin>:-framework Cocoa>"
"$<$<PLATFORM_ID:Darwin>:-framework QuartzCore>"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can provide a list of platforms to PLATFORM_ID to cover both macOS and iOS:
$<$<PLATFORM_ID:Darwin,iOS>:-framework QuartzCore>

"size" : "1024x1024"
},
{
"filename" : "Icon-MacOS-16x16@1x 1.png",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do the macOS icons without a 1 suffix?

@@ -75,7 +75,7 @@ target_link_libraries(plPipeline
$<$<PLATFORM_ID:Windows>:plWinDpi>
freetype
"$<$<PLATFORM_ID:Darwin>:-framework CoreText>"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need iOS here too?

@colincornaby colincornaby force-pushed the ios-metal branch 5 times, most recently from ac8bd66 to 4f31177 Compare April 26, 2025 05:52
@dpogue
Copy link
Copy Markdown
Member

dpogue commented Sep 7, 2025

My suggestion would be to split some of the more self-contained parts of this into a few PRs for easier review/merging head of the iOS client itself:

  1. The fallback DXT handling in pfMetalPipeline
  2. The bits of condition handling for iOS support across the rest of the core modules
  3. Whatever Python stuff is not Update to Python 3.12 #1752 and a revised version of Fixing Python path sensitivity #1682

@colincornaby
Copy link
Copy Markdown
Contributor Author

I'll start breaking this up. I'm going to leave this draft PR open (with apologies to @Hoikas) so I can track what's been merged in.

Python for iOS links in a completely different manner than it does on any other platform. I'm not sure vcpkg supports it (or how it would support the very custom linking) but I'll look into that. It looks like the iOS version requires 3.13 so we may not be far enough ahead to merge in real support.

@colincornaby colincornaby force-pushed the ios-metal branch 3 times, most recently from 6059b8f to 9f84ff6 Compare September 8, 2025 02:17
@Hoikas
Copy link
Copy Markdown
Member

Hoikas commented Sep 8, 2025

FWIW, Python 3.14 should release next month (October 2025). Python 3.12 entered security-fixes-only status recently, so I will be looking into Python 3.14 support sooner than later. I think the work I did in #1752 should make it easier to stick closer to what upstream vcpkg does.

@colincornaby colincornaby force-pushed the ios-metal branch 3 times, most recently from b5427e3 to fda75c5 Compare September 17, 2025 03:06
@colincornaby colincornaby force-pushed the ios-metal branch 2 times, most recently from bc80509 to f4f08ed Compare January 18, 2026 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants