-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add iOS, tvOS, and watchOS support #528
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e2817ed
Add iOS, tvOS, and watchOS support
ssrobins b1e7f42
Fix spelling error
ssrobins d045658
Shorten if statement and omit macOS
ssrobins c36a135
Put Darwin back, otherwise, os.version isn't set for macOS
ssrobins 302b252
Refactor OS_SDK setting
ssrobins 3f50f15
Add warning about multiple architectures in CMAKE_OSX_ARCHITECTURES
ssrobins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
based on this comment and the logic, I'm not sure this is worth leaving here. If
CMAKE_OSX_ARCHITECTURES
is defined, then we cannot map to a single architecture. If I'm reading the conditional properly, with the proposed changes in this PR the conan architecture would be whichever matchesCMAKE_SYSTEM_PROCESSOR
orCMAKE_OSX_ARCHITECTURES
when going in order (arm64, armv7-a, armv7, armv7s, x86_64) - not sure this makes for a predictable experience especially considering that unless the caller has made provisions to ensure that the binaries are fat binaries, there will be linker errors.I would suggest falling back to issuing a warning when
CMAKE_OSX_ARCHITECTURES
is defined, and stick to following whatCMAKE_SYSTEM_PROCESSOR
says. In the future we can evaluate how to best handle this case but I have concerns this is fragile at the moment.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately,
CMAKE_SYSTEM_PROCESSOR
is blank for iOS/tvOS/watchOS builds and set to the build machine architecture for macOS builds. I don't see a way around usingCMAKE_OSX_ARCHITECTURES
for this.I can add a warning if
CMAKE_OSX_ARCHITECTURES
contains more than one architecture, though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ssrobins!! Where would
CMAKE_OSX_ARCHITECTURES
be initialized? Does CMake give it default values if it is blank?As for
CMAKE_SYSTEM_PROCESSOR
, this is typically set in the same toolchain file that also setsCMAKE_SYSTEM_NAME
toiOS
- in fact when cross-building this is one of the recommended variables to set in a toolchain, so I'm wondering what the most conventional way is to configure an iOS/tvOS/watchOS build with CMake? I think when Xcode is the generator possibly Cmake can configure the build without an architecture as one can be selected at build time instead with Xcode?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CMAKE_OSX_ARCHITECTURES
would be set by the user, as shown in the documentation, which I would consider the conventional way to build iOS/tvOS/watchOS with CMake since it was added in 3.14. Before then, we had to rely on community-supported toolchains, which did setCMAKE_SYSTEM_PROCESSOR
.CMAKE_OSX_ARCHITECTURES
is blank by default, but the generated build defaults to the build machine's architecture so in that caseCMAKE_SYSTEM_PROCESSOR
is helpful.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a warning if
CMAKE_OSX_ARCHITECTURES
contains more than one architecture.