Skip to content

Add explicit device logic to the iOS build script#1889

Open
a-maurice wants to merge 1 commit into
mainfrom
am-ios_device_build
Open

Add explicit device logic to the iOS build script#1889
a-maurice wants to merge 1 commit into
mainfrom
am-ios_device_build

Conversation

@a-maurice

Copy link
Copy Markdown
Contributor

Description

Provide details of the change, and generalize the change in the PR title above.

When building for iOS and tvOS device, set the appropriate CMAKE_OSX_SYSROOT value. Seems to be necessary based on Xcode and Cmake versions.


Testing

Describe how you've tested these changes. Link any manually triggered Integration tests or CPP binary SDK Packaging Github Action workflows, if applicable.

Building locally.


Type of Change

Place an x the applicable box:

  • Bug fix. Add the issue # below if applicable.
  • New feature. A non-breaking change which adds functionality.
  • Other, such as a build process or documentation change.

Notes

  • Bug fixes and feature changes require an update to the Release Notes section of release_build_files/readme.md.
  • Read the contribution guidelines CONTRIBUTING.md.
  • Changes to the public API require an internal API review. If you'd like to help us make Firebase APIs better, please propose your change in a feature request so that we can discuss it together.

@a-maurice a-maurice added the skip-release-notes Skip release notes check label Jul 23, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the CMake configuration script for iOS and tvOS to set the -DCMAKE_OSX_SYSROOT parameter when the platform variant is 'device'. The reviewer suggested simplifying the nested conditional blocks by using a dictionary mapping for the platform variants to their respective SDK sysroots to improve readability and maintainability.

Comment on lines 483 to +493
cmd.append('-DCMAKE_SYSTEM_NAME=iOS')
if platform_variant == 'simulator':
cmd.append('-DCMAKE_OSX_SYSROOT=iphonesimulator')
elif platform_variant == 'device':
cmd.append('-DCMAKE_OSX_SYSROOT=iphoneos')
elif apple_os == 'tvos':
cmd.append('-DCMAKE_SYSTEM_NAME=tvOS')
if platform_variant == 'simulator':
cmd.append('-DCMAKE_OSX_SYSROOT=appletvsimulator')
elif platform_variant == 'device':
cmd.append('-DCMAKE_OSX_SYSROOT=appletvos')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve readability and maintainability, we can simplify the nested conditional blocks by using a dictionary mapping for the platform variants to their respective SDK sysroots. This avoids repetitive if/elif checks and makes the configuration logic cleaner and more idiomatic.

Suggested change
cmd.append('-DCMAKE_SYSTEM_NAME=iOS')
if platform_variant == 'simulator':
cmd.append('-DCMAKE_OSX_SYSROOT=iphonesimulator')
elif platform_variant == 'device':
cmd.append('-DCMAKE_OSX_SYSROOT=iphoneos')
elif apple_os == 'tvos':
cmd.append('-DCMAKE_SYSTEM_NAME=tvOS')
if platform_variant == 'simulator':
cmd.append('-DCMAKE_OSX_SYSROOT=appletvsimulator')
elif platform_variant == 'device':
cmd.append('-DCMAKE_OSX_SYSROOT=appletvos')
cmd.append('-DCMAKE_SYSTEM_NAME=iOS')
sysroot = {'simulator': 'iphonesimulator', 'device': 'iphoneos'}.get(platform_variant)
if sysroot:
cmd.append('-DCMAKE_OSX_SYSROOT={0}'.format(sysroot))
elif apple_os == 'tvos':
cmd.append('-DCMAKE_SYSTEM_NAME=tvOS')
sysroot = {'simulator': 'appletvsimulator', 'device': 'appletvos'}.get(platform_variant)
if sysroot:
cmd.append('-DCMAKE_OSX_SYSROOT={0}'.format(sysroot))

@a-maurice
a-maurice requested a review from AustinBenoit July 24, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-release-notes Skip release notes check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant