Skip to content

Commit e44d863

Browse files
committed
Add SDL3_image
1 parent 78dd6ea commit e44d863

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import os
2+
3+
import sh
4+
5+
from kivy_ios.toolchain import Recipe, shprint
6+
7+
8+
class LibSDL3ImageRecipe(Recipe):
9+
version = "3.2.4"
10+
url = "https://github.com/libsdl-org/SDL_image/releases/download/release-{version}/SDL3_image-{version}.tar.gz"
11+
include_dir = "include"
12+
pbx_frameworks = [
13+
"CoreGraphics",
14+
"Foundation",
15+
"ImageIO",
16+
"MobileCoreServices",
17+
"UIKit"
18+
]
19+
20+
def build_platform(self, plat):
21+
22+
if plat.sdk == "iphonesimulator":
23+
destination = "generic/platform=iOS Simulator"
24+
else:
25+
destination = "generic/platform=iOS"
26+
27+
shprint(
28+
sh.xcodebuild, "archive",
29+
"-scheme", "SDL3_image",
30+
"-project", "Xcode/SDL_image.xcodeproj",
31+
"-archivePath", f"Xcode/build/Release-{plat.sdk}",
32+
"-destination", destination,
33+
"-configuration", "Release",
34+
"BUILD_LIBRARY_FOR_DISTRIBUTION=YES",
35+
"SKIP_INSTALL=NO",
36+
)
37+
38+
def lipoize_libraries(self):
39+
pass
40+
41+
def create_xcframeworks(self):
42+
43+
frameworks = []
44+
45+
xcframework_dest = os.path.join(self.ctx.dist_dir, "xcframework", "SDL3_image.xcframework")
46+
if os.path.exists(xcframework_dest):
47+
# Delete the existing xcframework
48+
sh.rm("-rf", xcframework_dest)
49+
50+
for plat in self.platforms_to_build:
51+
build_dir = self.get_build_dir(plat)
52+
frameworks.extend(
53+
[
54+
"-framework",
55+
os.path.join(
56+
build_dir,
57+
f"Xcode/build/Release-{plat.sdk}.xcarchive/Products/Library/Frameworks/SDL3_image.framework",
58+
),
59+
]
60+
)
61+
62+
shprint(
63+
sh.xcodebuild,
64+
"-create-xcframework",
65+
*frameworks,
66+
"-output",
67+
xcframework_dest,
68+
)
69+
70+
71+
recipe = LibSDL3ImageRecipe()

0 commit comments

Comments
 (0)