Skip to content

Commit 167daf3

Browse files
Add Xcode 26 CI jobs for iOS and macOS (#1642)
Add iOS and macOS build jobs targeting Xcode 26 --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3759b35 commit 167daf3

8 files changed

Lines changed: 112 additions & 43 deletions

File tree

.github/workflows/build-ios.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,21 @@ on:
66
deployment-target:
77
required: true
88
type: string
9+
xcode-version:
10+
required: false
11+
type: string
12+
default: '16.4'
13+
runs-on:
14+
required: false
15+
type: string
16+
default: macos-latest
917

1018
env:
1119
CMAKE_VERSION: '3.31.6'
12-
XCODE_VERSION: '16.4'
1320

1421
jobs:
1522
build:
16-
runs-on: macos-latest
23+
runs-on: ${{ inputs.runs-on }}
1724
timeout-minutes: 30
1825
steps:
1926
- uses: actions/checkout@v5
@@ -23,8 +30,8 @@ jobs:
2330
cmake-version: ${{ env.CMAKE_VERSION }}
2431

2532

26-
- name: Select Xcode ${{ env.XCODE_VERSION }}
27-
run: sudo xcode-select --switch /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer
33+
- name: Select Xcode ${{ inputs.xcode-version }}
34+
run: sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-version }}.app/Contents/Developer
2835

2936
- name: Generate iOS solution
3037
run: |

.github/workflows/build-macos.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,21 @@ on:
1111
required: false
1212
type: boolean
1313
default: false
14+
xcode-version:
15+
required: false
16+
type: string
17+
default: '16.4'
18+
runs-on:
19+
required: false
20+
type: string
21+
default: macos-latest
1422

1523
env:
1624
CMAKE_VERSION: '3.31.6'
17-
XCODE_VERSION: '16.4'
1825

1926
jobs:
2027
build:
21-
runs-on: macos-latest
28+
runs-on: ${{ inputs.runs-on }}
2229
timeout-minutes: 30
2330
steps:
2431
- uses: actions/checkout@v5
@@ -28,8 +35,8 @@ jobs:
2835
cmake-version: ${{ env.CMAKE_VERSION }}
2936

3037

31-
- name: Select Xcode ${{ env.XCODE_VERSION }}
32-
run: sudo xcode-select --switch /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer
38+
- name: Select Xcode ${{ inputs.xcode-version }}
39+
run: sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-version }}.app/Contents/Developer
3340

3441
- name: Generate macOS solution
3542
run: |

.github/workflows/ci.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,21 @@ jobs:
3232
with:
3333
deployment-target: '17.5'
3434

35-
# ── Win32 ─────────────────────────────────────────────────────
35+
# ── Apple: Xcode 26 ──────────────────────────────────────────
36+
MacOS_Xcode26:
37+
uses: ./.github/workflows/build-macos.yml
38+
with:
39+
xcode-version: '26.4'
40+
runs-on: macos-26
41+
42+
iOS_Xcode26:
43+
uses: ./.github/workflows/build-ios.yml
44+
with:
45+
deployment-target: '26.0'
46+
xcode-version: '26.4'
47+
runs-on: macos-26
48+
49+
# ── Win32─────────────────────────────────────────────────────
3650
Win32_x64_D3D11:
3751
uses: ./.github/workflows/build-win32.yml
3852
with:

.github/workflows/test-install-ios.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ on:
66
deployment-target:
77
required: true
88
type: string
9+
xcode-version:
10+
required: false
11+
type: string
12+
default: '16.4'
913

1014
env:
1115
CMAKE_VERSION: '3.31.6'
12-
XCODE_VERSION: '16.4'
1316

1417
jobs:
1518
test-install:
@@ -23,8 +26,8 @@ jobs:
2326
cmake-version: ${{ env.CMAKE_VERSION }}
2427

2528

26-
- name: Select Xcode ${{ env.XCODE_VERSION }}
27-
run: sudo xcode-select --switch /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer
29+
- name: Select Xcode ${{ inputs.xcode-version }}
30+
run: sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-version }}.app/Contents/Developer
2831

2932
- name: Configure
3033
run: |

.github/workflows/test-install-macos.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
name: Test Install macOS
22

33
on:
4-
workflow_call: {}
4+
workflow_call:
5+
inputs:
6+
xcode-version:
7+
required: false
8+
type: string
9+
default: '16.4'
510

611
env:
712
CMAKE_VERSION: '3.31.6'
8-
XCODE_VERSION: '16.4'
913

1014
jobs:
1115
test-install:
@@ -19,8 +23,8 @@ jobs:
1923
cmake-version: ${{ env.CMAKE_VERSION }}
2024

2125

22-
- name: Select Xcode ${{ env.XCODE_VERSION }}
23-
run: sudo xcode-select --switch /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer
26+
- name: Select Xcode ${{ inputs.xcode-version }}
27+
run: sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-version }}.app/Contents/Developer
2428

2529
- name: Configure
2630
run: |

Core/Graphics/Source/DeviceImpl_iOS.mm

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
#import <QuartzCore/QuartzCore.h>
66
#import <UIKit/UIKit.h>
77

8+
9+
namespace
10+
{
11+
bool IsValidScale(float scale)
12+
{
13+
return !std::isinf(scale) && scale > 0;
14+
}
15+
}
16+
817
namespace Babylon::Graphics
918
{
1019
void DeviceImpl::ConfigureBgfxPlatformData(bgfx::PlatformData& pd, WindowT window)
@@ -19,12 +28,32 @@
1928
float DeviceImpl::GetDevicePixelRatio(WindowT window)
2029
{
2130
// contentsScale can return 0 if it hasn't been set yet.
22-
// Fallback to the scale from the main screen.
2331
float scale = static_cast<float>(((CAMetalLayer*)window).contentsScale);
24-
if (std::isinf(scale) || scale <= 0)
32+
if (IsValidScale(scale))
2533
{
26-
scale = UIScreen.mainScreen.scale;
34+
return scale;
2735
}
28-
return scale;
36+
37+
// Prefer getting the scale from the active window scene's trait collection.
38+
if (@available(iOS 17.0, *))
39+
{
40+
for (UIScene* scene in UIApplication.sharedApplication.connectedScenes)
41+
{
42+
if ([scene isKindOfClass:[UIWindowScene class]])
43+
{
44+
scale = static_cast<float>(((UIWindowScene*)scene).traitCollection.displayScale);
45+
if (IsValidScale(scale))
46+
{
47+
return scale;
48+
}
49+
}
50+
}
51+
}
52+
53+
// Fallback for older iOS versions or if no active scene was found.
54+
#pragma clang diagnostic push
55+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
56+
return UIScreen.mainScreen.scale;
57+
#pragma clang diagnostic pop
2958
}
3059
}

Dependencies/xr/Source/ARKit/XR.mm

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -257,18 +257,19 @@ - (void) UnlockAnchors {
257257
Returns the orientation of the app
258258
*/
259259
- (UIInterfaceOrientation)orientation {
260-
UIApplication* sharedApplication = [UIApplication sharedApplication];
261-
#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_13_0)
262-
UIScene* scene = [[[sharedApplication connectedScenes] allObjects] firstObject];
263-
return [(UIWindowScene*)scene interfaceOrientation];
264-
#else
265-
if (@available(iOS 13.0, *)) {
266-
return [[[[sharedApplication windows] firstObject] windowScene] interfaceOrientation];
260+
UIApplication* app = [UIApplication sharedApplication];
261+
if (@available(iOS 26.0, *)) {
262+
UIWindowScene* windowScene = (UIWindowScene*)[[[app connectedScenes] allObjects] firstObject];
263+
return windowScene.effectiveGeometry.interfaceOrientation;
267264
}
268-
else {
269-
return [sharedApplication statusBarOrientation];
265+
#pragma clang diagnostic push
266+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
267+
if (@available(iOS 13.0, *)) {
268+
UIWindowScene* windowScene = [[[app windows] firstObject] windowScene];
269+
return [windowScene interfaceOrientation];
270270
}
271-
#endif
271+
return [app statusBarOrientation];
272+
#pragma clang diagnostic pop
272273
}
273274

274275
/**

Plugins/NativeCamera/Source/Apple/CameraDevice.mm

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -900,23 +900,27 @@ - (void) reset {
900900
}
901901

902902
#if (TARGET_OS_IPHONE)
903+
904+
static UIInterfaceOrientation GetCurrentInterfaceOrientation(UIApplication* app) {
905+
if (@available(iOS 26.0, *)) {
906+
UIWindowScene* windowScene = (UIWindowScene*)[[[app connectedScenes] allObjects] firstObject];
907+
return windowScene.effectiveGeometry.interfaceOrientation;
908+
}
909+
#pragma clang diagnostic push
910+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
911+
if (@available(iOS 13.0, *)) {
912+
UIWindowScene* windowScene = [[[app windows] firstObject] windowScene];
913+
return [windowScene interfaceOrientation];
914+
}
915+
return [app statusBarOrientation];
916+
#pragma clang diagnostic pop
917+
}
918+
903919
/**
904920
Updates target video orientation.
905921
*/
906922
- (void)updateOrientation {
907-
UIApplication* sharedApplication{[UIApplication sharedApplication]};
908-
UIInterfaceOrientation orientation{UIInterfaceOrientationUnknown};
909-
#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_13_0)
910-
UIScene* scene{[[[sharedApplication connectedScenes] allObjects] firstObject]};
911-
orientation = [(UIWindowScene*)scene interfaceOrientation];
912-
#else
913-
if (@available(iOS 13.0, *)) {
914-
orientation = [[[[sharedApplication windows] firstObject] windowScene] interfaceOrientation];
915-
}
916-
else {
917-
orientation = [sharedApplication statusBarOrientation];
918-
}
919-
#endif
923+
UIInterfaceOrientation orientation = GetCurrentInterfaceOrientation([UIApplication sharedApplication]);
920924

921925
// Convert from UIInterfaceOrientation to VideoOrientation.
922926
switch (orientation)

0 commit comments

Comments
 (0)