try my way
This commit is contained in:
1 parent
6fecc1e95e
commit
fa1cd053c8
16 files changed
+521
-2
No files matched your search
@@ -9,3 +9,4 @@ gradle-daemon-jvm.properties
|
||||
local.properties
|
||||
Package.resolved
|
||||
*.xcodeproj
|
||||
Frameworks
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef OGS_MAHJONG_RAYLIB_IOS_BRIDGING_HEADER_H
|
||||
#define OGS_MAHJONG_RAYLIB_IOS_BRIDGING_HEADER_H
|
||||
|
||||
#import "raybriIOS.h"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef OGS_MAHJONG_RAYLIB_IOS_BRIDGE_H
|
||||
#define OGS_MAHJONG_RAYLIB_IOS_BRIDGE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Initialise EGL (ANGLE) on the given CALayer and bring up raylib's rlgl.
|
||||
// Unlike the ghera/raylib-iOS backend, no raylib window, view controller or
|
||||
// app delegate is involved: the caller owns the layer and the frame timer.
|
||||
// Returns 1 on success, 0 on failure.
|
||||
int raybri_ios_init(void *layer, int width, int height);
|
||||
|
||||
// Recreate the EGL window surface for a new drawable size (backing pixels).
|
||||
void raybri_ios_resize(int width, int height);
|
||||
|
||||
// Render one frame: clear the drawable to a time-based background colour and
|
||||
// present it. `time` is monotonically increasing seconds.
|
||||
void raybri_ios_render(double time);
|
||||
|
||||
// Release rlgl state and the EGL surface/context/display.
|
||||
void raybri_ios_shutdown(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,236 @@
|
||||
// iOS counterpart of raybri.c.
|
||||
//
|
||||
// The prebuilt ghera/raylib-iOS xcframework is callback-driven: its rcore_ios.c
|
||||
// defines main(), AppDelegate, SceneDelegate and GameViewController, so linking
|
||||
// it would hand the whole app to raylib (and clash with SwiftUI's own main()).
|
||||
// Instead this bridge compiles raylib's renderer (rlgl) directly and owns only
|
||||
// the GL side. The view and the frame timer stay in ver-ios, exactly like the
|
||||
// macOS build where RenderVM drives the NSOpenGLView.
|
||||
//
|
||||
// GL runs on ANGLE (libEGL + libGLESv2, Metal backend), taken from the same
|
||||
// ghera release as raylib's headers.
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#include "raybriIOS.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <libEGL/libEGL.h>
|
||||
|
||||
// rlgl's iOS branch includes <libGLESv2/GLES/glext.h> before gl2/gl3, so the
|
||||
// GL_API/GL_APIENTRY macros have to come from glplatform.h first. ghera's
|
||||
// build script does this with -include; we do it explicitly.
|
||||
#include <libGLESv2/GLES/gl.h>
|
||||
|
||||
#define RLGL_IMPLEMENTATION
|
||||
#include <rlgl.h>
|
||||
|
||||
static EGLDisplay sr_display = EGL_NO_DISPLAY;
|
||||
static EGLSurface sr_surface = EGL_NO_SURFACE;
|
||||
static EGLContext sr_context = EGL_NO_CONTEXT;
|
||||
static EGLConfig sr_config = NULL;
|
||||
static void *sr_layer = NULL;
|
||||
|
||||
static int sr_ready = 0;
|
||||
static int sr_width = 1;
|
||||
static int sr_height = 1;
|
||||
|
||||
static void sr_log(const char *text)
|
||||
{
|
||||
fprintf(stderr, "RBIOS: %s\n", text);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
static void sr_hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b)
|
||||
{
|
||||
float i = floorf(h * 6.0f);
|
||||
float f = h * 6.0f - i;
|
||||
float p = v * (1.0f - s);
|
||||
float q = v * (1.0f - f * s);
|
||||
float t = v * (1.0f - (1.0f - f) * s);
|
||||
|
||||
switch (((int)i) % 6)
|
||||
{
|
||||
case 0: *r = v; *g = t; *b = p; break;
|
||||
case 1: *r = q; *g = v; *b = p; break;
|
||||
case 2: *r = p; *g = v; *b = t; break;
|
||||
case 3: *r = p; *g = q; *b = v; break;
|
||||
case 4: *r = t; *g = p; *b = v; break;
|
||||
default: *r = v; *g = p; *b = q; break;
|
||||
}
|
||||
}
|
||||
|
||||
// (Re)create the EGL window surface on the layer handed to us by UIKit.
|
||||
static int sr_create_surface(void)
|
||||
{
|
||||
if (sr_surface != EGL_NO_SURFACE)
|
||||
{
|
||||
eglDestroySurface(sr_display, sr_surface);
|
||||
sr_surface = EGL_NO_SURFACE;
|
||||
}
|
||||
|
||||
// ANGLE on iOS takes a CALayer as the native window.
|
||||
sr_surface = eglCreateWindowSurface(sr_display, sr_config, (EGLNativeWindowType)sr_layer, NULL);
|
||||
if (sr_surface == EGL_NO_SURFACE)
|
||||
{
|
||||
sr_log("failed to create EGL window surface");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (eglMakeCurrent(sr_display, sr_surface, sr_surface, sr_context) == EGL_FALSE)
|
||||
{
|
||||
sr_log("failed to make the EGL context current");
|
||||
return 0;
|
||||
}
|
||||
|
||||
rlViewport(0, 0, sr_width, sr_height);
|
||||
rlSetFramebufferWidth(sr_width);
|
||||
rlSetFramebufferHeight(sr_height);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int raybri_ios_init(void *layer, int width, int height)
|
||||
{
|
||||
if (sr_ready) return 1;
|
||||
|
||||
if (layer == NULL)
|
||||
{
|
||||
sr_log("no drawable layer");
|
||||
return 0;
|
||||
}
|
||||
|
||||
sr_layer = layer;
|
||||
sr_width = (width > 0) ? width : 1;
|
||||
sr_height = (height > 0) ? height : 1;
|
||||
|
||||
sr_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
if (sr_display == EGL_NO_DISPLAY)
|
||||
{
|
||||
sr_log("failed to get the EGL display");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (eglInitialize(sr_display, NULL, NULL) == EGL_FALSE)
|
||||
{
|
||||
sr_log("failed to initialize EGL");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (eglBindAPI(EGL_OPENGL_ES_API) == EGL_FALSE)
|
||||
{
|
||||
sr_log("failed to bind the OpenGL ES API");
|
||||
return 0;
|
||||
}
|
||||
|
||||
const EGLint config_attribs[] = {
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT,
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
EGL_RED_SIZE, 8,
|
||||
EGL_GREEN_SIZE, 8,
|
||||
EGL_BLUE_SIZE, 8,
|
||||
EGL_ALPHA_SIZE, 8,
|
||||
EGL_DEPTH_SIZE, 16,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
EGLint config_count = 0;
|
||||
if (eglChooseConfig(sr_display, config_attribs, &sr_config, 1, &config_count) == EGL_FALSE || config_count < 1)
|
||||
{
|
||||
sr_log("failed to choose an EGL config");
|
||||
return 0;
|
||||
}
|
||||
|
||||
const EGLint context_attribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, 3,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
sr_context = eglCreateContext(sr_display, sr_config, EGL_NO_CONTEXT, context_attribs);
|
||||
if (sr_context == EGL_NO_CONTEXT)
|
||||
{
|
||||
sr_log("failed to create an EGL context");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!sr_create_surface()) return 0;
|
||||
|
||||
// With GL_GLEXT_PROTOTYPES rlgl calls the ANGLE entry points directly, but
|
||||
// the call keeps parity with the platform backends and is harmless.
|
||||
rlLoadExtensions((void *)eglGetProcAddress);
|
||||
rlglInit(sr_width, sr_height);
|
||||
|
||||
sr_log("EGL/ANGLE + rlgl initialized");
|
||||
sr_ready = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void raybri_ios_resize(int width, int height)
|
||||
{
|
||||
if (!sr_ready) return;
|
||||
|
||||
if (width <= 0 || height <= 0) return;
|
||||
if (width == sr_width && height == sr_height) return;
|
||||
|
||||
sr_width = width;
|
||||
sr_height = height;
|
||||
|
||||
if (!sr_create_surface()) return;
|
||||
|
||||
sr_log("surface recreated");
|
||||
}
|
||||
|
||||
void raybri_ios_render(double time)
|
||||
{
|
||||
if (!sr_ready) return;
|
||||
|
||||
if (eglMakeCurrent(sr_display, sr_surface, sr_surface, sr_context) == EGL_FALSE) return;
|
||||
|
||||
// Background colour cycles through the hue wheel over time.
|
||||
float hue = fmodf((float)time * 0.15f, 1.0f);
|
||||
float r = 0.0f;
|
||||
float g = 0.0f;
|
||||
float b = 0.0f;
|
||||
sr_hsv_to_rgb(hue, 0.65f, 0.85f, &r, &g, &b);
|
||||
|
||||
rlClearColor((unsigned char)(r * 255.0f), (unsigned char)(g * 255.0f), (unsigned char)(b * 255.0f), 255);
|
||||
rlClearScreenBuffers();
|
||||
|
||||
eglSwapBuffers(sr_display, sr_surface);
|
||||
}
|
||||
|
||||
void raybri_ios_shutdown(void)
|
||||
{
|
||||
if (!sr_ready) return;
|
||||
|
||||
eglMakeCurrent(sr_display, sr_surface, sr_surface, sr_context);
|
||||
rlglClose();
|
||||
|
||||
eglMakeCurrent(sr_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
if (sr_surface != EGL_NO_SURFACE)
|
||||
{
|
||||
eglDestroySurface(sr_display, sr_surface);
|
||||
sr_surface = EGL_NO_SURFACE;
|
||||
}
|
||||
|
||||
if (sr_context != EGL_NO_CONTEXT)
|
||||
{
|
||||
eglDestroyContext(sr_display, sr_context);
|
||||
sr_context = EGL_NO_CONTEXT;
|
||||
}
|
||||
|
||||
if (sr_display != EGL_NO_DISPLAY)
|
||||
{
|
||||
eglTerminate(sr_display);
|
||||
sr_display = EGL_NO_DISPLAY;
|
||||
}
|
||||
|
||||
sr_layer = NULL;
|
||||
sr_ready = 0;
|
||||
|
||||
sr_log("shutdown");
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import UIKit
|
||||
|
||||
// UIView counterpart of the macOS RenderGLView. UIKit never draws into it: the
|
||||
// EGL/ANGLE surface renders directly into this view's layer, and the timer in
|
||||
// RenderVM presents a new frame. The view only reports when it gains a window
|
||||
// and when its backing size changes.
|
||||
final class RenderGLView: UIView {
|
||||
private weak var renderVM: RenderVM?
|
||||
private var didInit = false
|
||||
private var lastPixelSize: [Int32] = [0, 0]
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
||||
isOpaque = true
|
||||
// Touch handling is not wired to raylib yet, so keep the GL view
|
||||
// transparent to the SwiftUI hierarchy above it.
|
||||
isUserInteractionEnabled = false
|
||||
|
||||
contentScaleFactor = UIScreen.main.scale
|
||||
layer.contentsScale = contentScaleFactor
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
override func didMoveToWindow() {
|
||||
super.didMoveToWindow()
|
||||
|
||||
guard let window else { return }
|
||||
contentScaleFactor = window.screen.nativeScale
|
||||
layer.contentsScale = contentScaleFactor
|
||||
|
||||
guard !didInit, let vm = RenderVM.shared else { return }
|
||||
guard renderInit(vm) else { return }
|
||||
|
||||
renderVM = vm
|
||||
didInit = true
|
||||
lastPixelSize = renderPixelSize(self)
|
||||
renderStartTimer(vm)
|
||||
}
|
||||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
|
||||
guard didInit else { return }
|
||||
|
||||
let size = renderPixelSize(self)
|
||||
guard size != lastPixelSize else { return }
|
||||
|
||||
lastPixelSize = size
|
||||
raybri_ios_resize(size[0], size[1])
|
||||
}
|
||||
|
||||
deinit {
|
||||
guard didInit, let vm = renderVM else { return }
|
||||
renderDeinit(vm)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import Combine
|
||||
import Foundation
|
||||
|
||||
// iOS counterpart of the macOS RenderVM: it owns the view raylib draws into
|
||||
// and the timer that drives it. The actual rendering lives in raybriIOS.mm.
|
||||
final class RenderVM: ObservableObject {
|
||||
static private(set) weak var shared: RenderVM?
|
||||
|
||||
let glView = RenderGLView(frame: .zero)
|
||||
var startTime: CFTimeInterval = 0
|
||||
var timer: Timer?
|
||||
|
||||
init() {
|
||||
Self.shared = self
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import SwiftUI
|
||||
|
||||
// SwiftUI counterpart of the macOS RenderView. It vends the shared GL view,
|
||||
// which RenderVM also keeps alive and drives with a timer.
|
||||
struct RenderView: UIViewRepresentable {
|
||||
func makeUIView(context: Context) -> RenderGLView {
|
||||
RenderVM.shared!.glView
|
||||
}
|
||||
|
||||
func updateUIView(_ uiView: RenderGLView, context: Context) {}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import QuartzCore
|
||||
import UIKit
|
||||
|
||||
// Render a single frame. The timer calls this directly: an EGL/ANGLE surface
|
||||
// presents into the view's layer, so there is no draw(_:) / needsDisplay pass
|
||||
// like in the NSOpenGLView on macOS.
|
||||
func renderDraw(_ vm: RenderVM) {
|
||||
raybri_ios_render(CACurrentMediaTime() - vm.startTime)
|
||||
}
|
||||
|
||||
// Backing-pixel size of the view, which is what EGL/ANGLE renders into.
|
||||
func renderPixelSize(_ view: UIView) -> [Int32] {
|
||||
let scale = view.contentScaleFactor
|
||||
let w = Int32(max(1, (view.bounds.width * scale).rounded()))
|
||||
let h = Int32(max(1, (view.bounds.height * scale).rounded()))
|
||||
return [w, h]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
// iOS render constants. The macOS renderConst.swift depends on AppKit and the
|
||||
// RaylibBridge SPM module, so the two platforms keep separate files.
|
||||
let RENDER_FPS = 60.0
|
||||
@@ -0,0 +1,35 @@
|
||||
import Foundation
|
||||
import QuartzCore
|
||||
import UIKit
|
||||
|
||||
// Bring up EGL/ANGLE on the view's layer. Returns false when the surface could
|
||||
// not be created (the caller then leaves the timer stopped).
|
||||
func renderInit(_ vm: RenderVM) -> Bool {
|
||||
let size = renderPixelSize(vm.glView)
|
||||
let layer = Unmanaged.passUnretained(vm.glView.layer).toOpaque()
|
||||
let ok = raybri_ios_init(layer, size[0], size[1]) != 0
|
||||
if !ok {
|
||||
otherPrintStderr("ИГР renderInit: EGL/ANGLE initialization failed")
|
||||
}
|
||||
return ok
|
||||
}
|
||||
|
||||
// Same shape as the macOS timer: a repeating timer on the main run loop, but
|
||||
// here it calls the renderer directly instead of flagging the view for redraw.
|
||||
func renderStartTimer(_ vm: RenderVM) {
|
||||
vm.startTime = CACurrentMediaTime()
|
||||
|
||||
let timer = Timer(timeInterval: 1.0 / RENDER_FPS, repeats: true) { [weak vm] _ in
|
||||
guard let vm else { return }
|
||||
renderDraw(vm)
|
||||
}
|
||||
vm.timer = timer
|
||||
// .common keeps rendering alive while the user holds a control.
|
||||
RunLoop.main.add(timer, forMode: .common)
|
||||
}
|
||||
|
||||
func renderDeinit(_ vm: RenderVM) {
|
||||
vm.timer?.invalidate()
|
||||
vm.timer = nil
|
||||
raybri_ios_shutdown()
|
||||
}
|
||||
@@ -5,10 +5,31 @@ targets:
|
||||
ogs-chkgfx:
|
||||
type: application
|
||||
platform: iOS
|
||||
deploymentTarget: "15.0"
|
||||
deploymentTarget: "15.6"
|
||||
sources:
|
||||
- path: Assets.xcassets
|
||||
- path: src
|
||||
- path: ../../components/render/ios
|
||||
- path: ../../components/raybri/ios
|
||||
dependencies:
|
||||
- framework: Frameworks/libEGL.xcframework
|
||||
embed: true
|
||||
- framework: Frameworks/libGLESv2.xcframework
|
||||
embed: true
|
||||
settings:
|
||||
base:
|
||||
INFOPLIST_FILE: Info.plist
|
||||
PRODUCT_BUNDLE_IDENTIFIER: org.opengamestudio.chkgfx
|
||||
SWIFT_OBJC_BRIDGING_HEADER: ../../components/raybri/ios/RaybriIOS-Bridging-Header.h
|
||||
HEADER_SEARCH_PATHS:
|
||||
- "$(SRCROOT)/../../components/raybri/ios"
|
||||
- "$(SRCROOT)/../../components/render/ios"
|
||||
- "$(SRCROOT)/Frameworks/include"
|
||||
- "$(SRCROOT)/Frameworks/raylib.xcframework/ios-arm64_x86_64-simulator/raylib.framework/Headers"
|
||||
- "$(SRCROOT)/Frameworks/raylib.xcframework/ios-arm64/raylib.framework/Headers"
|
||||
GCC_PREPROCESSOR_DEFINITIONS:
|
||||
- PLATFORM_IOS=1
|
||||
- GRAPHICS_API_OPENGL_ES3=1
|
||||
- GL_GLEXT_PROTOTYPES=1
|
||||
LD_RUNPATH_SEARCH_PATHS:
|
||||
- "$(inherited) @executable_path/Frameworks"
|
||||
@@ -6,6 +6,7 @@ final class AppDelegate:
|
||||
{
|
||||
let chkgfx = ChkgfxComponent()
|
||||
let chkgfxVM = ChkgfxVM()
|
||||
let renderVM = RenderVM()
|
||||
|
||||
func application(
|
||||
_ application: UIApplication,
|
||||
|
||||
@@ -6,7 +6,11 @@ struct ChkgfxApp: App {
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ChkgfxView(appDelegate.chkgfxVM)
|
||||
ZStack {
|
||||
RenderView()
|
||||
.ignoresSafeArea()
|
||||
ChkgfxView(appDelegate.chkgfxVM)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash -e
|
||||
SDIR=$(cd "$(dirname "$0")" ; pwd -P)
|
||||
|
||||
T=$SDIR/step
|
||||
source $SDIR/paths
|
||||
|
||||
TARGET=ogs-chkgfx
|
||||
|
||||
STEP=0
|
||||
source $T/generateDialect $TARGET
|
||||
source $T/prepareIOS $TARGET
|
||||
|
||||
cd $SDIR/../$TARGET/ver-ios
|
||||
xcodebuild -scheme "ogs-chkgfx" -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' -derivedDataPath .build build
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash -e
|
||||
SDIR=$(cd "$(dirname "$0")" ; pwd -P)
|
||||
|
||||
T=$SDIR/step
|
||||
source $SDIR/paths
|
||||
|
||||
TARGET=ogs-chkgfx
|
||||
BUNDLE_ID=org.opengamestudio.chkgfx
|
||||
APP="$SDIR/../$TARGET/ver-ios/.build/Build/Products/Debug-iphonesimulator/ogs-chkgfx.app"
|
||||
|
||||
if [[ ! -d "$APP" ]]; then
|
||||
echo "iOS app not built yet, run util/build-ogs-chkgfx-ios"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DEVICE=${DEVICE:-"iPhone 15 Pro"}
|
||||
UDID=$(xcrun simctl list devices available | grep -m1 "$DEVICE (" | sed -E 's/.*\(([0-9A-F-]{36})\).*/\1/')
|
||||
if [[ -z "$UDID" ]]; then
|
||||
echo "Simulator '$DEVICE' not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
xcrun simctl boot "$UDID" 2>/dev/null || true
|
||||
sleep 2
|
||||
xcrun simctl install "$UDID" "$APP"
|
||||
xcrun simctl launch "$UDID" "$BUNDLE_ID"
|
||||
@@ -5,5 +5,45 @@ TARGET=$1
|
||||
STEP=$((STEP+1))
|
||||
echo -e "\n> > > > Step №$STEP. Generate iOS project for '$TARGET'"
|
||||
|
||||
# iOS rendering goes through ghera/raylib-iOS: a raylib fork that renders
|
||||
# OpenGL ES via ANGLE (Metal backend). Its stable releases ship prebuilt
|
||||
# xcframeworks (raylib + libEGL + libGLESv2, ~46 MB), so they are downloaded
|
||||
# on demand and never committed.
|
||||
#
|
||||
# Unlike the fork's own app, ver-ios does not link raylib.xcframework (its
|
||||
# rcore.o defines main() and a private view controller). We only use its
|
||||
# headers: raylib's renderer (rlgl) is compiled into components/raybri/ios,
|
||||
# and EGL/ANGLE provides the GL context.
|
||||
RAYLIB_IOS_TAG=6.0.7-iOS
|
||||
FRAMEWORKS=$SDIR/../$TARGET/ver-ios/Frameworks
|
||||
|
||||
MISSING=0
|
||||
for FRAMEWORK in raylib libEGL libGLESv2; do
|
||||
[[ -d "$FRAMEWORKS/$FRAMEWORK.xcframework" ]] || MISSING=1
|
||||
done
|
||||
|
||||
if [[ $MISSING -eq 1 ]]; then
|
||||
echo "Raylib iOS xcframeworks missing, downloading $RAYLIB_IOS_TAG..."
|
||||
mkdir -p "$FRAMEWORKS"
|
||||
TMP=$(mktemp -d)
|
||||
curl -sL --retry 3 -o "$TMP/raylib-ios.zip" \
|
||||
"https://github.com/ghera/raylib-iOS/releases/download/$RAYLIB_IOS_TAG/raylib-ios-xcframeworks-$RAYLIB_IOS_TAG.zip"
|
||||
unzip -q "$TMP/raylib-ios.zip" -d "$TMP"
|
||||
cp -R "$TMP/raylib-ios-xcframeworks/raylib.xcframework" "$FRAMEWORKS/"
|
||||
cp -R "$TMP/raylib-ios-xcframeworks/libEGL.xcframework" "$FRAMEWORKS/"
|
||||
cp -R "$TMP/raylib-ios-xcframeworks/libGLESv2.xcframework" "$FRAMEWORKS/"
|
||||
rm -rf "$TMP"
|
||||
fi
|
||||
|
||||
# The ANGLE headers are shipped as framework Headers directories but their
|
||||
# internal includes expect the `libEGL/...` and `libGLESv2/...` layout, so
|
||||
# stage symlinks for the header search path. The headers are identical for
|
||||
# device and simulator, so one slice is enough.
|
||||
mkdir -p "$FRAMEWORKS/include"
|
||||
ln -sfn "../libEGL.xcframework/ios-arm64_x86_64-simulator/libEGL.framework/Headers" \
|
||||
"$FRAMEWORKS/include/libEGL"
|
||||
ln -sfn "../libGLESv2.xcframework/ios-arm64_x86_64-simulator/libGLESv2.framework/Headers" \
|
||||
"$FRAMEWORKS/include/libGLESv2"
|
||||
|
||||
cd $SDIR/../$TARGET/ver-ios
|
||||
xcodegen
|
||||
Reference in new issue
Block a user