-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 build configurations #33292
Add iOS build configurations #33292
Conversation
if(CLR_CMAKE_TARGET_OS STREQUAL iOS) | ||
set(CLR_CMAKE_TARGET_UNIX 1) | ||
set(CLR_CMAKE_TARGET_IOS 1) | ||
endif(CLR_CMAKE_TARGET_OS STREQUAL iOS) |
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.
I'd expect iOS to set CLR_CMAKE_TARGET_DARWIN
too. Not sure whether it would make the rest of the diff with if
conditions smaller or larger 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.
Yes please, at least on cmake side, we are consistent with Darwin
naming. It's only the code and RIDs where the (obsolete) osx
name is used. 😁
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.
This was a conscious decision because CLR_CMAKE_TARGET_DARWIN
really means macOS in the rest of the build scripts. We could rename it to CLR_CMAKE_TARGET_OSX
?
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.
I'll do the renaming in a follow-up PR.
src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt
Outdated
Show resolved
Hide resolved
# Manually set results from check_c_source_runs() since it's not possible to actually run it during CMake configure checking | ||
unset(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP) | ||
unset(HAVE_CLOCK_MONOTONIC) # only exists on iOS 10+ | ||
unset(HAVE_CLOCK_REALTIME) # only exists on iOS 10+ |
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.
What's the minimum target iOS? 9 stopped getting patches 3 years ago (modulo one patch for GPS rollover last year). Even 10 looks to be out of support other than the GPS fix.
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.
The minimum target that Xamarin supports today is iOS 7 for devices and iOS 8 for the simulator so I replicated that here. We're discussing with PM but it looks like we won't be able to meaningfully bump the minimum version, definitely not to 10.
...aries/System.Security.Cryptography.Encoding/src/System.Security.Cryptography.Encoding.csproj
Show resolved
Hide resolved
# Conflicts: # src/libraries/pkg/Directory.Build.props # src/mono/netcore/nuget/Directory.Build.props
It is only used for interacting with OpenSSL which isn't useful on iOS.
@ViktorHofer any objections? |
I hadn't yet that time to review the PR. Please wait until #33242 is in (should be in ~1 hour) on which I was working the last few days to avoid conflicts. I will now review the PR. |
# Conflicts: # eng/native/configuretools.cmake # src/installer/corehost/CMakeLists.txt # src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj
Sure. I'll need to push another merge anyway due to conflicts so I can wait for that PR to land. |
a lot's going on today. I just requested review from dotnet/runtime-infrastructure as well. I peeked into the changes and the |
@ViktorHofer let me know if what I proposed in #33292 (comment) makes more sense, thanks. |
I'm branching off this to try and get the AzDO YAML going. Will rebase as and when. |
eng/native/configuretools.cmake
Outdated
if(NOT CLR_CMAKE_CONFIGURE_PLATFORM_INCLUDED) | ||
message(FATAL_ERROR "configuretools.cmake needs to be included after configureplatforms.cmake") | ||
endif() |
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.
Could we instead:
if(NOT CLR_CMAKE_CONFIGURE_PLATFORM_INCLUDED) | |
message(FATAL_ERROR "configuretools.cmake needs to be included after configureplatforms.cmake") | |
endif() | |
include(${CMAKE_CURRENT_LIST_DIR}/configureplatform.cmake) |
and remove three occurrences of include(${CLR_ENG_NATIVE_DIR}/configureplatform.cmake)
under :/src/
? This way we would only use configuretools.cmake
as an entrypoint cmake for eng/native (and rest of the files will become internal detail, which however may get refactored in the future).
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.
or perhaps for all call sites, we can add an explicit :/eng/native/entrypoint.cmake
enlisting:
include(${CMAKE_CURRENT_LIST_DIR}/functions.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/configureplatform.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/configuretools.cmake)
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.
Yes I think this makes sense. I'd prefer if we do it in a separate PR 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.
I have addressed it as part of Android fixes #32800.
# Conflicts: # src/libraries/Directory.Build.props
@dotnet/runtime-infrastructure Can one or more of you give this a review? I'd like to have this merged today if possible. |
eng/Subsets.props
Outdated
@@ -66,6 +66,7 @@ | |||
|
|||
<_subsetCategory Condition="'$(SubsetCategory)' != ''">$(SubsetCategory.ToLowerInvariant())</_subsetCategory> | |||
<_subsetCategory Condition="'$(SubsetCategory)' == ''">$(DefaultSubsetCategories)</_subsetCategory> | |||
<_subsetCategory Condition="'$(SubsetCategory)' == '' and '$(TargetOS)' == 'iOS'">libraries-mono</_subsetCategory> |
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.
Should we error if SubsetCategory
is not empty and contains either installer or coreclr when TargetOS
is iOS
?
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.
I feel like if you manually override subset category that way you deserve to get the failures :)
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.
I get that, but it is good to help developers get readable failures? Sometimes because of the lack of those validations we get a lot of questions, why this doesn't work, why am I getting this error, etc? We already have a target that does validation for the subset categories, if I remember correctly.
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.
I think it's ok to set RuntimeFlavor based on the passed in SubsetCategory
but I don't think that SubsetCategory
should be inferred from TargetOS
. The SubsetCategory
can also contain values like mono
, or mono-coreclr-libraries-installer
therefore I think it's necessary to be intentional here and require the category to be passed in.
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.
@ViktorHofer why not? coreclr
or installer
are not valid subset categories when you have TargetOS=iOS so having a default when nothing is set explicitly makes a lot of sense.
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.
I thought about this more. I'm fine with providing a default value for the subset categories when a configuration is passed in that isn't supported on one of those categories but I would not want to exclude installer which brings me back to my question: Why did you choose mono-libraries
and not mono-libraries-installer
?
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.
@ViktorHofer installer doesn't make sense at all, there won't be an installer for the iOS bits (nuget only). The default of mono-libraries
is everything that we want to build by default.
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.
I can move the change to set DefaultSubsetCategories
for TargetOS==iOS
instead if that helps making it clearer.
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.
I discussed this with Viktor offline and there was some misunderstanding. installer
is not just for building the .deb/.msi/.pkg installers but also does other things like creating runtime packs and ref packs. So we might eventually need it for iOS too.
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.
Regarding the subset validation: Viktor and me took a look and it seems a little more complicated to add than expected. We'll do it in a separate PR.
src/libraries/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj
Show resolved
Hide resolved
src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj
Show resolved
Hide resolved
<watchOS64_32VersionMin>5.1</watchOS64_32VersionMin> | ||
<macOSVersionMin>10.13</macOSVersionMin> | ||
|
||
<!-- Version of the OS SDK we target --> |
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.
Just curious, why are these set to empty?
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.
Some Apple tools embed certain pieces of metadata differently depending on whether you build against /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
or /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk
(the former is a symlink to the latter).
On CI we want to build with the explicit version so we pass in the versions installed on the bots. Locally we don't really care about that and hardcoding the version in the file would just mean you need to change it whenever Xcode is updated, so we rely on the symlink there.
I know MSBuild doesn't require you to declare properties if they're empty but I felt it serves as a good documentation that they're used/available.
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.
Makes sense. Thanks for explaining.
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.
Other than a few comments/questions, the infra changes LGTM.
dotnet-runtime-perf failures are due to #33082. |
@@ -0,0 +1,272 @@ | |||
/* | |||
* Copyright (c) 2000-2008 Apple Inc. All rights reserved. |
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.
Does this need to be mentioned in https://github.com/dotnet/runtime/blob/master/THIRD-PARTY-NOTICES.TXT ?
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.
Yes, we discussed with @richlander and we'll take care of that.
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.
discussed various additions to this PR offline with @akoeplinger, like the necessity of the installer subset at a later point for the runtime pack to build. The subset validation as well should be enabled later. LGTM. Thanks!
This adds support for iOS using the Mono runtime to the build system.
I'm only adding the build integration right now, CI support will be done separately.