Skip to content

Commit 92d8d95

Browse files
Add support for visionOS (#270)
Adds targets and patches to support building a visionOS support package. Co-authored-by: Russell Keith-Magee <[email protected]>
1 parent 81428db commit 92d8d95

File tree

5 files changed

+2365
-149
lines changed

5 files changed

+2365
-149
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
strategy:
9090
fail-fast: false
9191
matrix:
92-
target: ['macOS', 'iOS', 'tvOS', 'watchOS']
92+
target: ['macOS', 'iOS', 'tvOS', 'watchOS', 'visionOS']
9393
include:
9494
- briefcase-run-args:
9595
- run-tests: false

.github/workflows/publish.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,6 @@ jobs:
4848
# watchOS build
4949
curl -o watchOS-artefact.tar.gz -L https://github.com/beeware/Python-Apple-support/releases/download/${{ steps.build-vars.outputs.TAG }}/Python-${{ steps.build-vars.outputs.PYTHON_VER }}-watchOS-support.${{ steps.build-vars.outputs.BUILD_NUMBER }}.tar.gz
5050
aws s3 cp watchOS-artefact.tar.gz s3://briefcase-support/python/${{ steps.build-vars.outputs.PYTHON_VER }}/watchOS/Python-${{ steps.build-vars.outputs.PYTHON_VER }}-watchOS-support.${{ steps.build-vars.outputs.BUILD_NUMBER }}.tar.gz
51+
# visionOS build
52+
curl -o visionOS-artefact.tar.gz -L https://github.com/beeware/Python-Apple-support/releases/download/${{ steps.build-vars.outputs.TAG }}/Python-${{ steps.build-vars.outputs.PYTHON_VER }}-visionOS-support.${{ steps.build-vars.outputs.BUILD_NUMBER }}.tar.gz
53+
aws s3 cp visionOS-artefact.tar.gz s3://briefcase-support/python/${{ steps.build-vars.outputs.PYTHON_VER }}/visionOS/Python-${{ steps.build-vars.outputs.PYTHON_VER }}-visionOS-support.${{ steps.build-vars.outputs.BUILD_NUMBER }}.tar.gz

Makefile

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# - iOS - build everything for iOS
66
# - tvOS - build everything for tvOS
77
# - watchOS - build everything for watchOS
8+
# - visionOS - build everything for visionOS
89

910
# Current directory
1011
PROJECT_DIR=$(shell pwd)
@@ -18,41 +19,49 @@ BUILD_NUMBER=custom
1819
# of a release cycle, as official binaries won't be published.
1920
# PYTHON_MICRO_VERSION is the full version number, without any alpha/beta/rc suffix. (e.g., 3.10.0)
2021
# PYTHON_VER is the major/minor version (e.g., 3.10)
21-
PYTHON_VERSION=3.14.0a6
22+
PYTHON_VERSION=3.14.0a7
2223
PYTHON_PKG_VERSION=$(PYTHON_VERSION)
2324
PYTHON_MICRO_VERSION=$(shell echo $(PYTHON_VERSION) | grep -Eo "\d+\.\d+\.\d+")
2425
PYTHON_PKG_MICRO_VERSION=$(shell echo $(PYTHON_PKG_VERSION) | grep -Eo "\d+\.\d+\.\d+")
2526
PYTHON_VER=$(basename $(PYTHON_VERSION))
2627

2728
# The binary releases of dependencies, published at:
2829
# https://github.com/beeware/cpython-apple-source-deps/releases
29-
BZIP2_VERSION=1.0.8-1
30-
LIBFFI_VERSION=3.4.7-1
31-
MPDECIMAL_VERSION=4.0.0-1
32-
OPENSSL_VERSION=3.0.16-1
33-
XZ_VERSION=5.6.4-1
30+
BZIP2_VERSION=1.0.8-2
31+
LIBFFI_VERSION=3.4.7-2
32+
MPDECIMAL_VERSION=4.0.0-2
33+
OPENSSL_VERSION=3.0.16-2
34+
XZ_VERSION=5.6.4-2
3435

3536
# Supported OS
36-
OS_LIST=macOS iOS tvOS watchOS
37+
OS_LIST=macOS iOS tvOS watchOS visionOS
3738

3839
CURL_FLAGS=--disable --fail --location --create-dirs --progress-bar
3940

4041
# macOS targets
4142
TARGETS-macOS=macosx.x86_64 macosx.arm64
43+
TRIPLE_OS-macOS=macos
4244
VERSION_MIN-macOS=11.0
4345

4446
# iOS targets
4547
TARGETS-iOS=iphonesimulator.x86_64 iphonesimulator.arm64 iphoneos.arm64
48+
TRIPLE_OS-iOS=ios
4649
VERSION_MIN-iOS=13.0
4750

4851
# tvOS targets
4952
TARGETS-tvOS=appletvsimulator.x86_64 appletvsimulator.arm64 appletvos.arm64
53+
TRIPLE_OS-tvOS=tvos
5054
VERSION_MIN-tvOS=12.0
5155

5256
# watchOS targets
5357
TARGETS-watchOS=watchsimulator.x86_64 watchsimulator.arm64 watchos.arm64_32
58+
TRIPLE_OS-watchOS=watchos
5459
VERSION_MIN-watchOS=4.0
5560

61+
TARGETS-visionOS=xrsimulator.arm64 xros.arm64
62+
TRIPLE_OS-visionOS=xros
63+
VERSION_MIN-visionOS=2.0
64+
5665
# The architecture of the machine doing the build
5766
HOST_ARCH=$(shell uname -m)
5867
HOST_PYTHON=$(shell which python$(PYTHON_VER))
@@ -128,10 +137,10 @@ ARCH-$(target)=$$(subst .,,$$(suffix $(target)))
128137

129138
ifneq ($(os),macOS)
130139
ifeq ($$(findstring simulator,$$(SDK-$(target))),)
131-
TARGET_TRIPLE-$(target)=$$(ARCH-$(target))-apple-$$(OS_LOWER-$(target))$$(VERSION_MIN-$(os))
140+
TARGET_TRIPLE-$(target)=$$(ARCH-$(target))-apple-$$(TRIPLE_OS-$(os))$$(VERSION_MIN-$(os))
132141
IS_SIMULATOR-$(target)=False
133142
else
134-
TARGET_TRIPLE-$(target)=$$(ARCH-$(target))-apple-$$(OS_LOWER-$(target))$$(VERSION_MIN-$(os))-simulator
143+
TARGET_TRIPLE-$(target)=$$(ARCH-$(target))-apple-$$(TRIPLE_OS-$(os))$$(VERSION_MIN-$(os))-simulator
135144
IS_SIMULATOR-$(target)=True
136145
endif
137146
endif
@@ -398,15 +407,13 @@ define build-sdk
398407
sdk=$1
399408
os=$2
400409

401-
OS_LOWER-$(sdk)=$(shell echo $(os) | tr '[:upper:]' '[:lower:]')
402-
403410
SDK_TARGETS-$(sdk)=$$(filter $(sdk).%,$$(TARGETS-$(os)))
404411
SDK_ARCHES-$(sdk)=$$(sort $$(subst .,,$$(suffix $$(SDK_TARGETS-$(sdk)))))
405412

406413
ifeq ($$(findstring simulator,$(sdk)),)
407-
SDK_SLICE-$(sdk)=$$(OS_LOWER-$(sdk))-$$(shell echo $$(SDK_ARCHES-$(sdk)) | sed "s/ /_/g")
414+
SDK_SLICE-$(sdk)=$$(TRIPLE_OS-$(os))-$$(shell echo $$(SDK_ARCHES-$(sdk)) | sed "s/ /_/g")
408415
else
409-
SDK_SLICE-$(sdk)=$$(OS_LOWER-$(sdk))-$$(shell echo $$(SDK_ARCHES-$(sdk)) | sed "s/ /_/g")-simulator
416+
SDK_SLICE-$(sdk)=$$(TRIPLE_OS-$(os))-$$(shell echo $$(SDK_ARCHES-$(sdk)) | sed "s/ /_/g")-simulator
410417
endif
411418

412419
# Expand the build-target macro for target on this OS
@@ -481,11 +488,15 @@ $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h: $$(PYTHON_LIB-$(sdk))
481488
mkdir -p $$(PYTHON_INSTALL-$(sdk))/include
482489
ln -si ../Python.framework/Headers $$(PYTHON_INSTALL-$(sdk))/include/python$(PYTHON_VER)
483490

491+
ifeq ($(os), visionOS)
492+
echo "Skipping arch-specific header copying for visionOS"
493+
else
484494
# Add the individual headers from each target in an arch-specific name
485495
$$(foreach target,$$(SDK_TARGETS-$(sdk)),cp $$(PYTHON_INCLUDE-$$(target))/pyconfig.h $$(PYTHON_INCLUDE-$(sdk))/pyconfig-$$(ARCH-$$(target)).h; )
486496

487497
# Copy the cross-target header from the source folder of the first target in the $(sdk) SDK
488498
cp $$(PYTHON_SRCDIR-$$(firstword $$(SDK_TARGETS-$(sdk))))/$(os)/Resources/pyconfig.h $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h
499+
endif
489500

490501

491502
$$(PYTHON_STDLIB-$(sdk))/LICENSE.TXT: $$(PYTHON_LIB-$(sdk)) $$(PYTHON_FRAMEWORK-$(sdk))/Info.plist $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h $$(foreach target,$$(SDK_TARGETS-$(sdk)),$$(PYTHON_PLATFORM_SITECUSTOMIZE-$$(target)))
@@ -650,7 +661,7 @@ $$(PYTHON_XCFRAMEWORK-$(os))/Info.plist: \
650661
$$(foreach sdk,$$(SDKS-$(os)),cp -r $$(PYTHON_INSTALL-$$(sdk))/lib $$(PYTHON_XCFRAMEWORK-$(os))/$$(SDK_SLICE-$$(sdk)); )
651662
$$(foreach sdk,$$(SDKS-$(os)),cp -r $$(PYTHON_INSTALL-$$(sdk))/platform-config $$(PYTHON_XCFRAMEWORK-$(os))/$$(SDK_SLICE-$$(sdk)); )
652663

653-
ifeq ($(os),iOS)
664+
ifeq ($(filter $(os),iOS visionOS),$(os))
654665
@echo ">>> Clone testbed project for $(os)"
655666
$(HOST_PYTHON) $$(PYTHON_SRCDIR-$$(firstword $$(SDK_TARGETS-$$(firstword $$(SDKS-$(os))))))/iOS/testbed clone --framework $$(PYTHON_XCFRAMEWORK-$(os)) support/$(PYTHON_VER)/$(os)/testbed
656667
endif

0 commit comments

Comments
 (0)