Skip to content

Introduce CLR_CMAKE_TARGET_APPLE_MOBILE for iOS/tvOS/MacCatalyst#126833

Open
steveisok wants to merge 2 commits intodotnet:mainfrom
steveisok:cmake-apple-target
Open

Introduce CLR_CMAKE_TARGET_APPLE_MOBILE for iOS/tvOS/MacCatalyst#126833
steveisok wants to merge 2 commits intodotnet:mainfrom
steveisok:cmake-apple-target

Conversation

@steveisok
Copy link
Copy Markdown
Member

These three platforms share the same runtime constraints: static linking, no fork(), no build tools, hybrid globalization, no console signals, etc. Having each one listed individually in cmake conditions is verbose and error-prone — PR #126550 accidentally disabled FEATURE_CORPROFILER for tvOS alone, breaking unified-build tvOS legs.

Introduce CLR_CMAKE_TARGET_APPLE_MOBILE as an umbrella variable in configureplatform.cmake, set when any of iOS, tvOS, or MacCatalyst is the target. Replace ~30 'all three grouped' patterns across 11 cmake files with the umbrella, reducing line noise and preventing future divergence.

Per-platform variables are preserved where they genuinely differ:

  • configurecompiler.cmake: TARGET_* C++ defines and compiler targets
  • System.Security.Cryptography.Native.Apple: Swift platform names
  • System.Net.Security.Native / corehost: tvOS gssapi exclusion
  • System.Native: MacCatalyst pal_iossupportversion.m

Also fixes: sendfile exclusion was missing MacCatalyst (now covered by APPLE_MOBILE), and the triplicated configure.cmake feature overrides for iOS/MacCatalyst/tvOS are consolidated into one block.

These three platforms share the same runtime constraints: static linking,
no fork(), no build tools, hybrid globalization, no console signals, etc.
Having each one listed individually in cmake conditions is verbose and
error-prone — PR dotnet#126550 accidentally disabled FEATURE_CORPROFILER for
tvOS alone, breaking unified-build tvOS legs.

Introduce CLR_CMAKE_TARGET_APPLE_MOBILE as an umbrella variable in
configureplatform.cmake, set when any of iOS, tvOS, or MacCatalyst is
the target. Replace ~30 'all three grouped' patterns across 11 cmake
files with the umbrella, reducing line noise and preventing future
divergence.

Per-platform variables are preserved where they genuinely differ:
- configurecompiler.cmake: TARGET_* C++ defines and compiler targets
- System.Security.Cryptography.Native.Apple: Swift platform names
- System.Net.Security.Native / corehost: tvOS gssapi exclusion
- System.Native: MacCatalyst pal_iossupportversion.m

Also fixes: sendfile exclusion was missing MacCatalyst (now covered
by APPLE_MOBILE), and the triplicated configure.cmake feature overrides
for iOS/MacCatalyst/tvOS are consolidated into one block.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Introduces a new CMake umbrella variable, CLR_CMAKE_TARGET_APPLE_MOBILE, to represent iOS/tvOS/MacCatalyst collectively, reducing duplicated platform conditionals and helping avoid unintended per-platform divergence in build feature logic.

Changes:

  • Define CLR_CMAKE_TARGET_APPLE_MOBILE in eng/native/configureplatform.cmake when targeting iOS, tvOS, or MacCatalyst.
  • Replace repeated (MACCATALYST OR IOS OR TVOS) / negated variants across CoreCLR and native libraries CMake files with the new umbrella variable.
  • Consolidate several Apple-mobile-specific configure-time feature overrides (e.g., sendfile probing and TRY_RUN-derived feature defaults) under the umbrella check.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
eng/native/configureplatform.cmake Defines CLR_CMAKE_TARGET_APPLE_MOBILE and uses it for zlib/tooling platform gating.
src/native/libs/configure.cmake Uses the umbrella to gate sendfile probes and Apple-mobile TRY_RUN overrides / header availability flags.
src/native/libs/CMakeLists.txt Uses umbrella for Apple-mobile install-name handling and to exclude System.IO.Ports.Native on Apple-mobile targets.
src/coreclr/CMakeLists.txt Uses umbrella to skip single-file host build on Apple-mobile targets.
src/coreclr/clrfeatures.cmake Uses umbrella to drive FEATURE_STATICALLY_LINKED for Apple-mobile targets.
src/native/libs/System.Native/CMakeLists.txt Replaces Apple-mobile platform triplets in console-signals and entrypoint-verification gating.
src/native/libs/System.Globalization.Native/CMakeLists.txt Replaces Apple-mobile platform triplets for hybrid globalization + ICU/static-ICU behavior.
src/native/libs/System.IO.Compression.Native/CMakeLists.txt Replaces Apple-mobile platform triplets for export generation / entrypoints inclusion gating.
src/native/libs/System.IO.Compression.Native/extra_libs.cmake Uses umbrella for Apple-mobile zlib link behavior selection.
src/native/libs/System.Net.Security.Native/CMakeLists.txt Replaces Apple-mobile platform triplets in entrypoints inclusion and verification gating.
src/native/libs/System.Security.Cryptography.Native.Apple/CMakeLists.txt Uses umbrella to select iOS-family keychain/x509 source set and entrypoint-verification gating.

Copy link
Copy Markdown
Member

@jkoritzinsky jkoritzinsky left a comment

Choose a reason for hiding this comment

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

LGTM once @akoeplinger's feedback is resolved.

MacCatalyst runs on macOS where sendfile() works and serial ports
are available. Only iOS and tvOS need these exclusions (sendfile
causes SIGSYS on physical devices, and IO.Ports has no hardware).

Addresses PR feedback from akoeplinger.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants