diff --git a/Directory.Build.props b/Directory.Build.props index 6ca4871c714dc..bda23977ca1de 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -17,7 +17,7 @@ Solaris Linux windows - true + true @@ -117,6 +117,7 @@ <_portableOS Condition="'$(_runtimeOSFamily)' == 'illumos'">illumos <_portableOS Condition="'$(_runtimeOSFamily)' == 'Solaris'">solaris <_portableOS Condition="'$(_runtimeOS)' == 'Browser'">browser + <_portableOS Condition="'$(_runtimeOS)' == 'maccatalyst'">maccatalyst <_portableOS Condition="'$(_runtimeOS)' == 'ios'">ios <_portableOS Condition="'$(_runtimeOS)' == 'tvos'">tvos <_portableOS Condition="'$(_runtimeOS)' == 'android'">android @@ -144,8 +145,8 @@ <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'android' and $([MSBuild]::IsOSPlatform('WINDOWS'))">win-x64 <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'android' and $([MSBuild]::IsOSPlatform('OSX'))">osx-x64 - - <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'ios' or '$(_runtimeOS)' == 'tvos'">osx-x64 + + <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'maccatalyst' or '$(_runtimeOS)' == 'ios' or '$(_runtimeOS)' == 'tvos'">osx-x64 $(_toolRuntimeRID) @@ -160,6 +161,7 @@ <_outputRID Condition="'$(TargetOS)' == 'NetBSD'">netbsd-$(TargetArchitecture) <_outputRID Condition="'$(TargetOS)' == 'illumos'">illumos-$(TargetArchitecture) <_outputRID Condition="'$(TargetOS)' == 'Solaris'">solaris-$(TargetArchitecture) + <_outputRID Condition="'$(TargetOS)' == 'MacCatalyst'">maccatalyst-$(TargetArchitecture) <_outputRID Condition="'$(TargetOS)' == 'iOS'">ios-$(TargetArchitecture) <_outputRID Condition="'$(TargetOS)' == 'tvOS'">tvos-$(TargetArchitecture) <_outputRID Condition="'$(TargetOS)' == 'Android'">android-$(TargetArchitecture) @@ -176,6 +178,7 @@ true true true + true true true true @@ -183,7 +186,7 @@ true true true - true + true diff --git a/eng/build.sh b/eng/build.sh index 10553485e3a1b..4acb1e2c79289 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -28,7 +28,7 @@ usage() echo " --help (-h) Print help and exit." echo " --librariesConfiguration (-lc) Libraries build configuration: Debug or Release." echo " [Default: Debug]" - echo " --os Target operating system: windows, Linux, FreeBSD, OSX, tvOS, iOS, Android," + echo " --os Target operating system: windows, Linux, FreeBSD, OSX, MacCatalyst, tvOS, iOS, Android," echo " Browser, NetBSD, illumos or Solaris." echo " [Default: Your machine's OS.]" echo " --projects Project or solution file(s) to build." @@ -262,6 +262,8 @@ while [[ $# > 0 ]]; do os="FreeBSD" ;; osx) os="OSX" ;; + maccatalyst) + os="MacCatalyst" ;; tvos) os="tvOS" ;; ios) @@ -276,7 +278,7 @@ while [[ $# > 0 ]]; do os="Solaris" ;; *) echo "Unsupported target OS '$2'." - echo "The allowed values are windows, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, illumos and Solaris." + echo "The allowed values are windows, Linux, FreeBSD, OSX, MacCatalyst, tvOS, iOS, Android, Browser, illumos and Solaris." exit 1 ;; esac diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index 775e4a90ac2b7..2c2da6bfb2d65 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -78,7 +78,7 @@ build_native() # All set to commence the build echo "Commencing build of \"$message\" for $__TargetOS.$__BuildArch.$__BuildType in $intermediatesDir" - if [[ "$targetOS" == OSX ]]; then + if [[ "$targetOS" == OSX || "$targetOS" == MacCatalyst ]]; then if [[ "$platformArch" == x64 ]]; then cmakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"x86_64\" $cmakeArgs" elif [[ "$platformArch" == arm64 ]]; then @@ -89,6 +89,10 @@ build_native() fi fi + if [[ "$targetOS" == MacCatalyst ]]; then + cmakeArgs="-DCLR_CMAKE_TARGET_MACCATALYST=1 $cmakeArgs" + fi + if [[ "$__UseNinja" == 1 ]]; then generator="ninja" buildTool="$(command -v ninja || command -v ninja-build)" diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index 87090b8dd4bb3..a5dac887902eb 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -390,19 +390,40 @@ if (CLR_CMAKE_HOST_UNIX) # Specify the minimum supported version of macOS if(CLR_CMAKE_HOST_OSX) - if(CLR_CMAKE_HOST_ARCH_ARM64) - # 'pthread_jit_write_protect_np' is only available on macOS 11.0 or newer - set(MACOS_VERSION_MIN_FLAGS -mmacosx-version-min=11.0) - add_compile_options(-arch arm64) - elseif(CLR_CMAKE_HOST_ARCH_AMD64) - set(MACOS_VERSION_MIN_FLAGS -mmacosx-version-min=10.13) - add_compile_options(-arch x86_64) + # Mac Catalyst needs a special CFLAG, exclusive with mmacosx-version-min + if(CLR_CMAKE_TARGET_MACCATALYST) + # Somewhere between CMake 3.17 and 3.19.4, it became impossible to not pass + # a value for mmacosx-version-min (blank CMAKE_OSX_DEPLOYMENT_TARGET gets + # replaced with a default value, and always gets expanded to an OS version. + # https://gitlab.kitware.com/cmake/cmake/-/issues/20132 + # We need to disable the warning that -tagret replaces -mmacosx-version-min + add_compile_options(-Wno-overriding-t-option) + add_link_options(-Wno-overriding-t-option) + if(CLR_CMAKE_HOST_ARCH_ARM64) + add_compile_options(-target arm64-apple-ios14.2-macabi) + add_link_options(-target arm64-apple-ios14.2-macabi) + elseif(CLR_CMAKE_HOST_ARCH_AMD64) + add_compile_options(-target x86_64-apple-ios13.5-macabi) + add_link_options(-target x86_64-apple-ios13.5-macabi) + else() + clr_unknown_arch() + endif() else() - clr_unknown_arch() - endif() - add_compile_options(${MACOS_VERSION_MIN_FLAGS}) - add_linker_flag(${MACOS_VERSION_MIN_FLAGS}) + if(CLR_CMAKE_HOST_ARCH_ARM64) + # 'pthread_jit_write_protect_np' is only available on macOS 11.0 or newer + set(MACOS_VERSION_MIN_FLAGS -mmacosx-version-min=11.0) + add_compile_options(-arch arm64) + elseif(CLR_CMAKE_HOST_ARCH_AMD64) + set(MACOS_VERSION_MIN_FLAGS -mmacosx-version-min=10.13) + add_compile_options(-arch x86_64) + else() + clr_unknown_arch() + endif() + add_compile_options(${MACOS_VERSION_MIN_FLAGS}) + add_linker_flag(${MACOS_VERSION_MIN_FLAGS}) + endif(CLR_CMAKE_TARGET_MACCATALYST) endif(CLR_CMAKE_HOST_OSX) + endif(CLR_CMAKE_HOST_UNIX) if(CLR_CMAKE_TARGET_UNIX) diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index f8b1a10c0e8ff..9e7e7743c0f9e 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -305,6 +305,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 MacCatalyst) + set(CLR_CMAKE_TARGET_UNIX 1) + set(CLR_CMAKE_TARGET_MACCATALYST 1) +endif(CLR_CMAKE_TARGET_OS STREQUAL MacCatalyst) + if(CLR_CMAKE_TARGET_OS STREQUAL tvOS) set(CLR_CMAKE_TARGET_UNIX 1) set(CLR_CMAKE_TARGET_TVOS 1) diff --git a/eng/native/configuretools.cmake b/eng/native/configuretools.cmake index 70cd43dd71247..501aec5f6c6a9 100644 --- a/eng/native/configuretools.cmake +++ b/eng/native/configuretools.cmake @@ -47,7 +47,7 @@ if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_BROWSER) locate_toolchain_exec(link CMAKE_LINKER) endif() - 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)) + if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_MACCATALYST 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) diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index eec30971ecb5d..9c2cc0c7dee2b 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -211,7 +211,7 @@ function(generate_exports_file) list(GET INPUT_LIST -1 outputFilename) list(REMOVE_AT INPUT_LIST -1) - if(CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) + if(CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) set(SCRIPT_NAME generateexportedsymbols.sh) else() set(SCRIPT_NAME generateversionscript.sh) @@ -252,7 +252,7 @@ function(strip_symbols targetName outputFilename) if (CLR_CMAKE_HOST_UNIX) set(strip_source_file $) - if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) + if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST 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 @@ -281,7 +281,7 @@ function(strip_symbols targetName outputFilename) COMMAND ${strip_command} COMMENT "Stripping symbols from ${strip_source_file} into file ${strip_destination_file}" ) - else (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) + else (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) set(strip_destination_file ${strip_source_file}.dbg) add_custom_command( @@ -293,7 +293,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 OR CLR_CMAKE_TARGET_TVOS) + endif (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) set(${outputFilename} ${strip_destination_file} PARENT_SCOPE) else(CLR_CMAKE_HOST_UNIX) @@ -316,7 +316,7 @@ function(install_with_stripped_symbols targetName kind destination) install_symbols(${symbol_file} ${destination}) endif() - if ((CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) AND ("${kind}" STREQUAL "TARGETS")) + if ((CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) AND ("${kind}" STREQUAL "TARGETS")) # We want to avoid the kind=TARGET install behaviors which corrupt code signatures on osx-arm64 set(kind PROGRAMS) endif() diff --git a/eng/native/init-distro-rid.sh b/eng/native/init-distro-rid.sh index fea888fdf7810..9c0092a22bce2 100644 --- a/eng/native/init-distro-rid.sh +++ b/eng/native/init-distro-rid.sh @@ -170,6 +170,8 @@ initDistroRidGlobal() distroRid="linux-$buildArch" elif [ "$targetOs" = "OSX" ]; then distroRid="osx-$buildArch" + elif [ "$targetOs" = "MacCatalyst" ]; then + distroRid="maccatalyst-$buildArch" elif [ "$targetOs" = "tvOS" ]; then distroRid="tvos-$buildArch" elif [ "$targetOs" = "iOS" ]; then diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 97268ab6107dd..3486e0d08c075 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -323,6 +323,48 @@ jobs: helixQueueGroup: ${{ parameters.helixQueueGroup }} ${{ insert }}: ${{ parameters.jobParameters }} +# Mac Catalyst x64 + +- ${{ if containsValue(parameters.platforms, 'MacCatalyst_x64') }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + variables: ${{ parameters.variables }} + osGroup: MacCatalyst + archType: x64 + targetRid: maccatalyst-x64 + platform: MacCatalyst_x64 + jobParameters: + runtimeFlavor: mono + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + ${{ if eq(parameters.passPlatforms, true) }}: + platforms: ${{ parameters.platforms }} + helixQueueGroup: ${{ parameters.helixQueueGroup }} + ${{ insert }}: ${{ parameters.jobParameters }} + +# Mac Catalyst arm64 + +- ${{ if containsValue(parameters.platforms, 'MacCatalyst_arm64') }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + variables: ${{ parameters.variables }} + osGroup: MacCatalyst + archType: arm64 + targetRid: maccatalyst-arm64 + platform: MacCatalyst_arm64 + jobParameters: + runtimeFlavor: mono + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + ${{ if eq(parameters.passPlatforms, true) }}: + platforms: ${{ parameters.platforms }} + helixQueueGroup: ${{ parameters.helixQueueGroup }} + ${{ insert }}: ${{ parameters.jobParameters }} + # tvOS x64 - ${{ if containsValue(parameters.platforms, 'tvOS_x64') }}: diff --git a/eng/pipelines/common/xplat-setup.yml b/eng/pipelines/common/xplat-setup.yml index c9929621eb17b..a9ed9dbf41715 100644 --- a/eng/pipelines/common/xplat-setup.yml +++ b/eng/pipelines/common/xplat-setup.yml @@ -119,7 +119,7 @@ jobs: queue: BuildPool.Ubuntu.1604.Amd64 # OSX Build Pool (we don't have on-prem OSX BuildPool - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}: + ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'tvOS') }}: vmImage: 'macOS-10.15' # Official Build Windows Pool @@ -135,7 +135,7 @@ jobs: ${{ if eq(parameters.helixQueuesTemplate, '') }}: # macOS hosted pool machines are slower so we need to give a greater timeout than the 60 mins default. - ${{ if and(eq(parameters.jobParameters.timeoutInMinutes, ''), in(parameters.osGroup, 'OSX', 'iOS', 'tvOS')) }}: + ${{ if and(eq(parameters.jobParameters.timeoutInMinutes, ''), in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'tvOS')) }}: timeoutInMinutes: 120 ${{ insert }}: ${{ parameters.jobParameters }} ${{ if ne(parameters.helixQueuesTemplate, '') }}: diff --git a/eng/pipelines/runtime-official.yml b/eng/pipelines/runtime-official.yml index 6a3dfd842094f..258218bf331ec 100644 --- a/eng/pipelines/runtime-official.yml +++ b/eng/pipelines/runtime-official.yml @@ -98,6 +98,8 @@ stages: - Android_x86 - Android_arm - Android_arm64 + - MacCatalyst_x64 + - MacCatalyst_arm64 - tvOS_x64 - tvOS_arm64 - iOS_x64 diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 23ff8d993fe99..a4f3dcd0d286e 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -212,6 +212,8 @@ jobs: runtimeFlavor: mono platforms: - Android_x86 + - MacCatalyst_x64 + - MacCatalyst_arm64 - tvOS_x64 - iOS_arm64 - iOS_x86 @@ -1050,4 +1052,4 @@ jobs: or( eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), - eq(variables['isFullMatrix'], true)) \ No newline at end of file + eq(variables['isFullMatrix'], true)) diff --git a/eng/targetframeworksuffix.props b/eng/targetframeworksuffix.props index e4473df46fa74..8a55da6832975 100644 --- a/eng/targetframeworksuffix.props +++ b/eng/targetframeworksuffix.props @@ -46,6 +46,13 @@ osx + + + true + true + maccatalyst + + true diff --git a/eng/testing/AppleRunnerTemplate.sh b/eng/testing/AppleRunnerTemplate.sh index 663eee16589e3..dda892576df53 100644 --- a/eng/testing/AppleRunnerTemplate.sh +++ b/eng/testing/AppleRunnerTemplate.sh @@ -16,6 +16,8 @@ if [ -n "$5" ]; then EXPECTED_EXIT_CODE="--expected-exit-code $5" fi +if [[ "$TARGET_OS" == "MacCatalyst" ]]; then TARGET=maccatalyst; fi + if [[ "$TARGET_OS" == "iOS" && "$TARGET_ARCH" == "x86" ]]; then TARGET=ios-simulator-32; fi if [[ "$TARGET_OS" == "iOS" && "$TARGET_ARCH" == "x64" ]]; then TARGET=ios-simulator-64; fi if [[ "$TARGET_OS" == "iOS" && "$TARGET_ARCH" == "arm" ]]; then TARGET=ios-device; fi @@ -29,6 +31,7 @@ if [[ "$TARGET" == "ios-simulator-"* ]]; then SCHEME_SDK=Release-iphonesimulator if [[ "$TARGET" == "tvos-simulator" ]]; then SCHEME_SDK=Release-appletvsimulator; fi if [[ "$TARGET" == "ios-device" ]]; then SCHEME_SDK=Release-iphoneos; fi if [[ "$TARGET" == "tvos-device" ]]; then SCHEME_SDK=Release-appletvos; fi +if [[ "$TARGET" == "maccatalyst" ]]; then SCHEME_SDK=Release-maccatalyst; fi cd $EXECUTION_DIR diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets index cf78ea291147c..b4e7fb22dfa96 100644 --- a/eng/testing/tests.mobile.targets +++ b/eng/testing/tests.mobile.targets @@ -77,7 +77,7 @@ - - + + - + + + - @@ -221,7 +225,7 @@ AfterTargets="ComputeResolvedFilesToPublishList"> <_runnerFilesToPublish Include="$(AndroidTestRunnerDir)*" Condition="'$(TargetOS)' == 'Android'" /> - <_runnerFilesToPublish Include="$(AppleTestRunnerDir)*" Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS'" /> + <_runnerFilesToPublish Include="$(AppleTestRunnerDir)*" Condition="'$(TargetOS)' == 'MacCatalyst' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS'" /> <_runnerFilesToPublish Include="$(WasmTestRunnerDir)*" Condition="'$(TargetOS)' == 'Browser'" /> diff --git a/eng/testing/tests.targets b/eng/testing/tests.targets index ceb58345ed982..d5ab901145464 100644 --- a/eng/testing/tests.targets +++ b/eng/testing/tests.targets @@ -2,7 +2,7 @@ RunnerTemplate.cmd RunnerTemplate.sh - AppleRunnerTemplate.sh + AppleRunnerTemplate.sh AndroidRunnerTemplate.sh WasmRunnerTemplate.sh diff --git a/src/installer/tests/Assets/TestUtils/TestProjects.targets b/src/installer/tests/Assets/TestUtils/TestProjects.targets index 3ab4d72988c5a..b6f1b073a9688 100644 --- a/src/installer/tests/Assets/TestUtils/TestProjects.targets +++ b/src/installer/tests/Assets/TestUtils/TestProjects.targets @@ -17,7 +17,7 @@ LatestRuntimeFrameworkVersion="6.0.0-alpha.1.20602.4" RuntimeFrameworkName="Microsoft.NETCore.App" RuntimePackNamePatterns="Microsoft.NETCore.App.Runtime.**RID**" - RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;osx-arm64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;ios-arm64;ios-arm;ios-x64;ios-x86;tvos-arm64;tvos-x64;android-arm64;android-arm;android-x64;android-x86;browser-wasm" + RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;osx-arm64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;maccatalyst-x64;maccatalyst-arm64;ios-arm64;ios-arm;ios-x64;ios-x86;tvos-arm64;tvos-x64;android-arm64;android-arm;android-x64;android-x86;browser-wasm" TargetFramework="net6.0" TargetingPackName="Microsoft.NETCore.App.Ref" TargetingPackVersion="6.0.0-alpha.1.20602.4" /> diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index 53b02129328bf..dfd4ba7b81762 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -28,6 +28,7 @@ public static partial class PlatformDetection public static bool IsNetBSD => RuntimeInformation.IsOSPlatform(OSPlatform.Create("NETBSD")); public static bool IsiOS => RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS")); public static bool IstvOS => RuntimeInformation.IsOSPlatform(OSPlatform.Create("TVOS")); + public static bool IsMacCatalyst => RuntimeInformation.IsOSPlatform(OSPlatform.Create("MACCATALYST")); public static bool Isillumos => RuntimeInformation.IsOSPlatform(OSPlatform.Create("ILLUMOS")); public static bool IsSolaris => RuntimeInformation.IsOSPlatform(OSPlatform.Create("SOLARIS")); public static bool IsBrowser => RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER")); @@ -132,7 +133,7 @@ public static bool IsNonZeroLowerBoundArraySupported (IsOpenSslSupported && (OpenSslVersion.Major >= 1 && (OpenSslVersion.Minor >= 1 || OpenSslVersion.Build >= 2))); - public static bool SupportsClientAlpn => SupportsAlpn || IsOSX || IsiOS || IstvOS; + public static bool SupportsClientAlpn => SupportsAlpn || IsOSX || IsMacCatalyst || IsiOS || IstvOS; private static Lazy s_supportsTls10 = new Lazy(GetTls10Support); private static Lazy s_supportsTls11 = new Lazy(GetTls11Support); @@ -339,7 +340,7 @@ private static bool GetTls13Support() // The build number is approximation. return IsWindows10Version2004Build19573OrGreater; } - else if (IsOSX || IsiOS || IstvOS) + else if (IsOSX || IsMacCatalyst || IsiOS || IstvOS) { // [ActiveIssue("https://github.com/dotnet/runtime/issues/1979")] return false; diff --git a/src/libraries/Native/Unix/CMakeLists.txt b/src/libraries/Native/Unix/CMakeLists.txt index ebc9ff30e9ea8..999a3062fbe5a 100644 --- a/src/libraries/Native/Unix/CMakeLists.txt +++ b/src/libraries/Native/Unix/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.6.2) include(CheckCCompilerFlag) -if(CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) +if(CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) # CMake 3.14.5 contains bug fixes for iOS cmake_minimum_required(VERSION 3.14.5) endif() @@ -13,7 +13,7 @@ include(../../../../eng/native/configurepaths.cmake) include(${CLR_ENG_NATIVE_DIR}/configuretools.cmake) set(CMAKE_MACOSX_RPATH ON) -if(CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) +if(CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) set(CMAKE_INSTALL_NAME_DIR "@rpath") endif() @@ -76,6 +76,20 @@ if(CLR_CMAKE_TARGET_BROWSER) set(STATIC_LIB_DESTINATION .) endif() +if(CLR_CMAKE_TARGET_MACCATALYST) + # -target overrides -mmacosx-version-min so suppress warning about that + # https://gitlab.kitware.com/cmake/cmake/-/issues/20132 + add_compile_options(-Wno-overriding-t-option) + add_link_options(-Wno-overriding-t-option) + if (CLR_CMAKE_TARGET_ARCH_AMD64) + add_compile_options(-target x86_64-apple-ios13.5-macabi) + add_link_options(-target x86_64-apple-ios13.5-macabi) + elseif (CLR_CMAKE_TARGET_ARCH_ARM64) + add_compile_options(-target arm64-apple-ios14.2-macabi) + add_link_options(-target arm64-apple-ios14.2-macabi) + endif() +endif() + if (CLR_CMAKE_TARGET_ARCH_AMD64) add_definitions(-DTARGET_64BIT=1) add_definitions(-DTARGET_AMD64) @@ -168,7 +182,7 @@ else () endif () if(CLR_CMAKE_TARGET_BROWSER) -elseif (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) +elseif (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) add_definitions(-D__APPLE_USE_RFC_3542) # We cannot enable "stack-protector-strong" on OS X due to a bug in clang compiler (current version 7.0.2) @@ -188,7 +202,7 @@ endif () # ./build-native.sh cmakeargs -DCLR_ADDITIONAL_COMPILER_OPTIONS=<...> cmakeargs -DCLR_ADDITIONAL_LINKER_FLAGS=<...> # if(CLR_CMAKE_TARGET_UNIX) - if(NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS) + if(NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS) if(CLR_CMAKE_TARGET_OSX) add_definitions(-DTARGET_OSX) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-bind_at_load") @@ -216,7 +230,7 @@ include(configure.cmake) add_subdirectory(System.IO.Compression.Native) -if (NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID) +if (NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID) add_subdirectory(System.IO.Ports.Native) endif() @@ -228,6 +242,10 @@ add_subdirectory(System.Native) if(CLR_CMAKE_TARGET_BROWSER) # skip for now +elseif(CLR_CMAKE_TARGET_MACCATALYST) + add_subdirectory(System.Net.Security.Native) + # System.Security.Cryptography.Native is intentionally disabled on iOS + # it is only used for interacting with OpenSSL which isn't useful there elseif(CLR_CMAKE_TARGET_IOS) add_subdirectory(System.Net.Security.Native) # System.Security.Cryptography.Native is intentionally disabled on iOS @@ -248,7 +266,7 @@ else() add_subdirectory(System.Security.Cryptography.Native) endif() -if(CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) +if(CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) add_subdirectory(System.Security.Cryptography.Native.Apple) endif() diff --git a/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt index 080ac34fdf623..b3dc00c107cd1 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt @@ -62,7 +62,7 @@ set(NATIVEGLOBALIZATION_SOURCES pal_icushim.c ) -if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) +if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) set(NATIVEGLOBALIZATION_SOURCES ${NATIVEGLOBALIZATION_SOURCES} entrypoints.c) endif() @@ -98,7 +98,7 @@ endif() install (TARGETS System.Globalization.Native-Static DESTINATION ${STATIC_LIB_DESTINATION}) -if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID) +if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID) if (GEN_SHARED_LIB) add_custom_command(TARGET System.Globalization.Native POST_BUILD COMMENT "Verifying System.Globalization.Native.so dependencies" diff --git a/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt index dbdefbc99955c..e45d404b89519 100644 --- a/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt @@ -68,7 +68,7 @@ if (GEN_SHARED_LIB) ${NATIVE_LIBS_EXTRA} ) - if (NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID) + if (NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID) set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/System.IO.Compression.Native_unixexports.src) set(EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/System.IO.Compression.Native.exports) generate_exports_file(${DEF_SOURCES} ${EXPORTS_FILE}) diff --git a/src/libraries/Native/Unix/System.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Native/CMakeLists.txt index 641ac75735de9..48df59ab175ba 100644 --- a/src/libraries/Native/Unix/System.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Native/CMakeLists.txt @@ -1,6 +1,6 @@ project(System.Native C) -if (NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS) +if (NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS) add_definitions(-DHAS_CONSOLE_SIGNALS) endif () @@ -29,7 +29,7 @@ set(NATIVE_SOURCES pal_sysctl.c ) -if (CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) +if (CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) set(NATIVE_SOURCES ${NATIVE_SOURCES} pal_log.m pal_searchpath.m) @@ -60,7 +60,7 @@ if (GEN_SHARED_LIB) ${NATIVE_LIBS_EXTRA} ) - if (NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) + if (NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) add_custom_command(TARGET System.Native POST_BUILD COMMENT "Verifying System.Native entry points against entrypoints.c " COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../verify-entrypoints.sh @@ -74,7 +74,7 @@ if (GEN_SHARED_LIB) install_with_stripped_symbols (System.Native PROGRAMS .) endif () -if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) +if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) set(NATIVE_SOURCES ${NATIVE_SOURCES} entrypoints.c) endif() diff --git a/src/libraries/Native/Unix/System.Native/extra_libs.cmake b/src/libraries/Native/Unix/System.Native/extra_libs.cmake index 7a04e35f46e30..a8cc4a3bea612 100644 --- a/src/libraries/Native/Unix/System.Native/extra_libs.cmake +++ b/src/libraries/Native/Unix/System.Native/extra_libs.cmake @@ -10,7 +10,7 @@ macro(append_extra_system_libs NativeLibsExtra) list(APPEND ${NativeLibsExtra} socket) endif () - if (CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) + if (CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) list(APPEND ${NativeLibsExtra} "-framework Foundation") endif () diff --git a/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt index cf1739205bfa9..3c03fa1696793 100644 --- a/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt @@ -19,7 +19,7 @@ if (GEN_SHARED_LIB) ) endif() -if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) +if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) set(NATIVEGSS_SOURCES ${NATIVEGSS_SOURCES} entrypoints.c) endif() @@ -35,7 +35,7 @@ if (GEN_SHARED_LIB) ${NATIVE_LIBS_EXTRA} ) - if (NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) + if (NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) add_custom_command(TARGET System.Net.Security.Native POST_BUILD COMMENT "Verifying System.Net.Security.Native entry points against entrypoints.c " COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../verify-entrypoints.sh diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt index ae4d764cbbba9..e1e4c47a6d861 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt @@ -23,6 +23,10 @@ set(NATIVECRYPTO_SOURCES pal_x509chain.c ) +if (CLR_CMAKE_TARGET_MACCATALYST) + add_definitions(-DTARGET_MACCATALYST) +endif() + if (CLR_CMAKE_TARGET_IOS) add_definitions(-DTARGET_IOS) endif() @@ -39,7 +43,7 @@ if (GEN_SHARED_LIB) ) endif() -if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) +if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) set(NATIVECRYPTO_SOURCES ${NATIVECRYPTO_SOURCES} entrypoints.c) endif() diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/entrypoints.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/entrypoints.c index 3736fee0c1865..3c00bb540e2ce 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/entrypoints.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/entrypoints.c @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) #include "../../AnyOS/entrypoints.h" @@ -112,4 +112,4 @@ EXTERN_C const void* CryptoAppleResolveDllImport(const char* name) return ResolveDllImport(s_cryptoAppleNative, lengthof(s_cryptoAppleNative), name); } -#endif // !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#endif // !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ecc.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ecc.c index 59b0491a6cd1f..d0189f5e78760 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ecc.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ecc.c @@ -3,7 +3,7 @@ #include "pal_ecc.h" -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) int32_t AppleCryptoNative_EccGenerateKey( int32_t keySizeBits, SecKeychainRef tempKeychain, SecKeyRef* pPublicKey, SecKeyRef* pPrivateKey, int32_t* pOSStatus) { diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ecc.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ecc.h index a3ddd1c182c1e..0e044376d17dd 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ecc.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ecc.h @@ -8,7 +8,7 @@ #include -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) /* Generate an ECC keypair of the specified size. diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.c index 1443290f434a4..866cedf2a012b 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.c @@ -4,7 +4,7 @@ #include "pal_keychain.h" #include "pal_utilities.h" -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) int32_t AppleCryptoNative_SecKeychainItemCopyKeychain(SecKeychainItemRef item, SecKeychainRef* pKeychainOut) { if (pKeychainOut != NULL) diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.h index 3274f0c49c263..59cfaad1e91f5 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.h @@ -8,7 +8,7 @@ #include -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) /* Get a CFRetain()ed SecKeychainRef value for the keychain to which the keychain item belongs. diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.c index c5253e48ae57c..a4240bf5bf935 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.c @@ -3,7 +3,7 @@ #include "pal_rsa.h" -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) static int32_t ExecuteCFDataTransform( SecTransformRef xform, uint8_t* pbData, int32_t cbData, CFDataRef* pDataOut, CFErrorRef* pErrorOut); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.h index ce9976095a1cb..fb44bf21733c0 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.h @@ -9,7 +9,7 @@ #include -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) /* Generate a new RSA keypair with the specified key size, in bits. diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_sec.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_sec.c index 0fcaa51f4b44b..a9dc6888f272c 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_sec.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_sec.c @@ -3,7 +3,7 @@ #include "pal_sec.h" -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) CFStringRef AppleCryptoNative_SecCopyErrorMessageString(int32_t osStatus) { return SecCopyErrorMessageString(osStatus, NULL); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_sec.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_sec.h index 0b6b65778c51f..25eee34933536 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_sec.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_sec.h @@ -8,7 +8,7 @@ #include -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) /* Get an error message for an OSStatus error from the security library. diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_seckey.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_seckey.c index f4bca5827286e..99c4a1c4820ad 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_seckey.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_seckey.c @@ -4,7 +4,7 @@ #include "pal_seckey.h" #include "pal_utilities.h" -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) int32_t AppleCryptoNative_SecKeyExport( SecKeyRef pKey, int32_t exportPrivate, CFStringRef cfExportPassphrase, CFDataRef* ppDataOut, int32_t* pOSStatus) { @@ -140,7 +140,7 @@ uint64_t AppleCryptoNative_SecKeyGetSimpleKeySizeInBytes(SecKeyRef publicKey) return SecKeyGetBlockSize(publicKey); } -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) OSStatus ExportImportKey(SecKeyRef* key, SecExternalItemType type) { SecExternalFormat dataFormat = kSecFormatOpenSSL; diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_seckey.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_seckey.h index fcffc3023d107..37fcb4f5cd226 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_seckey.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_seckey.h @@ -16,7 +16,7 @@ static const int32_t kErrorSeeError = -2; static const int32_t kErrorUnknownAlgorithm = -3; static const int32_t kErrorUnknownState = -4; -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) /* Export a key object. @@ -60,7 +60,7 @@ For ECC the value should not be used. */ PALEXPORT uint64_t AppleCryptoNative_SecKeyGetSimpleKeySizeInBytes(SecKeyRef publicKey); -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) /* Export a key and re-import it to the NULL keychain. diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_signverify.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_signverify.c index 39550b5997816..f429771ad9676 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_signverify.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_signverify.c @@ -3,7 +3,7 @@ #include "pal_signverify.h" -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) static int32_t ExecuteSignTransform(SecTransformRef signer, CFDataRef* pSignatureOut, CFErrorRef* pErrorOut); static int32_t ExecuteVerifyTransform(SecTransformRef verifier, CFErrorRef* pErrorOut); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_signverify.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_signverify.h index e87ac9701c528..03186109108de 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_signverify.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_signverify.h @@ -9,7 +9,7 @@ #include -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) /* Generate a signature for algorithms which require only the data hash blob, like DSA and ECDSA. diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ssl.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ssl.c index ac0d06b172a48..190c1dc1c9976 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ssl.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ssl.c @@ -588,7 +588,7 @@ int32_t AppleCryptoNative_SslSetEnabledCipherSuites(SSLContextRef sslContext, co // Max numCipherSuites is 2^16 (all possible cipher suites) assert(numCipherSuites < (1 << 16)); -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) if (sizeof(SSLCipherSuite) == sizeof(uint32_t)) { #pragma clang diagnostic push @@ -600,7 +600,7 @@ int32_t AppleCryptoNative_SslSetEnabledCipherSuites(SSLContextRef sslContext, co else #endif { - // iOS, tvOS, watchOS + // MacCatalyst, iOS, tvOS, watchOS SSLCipherSuite* cipherSuites16 = (SSLCipherSuite*)calloc((size_t)numCipherSuites, sizeof(SSLCipherSuite)); if (cipherSuites16 == NULL) diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_trust.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_trust.c index 99afb40735460..83eefc916c598 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_trust.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_trust.c @@ -4,7 +4,7 @@ #include "pal_trust.h" #include "pal_utilities.h" -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) static bool CheckTrustMatch(SecCertificateRef cert, SecTrustSettingsDomain domain, SecTrustSettingsResult result, diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_trust.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_trust.h index 4339570fcaf1e..5087db65b8c72 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_trust.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_trust.h @@ -8,7 +8,7 @@ #include -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) /* Enumerate the certificates which are root trusted by the user. diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509.c index 649b5ed2e566e..ec91e362f501b 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509.c @@ -107,7 +107,7 @@ PAL_X509ContentType AppleCryptoNative_X509GetContentType(uint8_t* pbData, int32_ return PAL_Certificate; } -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) SecExternalFormat dataFormat = kSecFormatPKCS7; SecExternalFormat actualFormat = dataFormat; SecExternalItemType itemType = kSecItemTypeAggregate; @@ -257,7 +257,7 @@ int32_t AppleCryptoNative_X509CopyPrivateKeyFromIdentity(SecIdentityRef identity return SecIdentityCopyPrivateKey(identity, pPrivateKeyOut); } -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) static int32_t ReadX509(uint8_t* pbData, int32_t cbData, PAL_X509ContentType contentType, diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509.h index f9d2f4c322a44..fbe79a9e6af24 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509.h @@ -73,7 +73,7 @@ pPrivateKeyOut: Receives a SecKeyRef for the private key associated with the ide */ PALEXPORT int32_t AppleCryptoNative_X509CopyPrivateKeyFromIdentity(SecIdentityRef identity, SecKeyRef* pPrivateKeyOut); -#if !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) /* Read cbData bytes of data from pbData and interpret it to a collection of certificates (or identities). diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt index b9c01c3915949..83b9ae5999816 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt @@ -97,7 +97,7 @@ if (GEN_SHARED_LIB) endif() endif() - if (NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID) + if (NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID) add_custom_command(TARGET System.Security.Cryptography.Native.OpenSsl POST_BUILD COMMENT "Verifying System.Security.Cryptography.Native.OpenSsl entry points against entrypoints.c " COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../verify-entrypoints.sh diff --git a/src/libraries/Native/Unix/configure.cmake b/src/libraries/Native/Unix/configure.cmake index 2d82decfde624..a3f541d332042 100644 --- a/src/libraries/Native/Unix/configure.cmake +++ b/src/libraries/Native/Unix/configure.cmake @@ -25,6 +25,8 @@ elseif (CLR_CMAKE_TARGET_OSX) # Xcode's clang does not include /usr/local/include by default, but brew's does. # This ensures an even playing field. include_directories(SYSTEM /usr/local/include) +elseif (CLR_CMAKE_TARGET_MACCATALYST) + set(PAL_UNIX_NAME \"MACCATALYST\") elseif (CLR_CMAKE_TARGET_IOS) set(PAL_UNIX_NAME \"IOS\") elseif (CLR_CMAKE_TARGET_TVOS) @@ -503,6 +505,13 @@ if(CLR_CMAKE_TARGET_IOS) unset(HAVE_CLOCK_MONOTONIC) # only exists on iOS 10+ unset(HAVE_CLOCK_REALTIME) # only exists on iOS 10+ unset(HAVE_FORK) # exists but blocked by kernel +elseif(CLR_CMAKE_TARGET_MACCATALYST) + # Manually set results from check_c_source_runs() since it's not possible to actually run it during CMake configure checking + # TODO: test to see if these all actually hold true on Mac Catalyst + 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+ + unset(HAVE_FORK) # exists but blocked by kernel elseif(CLR_CMAKE_TARGET_TVOS) # 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) @@ -782,7 +791,7 @@ check_symbol_exists( "unistd.h;grp.h" HAVE_GETGROUPLIST) -if(CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) +if(CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) set(HAVE_IOS_NET_ROUTE_H 1) set(CMAKE_EXTRA_INCLUDE_FILES sys/types.h "${CMAKE_CURRENT_SOURCE_DIR}/System.Native/ios/net/route.h") else() diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/CMakeLists.txt b/src/libraries/Native/Windows/System.IO.Compression.Native/CMakeLists.txt index f35ddcfce15ac..e161657b3960d 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/CMakeLists.txt +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/CMakeLists.txt @@ -89,7 +89,7 @@ if (GEN_SHARED_LIB) ) endif() -if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) +if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) set(NATIVECOMPRESSION_SOURCES ${NATIVECOMPRESSION_SOURCES} ../../AnyOS/System.IO.Compression.Native/entrypoints.c) endif() diff --git a/src/libraries/OSGroups.json b/src/libraries/OSGroups.json index b0a421fa5c302..8bcd4aa7e9d32 100644 --- a/src/libraries/OSGroups.json +++ b/src/libraries/OSGroups.json @@ -14,6 +14,11 @@ "Unix" ] }, + "MacCatalyst": { + "#import": [ + "Unix" + ] + }, "iOS": { "#import": [ "Unix" diff --git a/src/libraries/System.Console/src/System.Console.csproj b/src/libraries/System.Console/src/System.Console.csproj index b4b5eb0bcb247..deb4c6b9347c0 100644 --- a/src/libraries/System.Console/src/System.Console.csproj +++ b/src/libraries/System.Console/src/System.Console.csproj @@ -1,7 +1,7 @@ true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-Browser + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-Browser enable @@ -19,7 +19,7 @@ Link="Common\System\Text\ConsoleEncoding.cs" /> - + @@ -149,7 +149,7 @@ Link="Common\System\Text\ValueStringBuilder.cs" /> - + diff --git a/src/libraries/System.Data.Odbc/src/System.Data.Odbc.csproj b/src/libraries/System.Data.Odbc/src/System.Data.Odbc.csproj index 20d918a90a125..af9acbe069dd9 100644 --- a/src/libraries/System.Data.Odbc/src/System.Data.Odbc.csproj +++ b/src/libraries/System.Data.Odbc/src/System.Data.Odbc.csproj @@ -1,7 +1,7 @@ true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent);netcoreapp2.0-FreeBSD;netcoreapp2.0-Linux;netcoreapp2.0-OSX;netcoreapp2.0-windows;netstandard2.0;net461-windows + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent);netcoreapp2.0-FreeBSD;netcoreapp2.0-Linux;netcoreapp2.0-OSX;netcoreapp2.0-windows;netstandard2.0;net461-windows true $(NoWarn);CA2249;CA1838 enable @@ -118,7 +118,7 @@ - + diff --git a/src/libraries/System.Data.Odbc/tests/System.Data.Odbc.Tests.csproj b/src/libraries/System.Data.Odbc/tests/System.Data.Odbc.Tests.csproj index d22d70ea780ba..ec9f0153009c8 100644 --- a/src/libraries/System.Data.Odbc/tests/System.Data.Odbc.Tests.csproj +++ b/src/libraries/System.Data.Odbc/tests/System.Data.Odbc.Tests.csproj @@ -1,7 +1,7 @@ $(DefineConstants);TargetsWindows - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;net461-windows + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;net461-windows @@ -23,7 +23,7 @@ - + diff --git a/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj b/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj index 8896c6b0bfd16..2d0ea9a7ba3ee 100644 --- a/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj +++ b/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj @@ -2,7 +2,7 @@ $(DefineConstants);FEATURE_REGISTRY true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent);$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent);$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS enable $(NoWarn);0649 @@ -286,7 +286,7 @@ - + diff --git a/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj b/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj index 2687d60160295..e63db3b70aea3 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj +++ b/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj @@ -1,7 +1,7 @@ true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent);$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-FreeBSD + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent);$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-FreeBSD enable @@ -75,7 +75,7 @@ - + diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj b/src/libraries/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj index 6198325a2dfb7..8541c8a86adc8 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj @@ -1,7 +1,7 @@ true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-FreeBSD + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-FreeBSD @@ -32,7 +32,7 @@ - + diff --git a/src/libraries/System.IO.Ports/tests/System.IO.Ports.Tests.csproj b/src/libraries/System.IO.Ports/tests/System.IO.Ports.Tests.csproj index 4b498002d8020..49631432ba136 100644 --- a/src/libraries/System.IO.Ports/tests/System.IO.Ports.Tests.csproj +++ b/src/libraries/System.IO.Ports/tests/System.IO.Ports.Tests.csproj @@ -1,6 +1,6 @@ - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-FreeBSD;net461-windows + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-FreeBSD;net461-windows @@ -124,4 +124,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.Net.Http/src/System.Net.Http.csproj b/src/libraries/System.Net.Http/src/System.Net.Http.csproj index 43afb449b58aa..607cbc4212309 100644 --- a/src/libraries/System.Net.Http/src/System.Net.Http.csproj +++ b/src/libraries/System.Net.Http/src/System.Net.Http.csproj @@ -3,10 +3,10 @@ win true $(DefineConstants);HTTP_DLL - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris enable - + $(DefineConstants);SYSNETHTTP_NO_OPENSSL @@ -329,11 +329,11 @@ - + - + - + ../../src/Resources/Strings.resx true true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS annotations @@ -244,9 +244,9 @@ Link="ProductionCode\System\Net\Http\SocketsHttpHandler\HttpEnvironmentProxy.Windows.cs" /> - - @@ -257,7 +257,7 @@ - + diff --git a/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj b/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj index 0ad2ab63dc2e4..58f1bce82a811 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj +++ b/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj @@ -1,7 +1,7 @@ true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris;$(NetCoreAppCurrent) + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris;$(NetCoreAppCurrent) enable @@ -145,7 +145,7 @@ - + @@ -164,7 +164,7 @@ - + diff --git a/src/libraries/System.Net.Quic/src/System.Net.Quic.csproj b/src/libraries/System.Net.Quic/src/System.Net.Quic.csproj index 2b75f1c3eeecb..33e3f55daf276 100644 --- a/src/libraries/System.Net.Quic/src/System.Net.Quic.csproj +++ b/src/libraries/System.Net.Quic/src/System.Net.Quic.csproj @@ -1,7 +1,7 @@ true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent) + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent) enable @@ -38,7 +38,7 @@ - + diff --git a/src/libraries/System.Net.Security/src/System.Net.Security.csproj b/src/libraries/System.Net.Security/src/System.Net.Security.csproj index a1b7848cf7c00..d161c0d6b5340 100644 --- a/src/libraries/System.Net.Security/src/System.Net.Security.csproj +++ b/src/libraries/System.Net.Security/src/System.Net.Security.csproj @@ -1,7 +1,7 @@ true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent) + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent) $(DefineConstants);PRODUCT enable @@ -9,7 +9,7 @@ SR.SystemNetSecurity_PlatformNotSupported - + $(DefineConstants);SYSNETSECURITY_NO_OPENSSL @@ -268,7 +268,7 @@ - + @@ -326,7 +326,7 @@ - + true true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS annotations true diff --git a/src/libraries/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj b/src/libraries/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj index 9835fac615253..75573204e4892 100644 --- a/src/libraries/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj +++ b/src/libraries/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj @@ -10,7 +10,7 @@ 436 $(NoWarn);3021 - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS annotations true @@ -76,4 +76,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index 69842a262f148..39f915e755ef4 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -10,7 +10,7 @@ enable - true + true true true $(MSBuildThisFileDirectory)ILLink\ @@ -24,6 +24,7 @@ $(DefineConstants);TARGET_UNIX $(DefineConstants);TARGET_WINDOWS $(DefineConstants);TARGET_OSX + $(DefineConstants);TARGET_MACCATALYST $(DefineConstants);TARGET_IOS $(DefineConstants);TARGET_TVOS $(DefineConstants);TARGET_BROWSER @@ -1819,7 +1820,7 @@ - + diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs index 9303667afa639..ecc990b07c6e1 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs @@ -134,7 +134,7 @@ internal static bool IsCaseSensitive { get { - #if TARGET_OSX || TARGET_IOS || TARGET_TVOS + #if TARGET_OSX || TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS return false; #else return true; diff --git a/src/libraries/System.Private.CoreLib/src/System/OperatingSystem.cs b/src/libraries/System.Private.CoreLib/src/System/OperatingSystem.cs index 6b3a5b5682f48..02995ff47b74a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/OperatingSystem.cs +++ b/src/libraries/System.Private.CoreLib/src/System/OperatingSystem.cs @@ -203,6 +203,24 @@ public static bool IsMacOS() => public static bool IsMacOSVersionAtLeast(int major, int minor = 0, int build = 0) => IsMacOS() && IsOSVersionAtLeast(major, minor, build, 0); +/* Commented out for now, until we're ready to make changes to the public API + /// + /// Indicates whether the current application is running on Mac Catalyst. + /// + public static bool IsMacCatalyst() => +#if TARGET_MACCATALYST + true; +#else + false; +#endif + + /// + /// Check for the Mac Catalyst version (returned by 'libobjc.get_operatingSystemVersion') with a >= version comparison. Used to guard APIs that were added in the given Mac Catalyst release. + /// + public static bool IsMacCatalystVersionAtLeast(int major, int minor = 0, int build = 0) + => IsMacCatalyst() && IsOSVersionAtLeast(major, minor, build, 0); +*/ + /// /// Indicates whether the current application is running on tvOS. /// diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/LibraryNameVariation.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/LibraryNameVariation.Unix.cs index ee4d9d95e1950..cf1efef3fab2e 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/LibraryNameVariation.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/LibraryNameVariation.Unix.cs @@ -9,7 +9,7 @@ namespace System.Runtime.Loader internal partial struct LibraryNameVariation { private const string LibraryNamePrefix = "lib"; -#if TARGET_OSX || TARGET_IOS || TARGET_TVOS +#if TARGET_OSX || TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS private const string LibraryNameSuffix = ".dylib"; #else private const string LibraryNameSuffix = ".so"; diff --git a/src/libraries/System.Runtime.Extensions/tests/System/OperatingSystemTests.cs b/src/libraries/System.Runtime.Extensions/tests/System/OperatingSystemTests.cs index c355baf8e2aea..c0e05a97e37d0 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/OperatingSystemTests.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/OperatingSystemTests.cs @@ -11,6 +11,7 @@ public static class OperatingSystemTests { "Android", "macOS", + //"MacCatalyst", "iOS", "tvOS", "watchOS", @@ -122,6 +123,14 @@ public static void OSX_Is_Treated_as_macOS() AssertVersionChecks(true, (major, minor, build) => OperatingSystem.IsOSPlatformVersionAtLeast("osx", major, minor, build)); } + /* Disable Mac Catalyst tests until Arcade and xharness are ready + [Fact, PlatformSpecific(TestPlatforms.MacCatalyst)] + public static void TestIsOSPlatform_MacCatalyst() => TestIsOSPlatform("MacCatalyst", OperatingSystem.IsMacCatalyst); + + [Fact, PlatformSpecific(TestPlatforms.MacCatalyst)] + public static void TestIsOSVersionAtLeast_MacCatalyst() => TestIsOSVersionAtLeast("MacCatalyst"); + */ + [Fact, PlatformSpecific(TestPlatforms.tvOS)] public static void TestIsOSPlatform_TvOS() => TestIsOSPlatform("tvOS", OperatingSystem.IsTvOS); @@ -155,6 +164,7 @@ private static void TestIsOSPlatform(string currentOSName, Func currentOSC OperatingSystem.IsAndroid(), OperatingSystem.IsIOS(), OperatingSystem.IsMacOS(), + //OperatingSystem.IsMacCatalyst(), OperatingSystem.IsTvOS(), OperatingSystem.IsWatchOS(), OperatingSystem.IsWindows() @@ -177,6 +187,7 @@ private static void TestIsOSVersionAtLeast(string currentOSName) AssertVersionChecks(currentOSName.Equals("Android", StringComparison.OrdinalIgnoreCase), OperatingSystem.IsAndroidVersionAtLeast); AssertVersionChecks(currentOSName.Equals("iOS", StringComparison.OrdinalIgnoreCase), OperatingSystem.IsIOSVersionAtLeast); AssertVersionChecks(currentOSName.Equals("macOS", StringComparison.OrdinalIgnoreCase), OperatingSystem.IsMacOSVersionAtLeast); + //AssertVersionChecks(currentOSName.Equals("MacCatalyst", StringComparison.OrdinalIgnoreCase), OperatingSystem.IsMacCatalystVersionAtLeast); AssertVersionChecks(currentOSName.Equals("tvOS", StringComparison.OrdinalIgnoreCase), OperatingSystem.IsTvOSVersionAtLeast); AssertVersionChecks(currentOSName.Equals("watchOS", StringComparison.OrdinalIgnoreCase), OperatingSystem.IsWatchOSVersionAtLeast); AssertVersionChecks(currentOSName.Equals("Windows", StringComparison.OrdinalIgnoreCase), OperatingSystem.IsWindowsVersionAtLeast); diff --git a/src/libraries/System.Runtime.Serialization.Formatters/tests/System.Runtime.Serialization.Formatters.Tests.csproj b/src/libraries/System.Runtime.Serialization.Formatters/tests/System.Runtime.Serialization.Formatters.Tests.csproj index 9981362c913c5..4048599954111 100644 --- a/src/libraries/System.Runtime.Serialization.Formatters/tests/System.Runtime.Serialization.Formatters.Tests.csproj +++ b/src/libraries/System.Runtime.Serialization.Formatters/tests/System.Runtime.Serialization.Formatters.Tests.csproj @@ -2,7 +2,7 @@ true true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;net48 + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;net48 diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj b/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj index 3ab0e6157eb7f..4bc44931c4420 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj @@ -3,7 +3,7 @@ true $(DefineConstants);INTERNAL_ASYMMETRIC_IMPLEMENTATIONS $(NoWarn);CA5350;CA5351;CA5379;CA5384 - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-Browser + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-Browser enable @@ -423,7 +423,7 @@ - + - + true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent);$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent);$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS enable SR.SystemSecurityCryptographyEncoding_PlatformNotSupported - - + + @@ -52,7 +52,7 @@ - + @@ -79,7 +79,7 @@ - + @@ -123,7 +123,7 @@ - + diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj b/src/libraries/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj index 5c7060a7b40d2..ee276515f6d9a 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj @@ -2,7 +2,7 @@ true $(NoWarn);CA5384 - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent); + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent); enable @@ -282,7 +282,7 @@ - + System\Security\Cryptography\X509Certificates\Asn1\DistributionPointAsn.xml @@ -391,7 +391,7 @@ - + - + diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/System.Security.Cryptography.X509Certificates.Tests.csproj b/src/libraries/System.Security.Cryptography.X509Certificates/tests/System.Security.Cryptography.X509Certificates.Tests.csproj index 1ffcaefd56a99..23670a966e3c9 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/System.Security.Cryptography.X509Certificates.Tests.csproj +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/System.Security.Cryptography.X509Certificates.Tests.csproj @@ -4,7 +4,7 @@ $(DefineConstants);HAVE_THUMBPRINT_OVERLOADS $(DefineConstants);Unix true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS @@ -67,7 +67,7 @@ - + @@ -89,7 +89,7 @@ Link="Common\System\IO\PersistedFiles.Names.Unix.cs" /> - + diff --git a/src/libraries/pretest.proj b/src/libraries/pretest.proj index 13d0423bb026f..11cf05cf89ed0 100644 --- a/src/libraries/pretest.proj +++ b/src/libraries/pretest.proj @@ -19,7 +19,7 @@ - + diff --git a/src/mono/CMakeLists.txt b/src/mono/CMakeLists.txt index 64dcb59a81b18..ed43a8bdf4061 100644 --- a/src/mono/CMakeLists.txt +++ b/src/mono/CMakeLists.txt @@ -179,6 +179,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(HOST_OSX 1) set(PTHREAD_POINTER_ID 1) set(USE_MACH_SEMA 1) + if(CMAKE_SYSTEM_VARIANT STREQUAL "MacCatalyst") + set(HOST_MACCATALYST 1) + endif() elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS") # See man cmake-toolchains(7) on which variables # control cross-compiling to ios diff --git a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj index a847064b9e68e..efd199d2e5139 100644 --- a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -267,7 +267,7 @@ - + Common\Interop\OSX\Interop.SearchPath.cs diff --git a/src/mono/cmake/configure.cmake b/src/mono/cmake/configure.cmake index f7e6e78c27c01..bbdfe7be4a7de 100644 --- a/src/mono/cmake/configure.cmake +++ b/src/mono/cmake/configure.cmake @@ -163,4 +163,6 @@ if(HOST_IOS) set(HAVE_EXECVP 0) set(HAVE_SIGNAL 0) endif() -endif() \ No newline at end of file +elseif(HOST_MACCATALYST) + set(HAVE_SYSTEM 0) +endif() diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 0b3319f90ee5c..40537a2f5d539 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -19,12 +19,13 @@ .sh coreclr.dll libcoreclr.dylib + libcoreclr.dylib libcoreclr.so libmonosgen-2.0.dylib libmonosgen-2.0.so libmonosgen-2.0.a $(CoreClrFileName) - libmonosgen-2.0.a + libmonosgen-2.0.a $(Configuration) $(Configuration) $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'tests', 'coreclr', '$(TargetOS).$(Platform).$(CoreClrTestConfig)', 'Tests', 'Core_Root')) @@ -64,7 +65,7 @@ - + <_MonoCMakeArgs Include="-DENABLE_WERROR=1"/> @@ -199,7 +200,22 @@ <_MonoCXXFLAGS Condition="'$(TargetArchitecture)' == 'arm64'" Include="-arch arm64" /> <_MonoLDFLAGS Condition="'$(TargetArchitecture)' == 'arm64'" Include="-arch arm64" /> - <_MonoBuildEnv Condition="'$(Platform)' == 'arm64'" Include="arch -arch arm64" /> + <_MonoBuildEnv Condition="'$(BuildArchitecture)' == 'arm64'" Include="arch -arch arm64" /> + + + + <_MonoCMakeArgs Include="-DCMAKE_SYSTEM_VARIANT=MacCatalyst" /> + + <_MonoCPPFLAGS Include="-Wno-overriding-t-option" /> + <_MonoCFlags Condition="'$(TargetArchitecture)' == 'arm64'" Include="-target arm64-apple-ios14.2-macabi" /> + <_MonoCFlags Condition="'$(TargetArchitecture)' == 'x64'" Include="-target x86_64-apple-ios13.5-macabi" /> + <_MonoCFLAGS Condition="'$(TargetArchitecture)' == 'arm64'" Include="-arch arm64" /> + <_MonoCXXFlags Condition="'$(TargetArchitecture)' == 'arm64'" Include="-target arm64-apple-ios14.2-macabi" /> + <_MonoCXXFlags Condition="'$(TargetArchitecture)' == 'x64'" Include="-target x86_64-apple-ios13.5-macabi" /> + <_MonoCXXFLAGS Condition="'$(TargetArchitecture)' == 'arm64'" Include="-arch arm64" /> + <_MonoLDFLAGS Condition="'$(TargetArchitecture)' == 'arm64'" Include="-arch arm64" /> + + <_MonoBuildEnv Condition="'$(BuildArchitecture)' == 'arm64'" Include="arch -arch arm64" /> @@ -231,6 +247,9 @@ <_MonoCMakeVersionMin Condition="'$(TargetsiOS)' == 'true'">$(iOSVersionMin) <_MonoCMakeVersionMin Condition="'$(TargetstvOS)' == 'true'">$(tvOSVersionMin) + + <_MonoCMakeArgs Include="-DCMAKE_OSX_ARCHITECTURES=arm64"/> + <_MonoCMakeArgs Include="-DCMAKE_SYSTEM_NAME=$(_MonoCMakeSystemName)"/> <_MonoCMakeArgs Include="-DCMAKE_OSX_DEPLOYMENT_TARGET=$(_MonoCMakeVersionMin)" /> @@ -498,11 +517,12 @@ <_MonoRuntimeFilePath Condition="'$(TargetsWindows)' == 'true'">$(MonoObjDir)out\bin\monosgen-2.0.dll <_MonoRuntimeFilePath Condition="'$(TargetsOSX)' == 'true'">$(MonoObjDir)out\lib\libmonosgen-2.0.dylib + <_MonoRuntimeFilePath Condition="'$(TargetsMacCatalyst)' == 'true'">$(MonoObjDir)out\lib\libmonosgen-2.0.dylib <_MonoRuntimeFilePath Condition="'$(TargetsiOS)' == 'true'">$(MonoObjDir)out\lib\libmonosgen-2.0.dylib <_MonoRuntimeFilePath Condition="'$(TargetstvOS)' == 'true'">$(MonoObjDir)out\lib\libmonosgen-2.0.dylib <_MonoRuntimeFilePath Condition="'$(TargetsBrowser)' == 'true'">$(MonoObjDir)out\lib\libmonosgen-2.0.a <_MonoRuntimeFilePath Condition="'$(_MonoRuntimeFilePath)' == ''">$(MonoObjDir)out\lib\libmonosgen-2.0.so - <_MonoRuntimeStaticFilePath Condition="'$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true' or '$(TargetsAndroid)' == 'true'">$(MonoObjDir)out\lib\libmonosgen-2.0.a + <_MonoRuntimeStaticFilePath Condition="'$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true' or '$(TargetsAndroid)' == 'true'">$(MonoObjDir)out\lib\libmonosgen-2.0.a <_MonoIncludeInterpStaticFiles Condition="'$(TargetsBrowser)' == 'true'">true @@ -555,9 +575,9 @@ + Condition="'$(MonoGenerateOffsetsOSGroups)' == '' and ('$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true' or '$(TargetsAndroid)' == 'true' or '$(TargetsBrowser)' == 'true')"/> - + diff --git a/src/mono/mono/mini/graph.c b/src/mono/mono/mini/graph.c index 39d7bdec76e74..4d6902d34a83a 100644 --- a/src/mono/mono/mini/graph.c +++ b/src/mono/mono/mini/graph.c @@ -198,7 +198,9 @@ mono_draw_code_cfg (MonoCompile *cfg, FILE *fp) void mono_draw_graph (MonoCompile *cfg, MonoGraphOptions draw_options) { +#ifdef HAVE_SYSTEM char *com; +#endif const char *fn; FILE *fp; int _i G_GNUC_UNUSED; diff --git a/src/mono/mono/utils/mono-sigcontext.h b/src/mono/mono/utils/mono-sigcontext.h index 699af6e37d1fb..e8e2161733ee4 100644 --- a/src/mono/mono/utils/mono-sigcontext.h +++ b/src/mono/mono/utils/mono-sigcontext.h @@ -474,6 +474,9 @@ typedef struct ucontext { #else #define UCONTEXT_REG_PC(ctx) (((ucontext64_t*)(ctx))->uc_mcontext64->__ss.__pc) #define UCONTEXT_REG_SP(ctx) (((ucontext64_t*)(ctx))->uc_mcontext64->__ss.__sp) + #define UCONTEXT_REG_SET_PC(ctx,val) do { \ + UCONTEXT_REG_PC (ctx) = (__uint64_t)(val); \ + } while (0) #endif #define UCONTEXT_REG_R0(ctx) (((ucontext64_t*)(ctx))->uc_mcontext64->__ss.__x [ARMREG_R0]) @@ -497,6 +500,8 @@ typedef struct ucontext { #define UCONTEXT_REG_SET_PC(ctx, val) do { \ UCONTEXT_REG_PC (ctx) = (val); \ } while (0) +#endif +#ifndef UCONTEXT_REG_SET_SP #define UCONTEXT_REG_SET_SP(ctx, val) do { \ UCONTEXT_REG_SP (ctx) = (val); \ } while (0) diff --git a/src/tasks/AppleAppBuilder/TargetOS.cs b/src/tasks/AppleAppBuilder/TargetOS.cs index c3e55db30d114..3fb54c975c88c 100644 --- a/src/tasks/AppleAppBuilder/TargetOS.cs +++ b/src/tasks/AppleAppBuilder/TargetOS.cs @@ -5,4 +5,5 @@ internal class TargetNames { public const string iOS = "iOS"; public const string tvOS = "tvOS"; + public const string MacCatalyst = "MacCatalyst"; } diff --git a/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template b/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template index 6b76683dfc718..4b3d40bda6a8a 100644 --- a/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template +++ b/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template @@ -27,6 +27,7 @@ set_target_properties(%ProjectName% PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist XCODE_ATTRIBUTE_ENABLE_BITCODE "NO" XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING "NO" + XCODE_ATTRIBUTE_SUPPORTS_MACCATALYST "YES" RESOURCE "${APP_RESOURCES}" ) diff --git a/src/tasks/AppleAppBuilder/Templates/runtime.m b/src/tasks/AppleAppBuilder/Templates/runtime.m index a7e6e9869b9f0..1a27d785f3b13 100644 --- a/src/tasks/AppleAppBuilder/Templates/runtime.m +++ b/src/tasks/AppleAppBuilder/Templates/runtime.m @@ -29,6 +29,11 @@ return bundle_path; NSBundle* main_bundle = [NSBundle mainBundle]; NSString* path = [main_bundle bundlePath]; + +#if TARGET_OS_MACCATALYST + path = [path stringByAppendingString:@"/Contents/Resources"]; +#endif + bundle_path = strdup ([path UTF8String]); return bundle_path; @@ -196,7 +201,7 @@ //%DllMap% } -#if FORCE_INTERPRETER || FORCE_AOT || !TARGET_OS_SIMULATOR +#if FORCE_INTERPRETER || FORCE_AOT || (!TARGET_OS_SIMULATOR && !TARGET_OS_MACCATALYST) void mono_jit_set_aot_mode (MonoAotMode mode); void register_aot_modules (void); #endif @@ -231,7 +236,7 @@ #if FORCE_INTERPRETER os_log_info (OS_LOG_DEFAULT, "INTERP Enabled"); mono_jit_set_aot_mode (MONO_AOT_MODE_INTERP_ONLY); -#elif !TARGET_OS_SIMULATOR || FORCE_AOT +#elif (!TARGET_OS_SIMULATOR && !TARGET_OS_MACCATALYST) || FORCE_AOT register_dllmap (); // register modules register_aot_modules (); diff --git a/src/tasks/AppleAppBuilder/Xcode.cs b/src/tasks/AppleAppBuilder/Xcode.cs index 2d7d5a2ed59f8..3f29fcf3a911a 100644 --- a/src/tasks/AppleAppBuilder/Xcode.cs +++ b/src/tasks/AppleAppBuilder/Xcode.cs @@ -15,9 +15,18 @@ internal class Xcode public Xcode(string target) { Target = target; - SysRoot = (Target == TargetNames.iOS) ? - Utils.RunProcess("xcrun", "--sdk iphoneos --show-sdk-path") : - Utils.RunProcess("xcrun", "--sdk appletvos --show-sdk-path"); + switch (Target) + { + case TargetNames.iOS: + SysRoot = Utils.RunProcess("xcrun", "--sdk iphoneos --show-sdk-path"); + break; + case TargetNames.tvOS: + SysRoot = Utils.RunProcess("xcrun", "--sdk appletvos --show-sdk-path"); + break; + default: + SysRoot = Utils.RunProcess("xcrun", "--sdk macosx --show-sdk-path"); + break; + } } public string GenerateXCode( @@ -95,7 +104,7 @@ public string GenerateXCode( } string frameworks = ""; - if (Target == TargetNames.iOS) + if ((Target == TargetNames.iOS) || (Target == TargetNames.MacCatalyst)) { frameworks = "\"-framework GSS\""; } @@ -122,13 +131,15 @@ public string GenerateXCode( File.WriteAllText(Path.Combine(binDir, "Info.plist"), plist); File.WriteAllText(Path.Combine(binDir, "CMakeLists.txt"), cmakeLists); + var targetName = (Target == TargetNames.MacCatalyst) ? "Darwin" : Target.ToString(); + var deployTarget = (Target == TargetNames.MacCatalyst) ? "" : " -DCMAKE_OSX_DEPLOYMENT_TARGET=10.1"; var cmakeArgs = new StringBuilder(); cmakeArgs .Append("-S.") .Append(" -B").Append(projectName) .Append(" -GXcode") - .Append(" -DCMAKE_SYSTEM_NAME=" + Target.ToString()) - .Append(" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.1"); + .Append(" -DCMAKE_SYSTEM_NAME=" + targetName) + .Append(deployTarget); File.WriteAllText(Path.Combine(binDir, "runtime.h"), Utils.GetEmbeddedResource("runtime.h")); @@ -162,29 +173,64 @@ public string BuildAppBundle( var args = new StringBuilder(); args.Append("ONLY_ACTIVE_ARCH=YES"); - if (architecture == "arm64") + if (devTeamProvisioning == "-") { - sdk = (Target == TargetNames.iOS) ? "iphoneos" : "appletvos"; - args.Append(" -arch arm64") - .Append(" -sdk " + sdk); + args.Append(" CODE_SIGN_IDENTITY=\"\"") + .Append(" CODE_SIGNING_REQUIRED=NO") + .Append(" CODE_SIGNING_ALLOWED=NO"); + } + else + { + args.Append(" -allowProvisioningUpdates") + .Append(" DEVELOPMENT_TEAM=").Append(devTeamProvisioning); + } - if (devTeamProvisioning == "-") - { - args.Append(" CODE_SIGN_IDENTITY=\"\"") - .Append(" CODE_SIGNING_REQUIRED=NO") - .Append(" CODE_SIGNING_ALLOWED=NO"); - } - else + + if (architecture == "arm64") + { + switch (Target) { - args.Append(" -allowProvisioningUpdates") - .Append(" DEVELOPMENT_TEAM=").Append(devTeamProvisioning); + case TargetNames.iOS: + sdk = "iphoneos"; + args.Append(" -arch arm64") + .Append(" -sdk " + sdk); + break; + case TargetNames.tvOS: + sdk = "appletvos"; + args.Append(" -arch arm64") + .Append(" -sdk " + sdk); + break; + default: + sdk = "maccatalyst"; + args.Append(" -scheme \"" + Path.GetFileNameWithoutExtension(xcodePrjPath) + "\"") + .Append(" -destination \"platform=macOS,arch=arm64,variant=Mac Catalyst\"") + .Append(" -UseModernBuildSystem=YES") + .Append(" IPHONEOS_DEPLOYMENT_TARGET=14.2"); + break; } } else { - sdk = (Target == TargetNames.iOS) ? "iphonesimulator" : "appletvsimulator"; - args.Append(" -arch x86_64") - .Append(" -sdk " + sdk); + switch (Target) + { + case TargetNames.iOS: + sdk = "iphonesimulator"; + args.Append(" -arch x86_64") + .Append(" -sdk " + sdk); + break; + case TargetNames.tvOS: + sdk = "appletvsimulator"; + args.Append(" -arch x86_64") + .Append(" -sdk " + sdk); + break; + default: + sdk = "maccatalyst"; + args.Append(" -scheme \"" + Path.GetFileNameWithoutExtension(xcodePrjPath) + "\"") + .Append(" -destination \"platform=macOS,arch=x86_64,variant=Mac Catalyst\"") + .Append(" -UseModernBuildSystem=YES") + .Append(" IPHONEOS_DEPLOYMENT_TARGET=13.5"); + break; + } } string config = optimized ? "Release" : "Debug"; diff --git a/src/tasks/tasks.proj b/src/tasks/tasks.proj index e113c54f972a5..3477a1e9aee10 100644 --- a/src/tasks/tasks.proj +++ b/src/tasks/tasks.proj @@ -4,7 +4,7 @@ + Condition="'$(TargetOS)' != 'MacCatalyst' and '$(TargetOS)' != 'iOS' and '$(TargetOS)' != 'tvOS'" />