Skip to content

Commit 4ef364d

Browse files
committed
Add sdl3_ttf
1 parent e44d863 commit 4ef364d

File tree

1 file changed

+72
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)