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 ()
0 commit comments