Skip to content

Commit fc19430

Browse files
committed
Start adding SDL3 recipes
1 parent 6bd6319 commit fc19430

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

kivy_ios/recipes/sdl3/__init__.py

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import os
2+
3+
import sh
4+
5+
from kivy_ios.toolchain import Recipe, shprint
6+
7+
8+
class LibSDL3Recipe(Recipe):
9+
version = "3.2.8"
10+
url = "https://github.com/libsdl-org/SDL/releases/download/release-{version}/SDL3-{version}.tar.gz"
11+
include_dir = "include"
12+
pbx_frameworks = [
13+
"AudioToolbox",
14+
"Carbon",
15+
"Cocoa",
16+
"CoreAudio",
17+
"CoreFoundation",
18+
"CoreHaptics",
19+
"CoreVideo",
20+
"ForceFeedback",
21+
"GameController",
22+
"IOKit",
23+
"Metal",
24+
"QuartzCore",
25+
"UniformTypeIdentifiers",
26+
]
27+
28+
def prebuild_platform(self, plat):
29+
if self.has_marker("patched"):
30+
return
31+
self.apply_patch("uikit-transparent.patch")
32+
# self.apply_patch("disable-hidapi.patch")
33+
self.set_marker("patched")
34+
35+
def build_platform(self, plat):
36+
37+
if plat.sdk == "iphonesimulator":
38+
destination = "generic/platform=iOS Simulator"
39+
else:
40+
destination = "generic/platform=iOS"
41+
42+
shprint(
43+
sh.xcodebuild, "archive",
44+
"-scheme", "SDL3",
45+
"-project", "Xcode/SDL/SDL.xcodeproj",
46+
"-archivePath", f"Xcode/SDL/build/Release-{plat.sdk}",
47+
"-destination", destination,
48+
"-configuration", "Release",
49+
"BUILD_LIBRARY_FOR_DISTRIBUTION=YES",
50+
"SKIP_INSTALL=NO",
51+
)
52+
53+
def lipoize_libraries(self):
54+
pass
55+
56+
def create_xcframeworks(self):
57+
58+
frameworks = []
59+
60+
xcframework_dest = os.path.join(self.ctx.dist_dir, "xcframework", "SDL3.xcframework")
61+
if os.path.exists(xcframework_dest):
62+
# Delete the existing xcframework
63+
sh.rm("-rf", xcframework_dest)
64+
65+
for plat in self.platforms_to_build:
66+
build_dir = self.get_build_dir(plat)
67+
frameworks.extend(
68+
[
69+
"-framework",
70+
os.path.join(
71+
build_dir,
72+
f"Xcode/SDL/build/Release-{plat.sdk}.xcarchive/Products/Library/Frameworks/SDL3.framework",
73+
),
74+
]
75+
)
76+
77+
shprint(
78+
sh.xcodebuild,
79+
"-create-xcframework",
80+
*frameworks,
81+
"-output",
82+
xcframework_dest,
83+
)
84+
85+
86+
recipe = LibSDL3Recipe()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- slime73-sdl-experiments-618662dc9e82/src/video/uikit/SDL_uikitopenglview.m.orig 2015-08-20 16:09:59.000000000 +0200
2+
+++ slime73-sdl-experiments-618662dc9e82/src/video/uikit/SDL_uikitopenglview.m 2015-08-20 16:11:25.000000000 +0200
3+
@@ -99,7 +99,7 @@
4+
5+
CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
6+
7+
- eaglLayer.opaque = YES;
8+
+ eaglLayer.opaque = SDL_getenv("UIKIT_TRANSPARENT") ? NO : YES;
9+
eaglLayer.drawableProperties = @{
10+
kEAGLDrawablePropertyRetainedBacking:@(retained),
11+
kEAGLDrawablePropertyColorFormat:colorFormat

0 commit comments

Comments
 (0)