-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
141 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,84 @@ | ||
from kivy_ios.toolchain import Recipe, shprint | ||
from os.path import join | ||
import os | ||
import sh | ||
|
||
|
||
class LibSDL2Recipe(Recipe): | ||
# version = "2.0.9" | ||
# url = "https://www.libsdl.org/release/SDL2-{version}.tar.gz" | ||
version = "7cc4fc886d9e" | ||
url = "https://hg.libsdl.org/SDL/archive/{version}.tar.gz" | ||
library = "Xcode-iOS/SDL/build/Release-{arch.sdk}/libSDL2.a" | ||
version = "ios-use-metalangle" | ||
url = "https://github.com/misl6/SDL/archive/refs/heads/feature/{version}.zip" | ||
|
||
metalangle_baseurl = ( | ||
"https://github.com/kakashidinho/metalangle/releases/download/gles3-0.0.6" | ||
) | ||
metalangle_arch_map = dict( | ||
x86_64="MetalANGLE.framework.ios.simulator.zip", | ||
arm64="MetalANGLE.framework.ios.zip", | ||
) | ||
|
||
library = "Xcode/SDL/build/Release-{arch.sdk}/libSDL2.a" | ||
include_dir = "include" | ||
pbx_frameworks = [ | ||
"OpenGLES", "AudioToolbox", "QuartzCore", "CoreGraphics", | ||
"CoreMotion", "GameController", "AVFoundation", "Metal", | ||
"UIKit"] | ||
"AudioToolbox", | ||
"QuartzCore", | ||
"CoreGraphics", | ||
"CoreMotion", | ||
"GameController", | ||
"AVFoundation", | ||
"Metal", | ||
"UIKit", | ||
"CoreHaptics", | ||
] | ||
|
||
def __init__(self): | ||
if os.environ.get("KIVYIOS_USE_METALANGLE"): | ||
self.frameworks = ["MetalANGLE"] | ||
self.pbx_frameworks.append("MetalANGLE") | ||
else: | ||
self.pbx_frameworks.append("OpenGLES") | ||
|
||
def prebuild_arch(self, arch): | ||
if self.has_marker("patched"): | ||
return | ||
self.apply_patch("uikit-transparent.patch") | ||
if os.environ.get("KIVYIOS_USE_METALANGLE"): | ||
self.apply_patch("enable-metalangle.patch") | ||
downloaded_file = self.download_file( | ||
join(self.metalangle_baseurl, self.metalangle_arch_map[arch.arch]), | ||
self.metalangle_arch_map[arch.arch], | ||
) | ||
self.extract_file( | ||
downloaded_file, | ||
join(self.get_build_dir(arch.arch), "Xcode/SDL/third-party/frameworks"), | ||
) | ||
if arch.arch == "arm64": | ||
self.extract_file( | ||
downloaded_file, | ||
join(self.ctx.dist_dir, "frameworks"), | ||
) | ||
self.set_marker("patched") | ||
|
||
def install_frameworks(self): | ||
pass | ||
|
||
def build_arch(self, arch): | ||
env = arch.get_env() | ||
shprint(sh.xcodebuild, self.ctx.concurrent_xcodebuild, | ||
"ONLY_ACTIVE_ARCH=NO", | ||
"ARCHS={}".format(arch.arch), | ||
"BITCODE_GENERATION_MODE=bitcode", | ||
"CC={}".format(env['CC']), | ||
"-sdk", arch.sdk, | ||
"-project", "Xcode-iOS/SDL/SDL.xcodeproj", | ||
"-target", "libSDL-iOS", | ||
"-configuration", "Release") | ||
shprint( | ||
sh.xcodebuild, | ||
self.ctx.concurrent_xcodebuild, | ||
"ONLY_ACTIVE_ARCH=NO", | ||
"ARCHS={}".format(arch.arch), | ||
"BITCODE_GENERATION_MODE=bitcode", | ||
"CC={}".format(env["CC"]), | ||
"-sdk", | ||
arch.sdk, | ||
"-project", | ||
"Xcode/SDL/SDL.xcodeproj", | ||
"-target", | ||
"Static Library-iOS", | ||
"-configuration", | ||
"Release", | ||
) | ||
|
||
|
||
recipe = LibSDL2Recipe() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
diff -Naur SDL-feature-ios-use-metalangle.orig/include/SDL_config_iphoneos.h SDL-feature-ios-use-metalangle/include/SDL_config_iphoneos.h | ||
--- SDL-feature-ios-use-metalangle.orig/include/SDL_config_iphoneos.h 2021-04-25 10:18:20.000000000 +0200 | ||
+++ SDL-feature-ios-use-metalangle/include/SDL_config_iphoneos.h 2021-04-25 10:20:06.000000000 +0200 | ||
@@ -188,6 +188,11 @@ | ||
|
||
#if SDL_PLATFORM_SUPPORTS_METAL | ||
#define SDL_VIDEO_RENDER_METAL 1 | ||
+#undef SDL_VIDEO_OPENGL_ES2 | ||
+#undef SDL_VIDEO_OPENGL_ES | ||
+#undef SDL_VIDEO_RENDER_OGL_ES | ||
+#undef SDL_VIDEO_RENDER_OGL_ES2 | ||
+#define SDL_VIDEO_METALANGLE 1 | ||
#endif | ||
|
||
#if SDL_PLATFORM_SUPPORTS_METAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters