Skip to content

Commit

Permalink
Initial addition of tvOS Mono (#34475)
Browse files Browse the repository at this point in the history
  • Loading branch information
directhex committed Apr 8, 2020
1 parent d0dc66b commit 952eeca
Show file tree
Hide file tree
Showing 72 changed files with 504 additions and 128 deletions.
6 changes: 3 additions & 3 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

<PropertyGroup>
<DefaultSubsetCategories>libraries-installer-coreclr-mono</DefaultSubsetCategories>
<DefaultSubsetCategories Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'Android'">libraries-installer-mono</DefaultSubsetCategories>
<DefaultSubsetCategories Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'Android' or '$(TargetOS)' == 'tvOS'">libraries-installer-mono</DefaultSubsetCategories>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -62,7 +62,7 @@
<DefaultLibrariesSubsets Condition="'$(IncludeLibrariesTestSubset)' == 'true'">$(DefaultLibrariesSubsets)-libtests</DefaultLibrariesSubsets>

<DefaultInstallerSubsets>corehost-managed-depproj-pkgproj-bundle-installers-test</DefaultInstallerSubsets>
<DefaultInstallerSubsets Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'Android'">depproj-pkgproj</DefaultInstallerSubsets>
<DefaultInstallerSubsets Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'Android' or '$(TargetOS)' == 'tvOS'">depproj-pkgproj</DefaultInstallerSubsets>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -79,7 +79,7 @@
</PropertyGroup>

<PropertyGroup>
<RuntimeFlavor Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'Android'">Mono</RuntimeFlavor>
<RuntimeFlavor Condition="'$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'Android'">Mono</RuntimeFlavor>
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == '' and $(_subsetCategory.Contains('mono')) and !$(_subsetCategory.Contains('coreclr'))">Mono</RuntimeFlavor>
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == ''">CoreCLR</RuntimeFlavor>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ usage()
echo "Common settings:"
echo " --subset Build a subset, print available subsets with -subset help"
echo " --subsetCategory Build a subsetCategory, print available subsetCategories with -subset help"
echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, iOS or Android"
echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS or Android"
echo " --arch Build platform: x86, x64, arm, armel or arm64"
echo " --configuration Build configuration: Debug, Release or [CoreCLR]Checked (short: -c)"
echo " --runtimeConfiguration Runtime build configuration: Debug, Release or [CoreCLR]Checked"
Expand Down
2 changes: 1 addition & 1 deletion eng/codeOptimization.targets
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
IBCMerge optimizations on Mac for now to unblock the offical build.
See issue https://github.com/dotnet/runtime/issues/33303
-->
<IsEligibleForNgenOptimization Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'Android'">false</IsEligibleForNgenOptimization>
<IsEligibleForNgenOptimization Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'Android'">false</IsEligibleForNgenOptimization>
</PropertyGroup>

<Target Name="SetApplyNgenOptimization"
Expand Down
12 changes: 11 additions & 1 deletion eng/install-native-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ elif [ "$1" = "OSX" ]; then
if [ "$?" != "0" ]; then
exit 1;
fi
elif [ "$1" = "tvOS" ]; then
brew update
brew upgrade
if [ "$?" != "0" ]; then
exit 1;
fi
brew install openssl autoconf automake libtool pkg-config python3
if [ "$?" != "0" ]; then
exit 1;
fi
elif [ "$1" = "iOS" ]; then
brew update
brew upgrade
Expand All @@ -34,7 +44,7 @@ elif [ "$1" = "iOS" ]; then
exit 1;
fi
else
echo "Must pass \"Linux\", \"iOS\" or \"OSX\" as first argument."
echo "Must pass \"Linux\", \"tvOS\", \"iOS\" or \"OSX\" as first argument."
exit 1
fi

4 changes: 2 additions & 2 deletions eng/liveBuilds.targets
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@
<IsNative>true</IsNative>
</RuntimeFiles>

<MonoCrossFiles Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'Android'"
<MonoCrossFiles Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'Android' or '$(TargetOS)' == 'tvOS'"
Include="$(MonoArtifactsPath)\cross\*.*" />
<MonoIncludeFiles Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'Android'"
<MonoIncludeFiles Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'Android' or '$(TargetOS)' == 'tvOS'"
Include="$(MonoArtifactsPath)\include\**\*.*" />
</ItemGroup>

Expand Down
17 changes: 17 additions & 0 deletions eng/native/configureplatform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@ if(CLR_CMAKE_HOST_OS STREQUAL iOS)
endif()
endif(CLR_CMAKE_HOST_OS STREQUAL iOS)

if(CLR_CMAKE_HOST_OS STREQUAL tvOS)
set(CLR_CMAKE_HOST_UNIX 1)
set(CLR_CMAKE_HOST_TVOS 1)
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
elseif(CMAKE_OSX_ARCHITECTURES MATCHES "arm64")
set(CLR_CMAKE_HOST_UNIX_ARM64 1)
else()
clr_unknown_arch()
endif()
endif(CLR_CMAKE_HOST_OS STREQUAL tvOS)

if(CLR_CMAKE_HOST_OS STREQUAL Android)
set(CLR_CMAKE_HOST_UNIX 1)
set(CLR_CMAKE_HOST_LINUX 1)
Expand Down Expand Up @@ -269,6 +281,11 @@ if(CLR_CMAKE_TARGET_OS STREQUAL iOS)
set(CLR_CMAKE_TARGET_IOS 1)
endif(CLR_CMAKE_TARGET_OS STREQUAL iOS)

if(CLR_CMAKE_TARGET_OS STREQUAL tvOS)
set(CLR_CMAKE_TARGET_UNIX 1)
set(CLR_CMAKE_TARGET_TVOS 1)
endif(CLR_CMAKE_TARGET_OS STREQUAL tvOS)

if(CLR_CMAKE_TARGET_OS STREQUAL FreeBSD)
set(CLR_CMAKE_TARGET_UNIX 1)
set(CLR_CMAKE_TARGET_FREEBSD 1)
Expand Down
2 changes: 1 addition & 1 deletion eng/native/configuretools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if(NOT WIN32)
locate_toolchain_exec(ranlib CMAKE_RANLIB)
endif()

if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_IOS AND (NOT CLR_CMAKE_TARGET_ANDROID OR CROSS_ROOTFS))
if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND (NOT CLR_CMAKE_TARGET_ANDROID OR CROSS_ROOTFS))
locate_toolchain_exec(objdump CMAKE_OBJDUMP)

if(CLR_CMAKE_TARGET_ANDROID)
Expand Down
6 changes: 3 additions & 3 deletions eng/native/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ function(strip_symbols targetName outputFilename)
if (CLR_CMAKE_HOST_UNIX)
set(strip_source_file $<TARGET_FILE:${targetName}>)

if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS)
if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
set(strip_destination_file ${strip_source_file}.dwarf)

# Ensure that dsymutil and strip are present
Expand All @@ -276,7 +276,7 @@ function(strip_symbols targetName outputFilename)
COMMAND ${STRIP} -S ${strip_source_file}
COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file}
)
else (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS)
else (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
set(strip_destination_file ${strip_source_file}.dbg)

add_custom_command(
Expand All @@ -288,7 +288,7 @@ function(strip_symbols targetName outputFilename)
COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${strip_destination_file} ${strip_source_file}
COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file}
)
endif (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS)
endif (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)

set(${outputFilename} ${strip_destination_file} PARENT_SCOPE)
else(CLR_CMAKE_HOST_UNIX)
Expand Down
2 changes: 2 additions & 0 deletions eng/native/init-distro-rid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ initDistroRidGlobal()
distroRid="linux-$buildArch"
elif [ "$targetOs" = "OSX" ]; then
distroRid="osx-$buildArch"
elif [ "$targetOs" = "tvOS" ]; then
distroRid="tvos-$buildArch"
elif [ "$targetOs" = "iOS" ]; then
distroRid="ios-$buildArch"
elif [ "$targetOs" = "Android" ]; then
Expand Down
40 changes: 40 additions & 0 deletions eng/pipelines/common/platform-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,46 @@ jobs:
helixQueueGroup: ${{ parameters.helixQueueGroup }}
${{ insert }}: ${{ parameters.jobParameters }}

# tvOS x64

- ${{ if containsValue(parameters.platforms, 'tvOS_x64') }}:
- template: xplat-setup.yml
parameters:
jobTemplate: ${{ parameters.jobTemplate }}
helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
osGroup: tvOS
archType: x64
platform: tvOS_x64
jobParameters:
runtimeFlavor: mono
stagedBuild: ${{ parameters.stagedBuild }}
buildConfig: ${{ parameters.buildConfig }}
${{ if eq(parameters.passPlatforms, true) }}:
platforms: ${{ parameters.platforms }}
helixQueueGroup: ${{ parameters.helixQueueGroup }}
managedTestBuildOsGroup: OSX
${{ insert }}: ${{ parameters.jobParameters }}

# tvOS arm64

- ${{ if containsValue(parameters.platforms, 'tvOS_arm64') }}:
- template: xplat-setup.yml
parameters:
jobTemplate: ${{ parameters.jobTemplate }}
helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
osGroup: tvOS
archType: arm64
platform: tvOS_arm64
jobParameters:
runtimeFlavor: mono
stagedBuild: ${{ parameters.stagedBuild }}
buildConfig: ${{ parameters.buildConfig }}
${{ if eq(parameters.passPlatforms, true) }}:
platforms: ${{ parameters.platforms }}
helixQueueGroup: ${{ parameters.helixQueueGroup }}
managedTestBuildOsGroup: OSX
${{ insert }}: ${{ parameters.jobParameters }}

# iOS x64

- ${{ if containsValue(parameters.platforms, 'iOS_x64') }}:
Expand Down
4 changes: 4 additions & 0 deletions eng/pipelines/common/xplat-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ jobs:
${{ if eq(parameters.osGroup, 'iOS') }}:
vmImage: 'macOS-10.14'

# Public OSX Build Pool
${{ if eq(parameters.osGroup, 'tvOS') }}:
vmImage: 'macOS-10.14'

# Official Build Windows Pool
${{ if and(eq(parameters.osGroup, 'Windows_NT'), ne(variables['System.TeamProject'], 'public')) }}:
name: NetCoreInternal-Pool
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/installer/jobs/base-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
$(CommonMSBuildArgs)
$(OfficialBuildArg)
- ${{ if in(parameters.osGroup, 'iOS', 'Android') }}:
- ${{ if in(parameters.osGroup, 'iOS', 'tvOS', 'Android') }}:

- name: CommonMSBuildArgs
value: >-
Expand Down
4 changes: 4 additions & 0 deletions eng/pipelines/libraries/base-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ jobs:
- ${{ if eq(parameters.osGroup, 'WebAssembly') }}:
- _runtimeOSArg: -os ${{ parameters.osGroup }}

# force a value for OS when cross-building tvOS on OSX
- ${{ if eq(parameters.osGroup, 'tvOS') }}:
- _runtimeOSArg: -os ${{ parameters.osGroup }}

# force a value for OS when cross-building iOS on OSX
- ${{ if eq(parameters.osGroup, 'iOS') }}:
- _runtimeOSArg: -os ${{ parameters.osGroup }}
Expand Down
5 changes: 4 additions & 1 deletion eng/pipelines/mono/templates/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ jobs:
value: /p:OutputRid=linux-musl-${{ parameters.archType }}
- name: _PortableBuild
value: true
- ${{ if eq(parameters.osGroup, 'tvOS') }}:
- name: osOverride
value: -os tvOS
- ${{ if eq(parameters.osGroup, 'iOS') }}:
- name: osOverride
value: -os iOS
Expand All @@ -79,7 +82,7 @@ jobs:
# Linux builds use docker images with dependencies preinstalled,
# and FreeBSD builds use a build agent with dependencies
# preinstalled, so we only need this step for OSX and Windows.
- ${{ if in(parameters.osGroup, 'OSX', 'iOS') }}:
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
- script: sh $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
displayName: Install native dependencies
- ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
Expand Down
7 changes: 7 additions & 0 deletions eng/pipelines/runtime-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ stages:
- Android_x86
- Android_arm
- Android_arm64
- tvOS_x64
- tvOS_arm64
- iOS_x64
# - iOS_arm # https://github.com/dotnet/runtime/issues/34465
- iOS_arm64
Expand Down Expand Up @@ -145,6 +147,8 @@ stages:
- Android_x86
- Android_arm
- Android_arm64
- tvOS_x64
- tvOS_arm64
- iOS_x64
# - iOS_arm # https://github.com/dotnet/runtime/issues/34465
- iOS_arm64
Expand Down Expand Up @@ -203,6 +207,9 @@ stages:
buildFullPlatformManifest: false
runtimeFlavor: mono
platforms:
- tvOS_x64
- tvOS_arm64
- iOS_arm
# - iOS_arm # https://github.com/dotnet/runtime/issues/34465
- iOS_arm64
- iOS_x64
Expand Down
10 changes: 10 additions & 0 deletions eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ jobs:
- Android_x86
- Android_arm
- Android_arm64
- tvOS_x64
- tvOS_arm64
- iOS_x64
- iOS_arm
- iOS_arm64
Expand Down Expand Up @@ -290,6 +292,8 @@ jobs:
- Android_x86
- Android_arm
- Android_arm64
- tvOS_x64
- tvOS_arm64
- iOS_x64
- iOS_arm
- iOS_arm64
Expand Down Expand Up @@ -411,6 +415,8 @@ jobs:
- Android_x86
- Android_arm
- Android_arm64
- tvOS_x64
- tvOS_arm64
# - iOS_arm # https://github.com/dotnet/runtime/issues/34465
- iOS_arm64
- iOS_x64
Expand All @@ -427,6 +433,8 @@ jobs:
- Android_x86
- Android_arm
- Android_arm64
- tvOS_x64
- tvOS_arm64
# - iOS_arm # https://github.com/dotnet/runtime/issues/34465
- iOS_arm64
- iOS_x64
Expand Down Expand Up @@ -523,6 +531,8 @@ jobs:
buildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
runtimeFlavor: mono
platforms:
- tvOS_x64
- tvOS_arm64
- iOS_x64
# - iOS_arm # https://github.com/dotnet/runtime/issues/34465
- iOS_arm64
Expand Down
12 changes: 10 additions & 2 deletions src/installer/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
<OutputRid Condition="'$(TargetOS)' == 'Linux'">linux-$(TargetArchitecture)</OutputRid>
<OutputRid Condition="'$(TargetOS)' == 'FreeBSD'">freebsd-$(TargetArchitecture)</OutputRid>
<OutputRid Condition="'$(TargetOS)' == 'iOS'">ios-$(TargetArchitecture)</OutputRid>
<OutputRid Condition="'$(TargetOS)' == 'tvOS'">tvos-$(TargetArchitecture)</OutputRid>
<OutputRid Condition="'$(TargetOS)' == 'Android'">android-$(TargetArchitecture)</OutputRid>
</PropertyGroup>

Expand Down Expand Up @@ -166,6 +167,7 @@
<TargetsWindows>false</TargetsWindows>
<TargetsOSX>false</TargetsOSX>
<TargetsiOS>false</TargetsiOS>
<TargetstvOS>false</TargetstvOS>
<TargetsAndroid>false</TargetsAndroid>
<TargetsLinux>false</TargetsLinux>
<TargetsUnix>false</TargetsUnix>
Expand Down Expand Up @@ -197,6 +199,12 @@
<TargetsUnix>true</TargetsUnix>
</PropertyGroup>
</When>
<When Condition="$(OutputRid.StartsWith('tvos'))">
<PropertyGroup>
<TargetstvOS>true</TargetstvOS>
<TargetsUnix>true</TargetsUnix>
</PropertyGroup>
</When>
<When Condition="$(OutputRid.StartsWith('android'))">
<PropertyGroup>
<TargetsAndroid>true</TargetsAndroid>
Expand Down Expand Up @@ -337,7 +345,7 @@
<LibPrefix Condition="'$(TargetOS)' != 'Windows_NT'">lib</LibPrefix>
<LibSuffix>.so</LibSuffix>
<LibSuffix Condition="'$(TargetOS)' == 'Windows_NT'">.dll</LibSuffix>
<LibSuffix Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'iOS'">.dylib</LibSuffix>
<LibSuffix Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS'">.dylib</LibSuffix>
<StaticLibPrefix>lib</StaticLibPrefix>
<StaticLibSuffix>.a</StaticLibSuffix>
<StaticLibSuffix Condition="'$(TargetOS)' == 'Windows_NT'">.lib</StaticLibSuffix>
Expand All @@ -347,7 +355,7 @@
<CrossGenSymbolExtension>.map</CrossGenSymbolExtension>
<CrossGenSymbolExtension Condition="'$(TargetOS)' == 'Windows_NT'">.ni.pdb</CrossGenSymbolExtension>
<!-- OSX doesn't have crossgen symbols, yet -->
<CrossGenSymbolExtension Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'Android'"></CrossGenSymbolExtension>
<CrossGenSymbolExtension Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'Android'"></CrossGenSymbolExtension>
</PropertyGroup>

</Project>
4 changes: 2 additions & 2 deletions src/installer/pkg/packaging/osx/package.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<UsingTask TaskName="ReplaceFileContents" AssemblyFile="$(InstallerTasksAssemblyPath)"/>

<Target Name="InitPkg"
Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'iOS'">
Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS'">
<MakeDir Condition="!Exists('$(PackagesIntermediateDir)')"
Directories="$(PackagesIntermediateDir)" />
</Target>

<Target Name="GeneratePkgs"
Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'iOS'"
Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS'"
DependsOnTargets="GetInstallerBrandingNames;InitPkg">
<ItemGroup>
<OSXPackages Include="sharedframework">
Expand Down
Loading

0 comments on commit 952eeca

Please sign in to comment.