Provide definitions for macros in rootless.h when !TARGET_OS_IPHONE #97
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this implement/fix? Explain your changes.
Theos only links libroot when targeting
iphone
:https://github.com/theos/theos/blob/351fbe83ee6058bdb64e90884c3bb047c31ab6c1/makefiles/instance/rules.mk#L139-L142
This is currently required because libroot is currently only compiled for iOS.
This PR seeks to match this linking behavior on the headers side:
Only include libroot if the target is iOS.
When libroot is not available, this PR uses the definitions that were previously used in a2a4086
I opted for this approach so that projects that target both iOS and macOS, in particular, can use macros from
rootless.h
without needing to shim these macros or provide separate code for each target.Checklist
@import MyLibrary;
in ObjC, orimport MyLibrary
in Swift.Does this close any currently open issues?
No
Any relevant logs, error output, etc?
Some tests:
main.m
:TARGET="macosx:clang:latest:11.0"
TARGET="iphone:clang:latest:14.0"
Any other comments?
No
Where has this been tested?
Operating System: macOS
Platform: Darwin
Target Platform: iOS, macOS
Toolchain Version:
Apple clang version 15.0.0 (clang-1500.3.9.4)
SDK Version:
MacOSX14.5.sdk
,iPhoneOS17.5.sdk