Skip to content

Move the iOS picker into a platform folder - #156

Open
martinmitrevski wants to merge 1 commit into
mainfrom
fix/ios-picker-platform-folder
Open

Move the iOS picker into a platform folder#156
martinmitrevski wants to merge 1 commit into
mainfrom
fix/ios-picker-platform-folder

Conversation

@martinmitrevski

Copy link
Copy Markdown
Contributor

Follow-up to #154, which I got wrong.

IOSAttachmentPicker.mm was named for the platform but sat in the module root. That does not exclude it from anything: UBT excludes source by directory name, and FindInputFilesFromDirectory collects .mm on every platform, after which UEBuildModuleCPP hands InputFiles.MMFiles to whatever toolchain is active. On a Windows build that means handing a .mm to MSVC.

The #if PLATFORM_IOS guard inside the file does not save it, because the problem is the toolchain being asked to compile the file at all, not what the file contains.

Putting it under IOS/ is what the exclusion actually keys on (GetExcludedFolderNames() = platform folder names minus the ones included for the current target). Every .mm shipped in the engine already lives in a folder named for its platform, and none sit outside one.

The module is flat, so a quoted include resolved against the including file's own directory. That stops working a directory down, hence the module root added to PrivateIncludePaths.

Verified

  • Mac: builds and links without compiling the file at all. The #if !PLATFORM_IOS no-op in SampleAttachmentPicker.cpp supplies both symbols, which is exactly the arrangement Windows and Linux rely on.
  • iOS: still compiles IOSAttachmentPicker.mm, now from IOS/.
  • Strict build (-NoPCH -NoSharedPCH -DisableUnity), 47/47 tests.

I could not build this on Windows, and neither could CI: every 🔌 Build and 🤡 Build samples job on #154 sat queued and never ran, so the Win64 check that would have caught this never reported. Worth confirming the self-hosted runners before relying on those checks.

🤖 Generated with Claude Code

UBT excludes source by directory name, not by filename. IOSAttachmentPicker.mm
was named for the platform but sat in the module root, so nothing kept it out of
a Windows or Linux build: FindInputFilesFromDirectory collects .mm on every
platform, and UEBuildModuleCPP then hands InputFiles.MMFiles straight to
whichever toolchain is active, MSVC included.

Putting it under IOS/ is what the exclusion actually keys on. Every .mm in the
engine already lives in a folder named for its platform, and none sit outside
one.

The module is flat, so a quoted include used to resolve against the including
file's own directory. That stops working a directory down, hence the module
root on PrivateIncludePaths.

Verified: Mac builds without compiling the file at all, and links, because the
!PLATFORM_IOS no-op in SampleAttachmentPicker.cpp supplies the two symbols. iOS
still compiles it. 47/47 tests.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant