Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Make.config
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ DOTNET_MACOS_ASSEMBLY_NAME=Microsoft.macOS
DOTNET_PLATFORMS=
ifdef INCLUDE_IOS
DOTNET_PLATFORMS+=iOS
DOTNET_CORECLR_PLATFORMS+=iOS
DOTNET_MONOVM_PLATFORMS+=iOS
DOTNET_IOS_BITNESSES+=64
DOTNET_NATIVEAOT_PLATFORMS+=iOS
Expand All @@ -451,6 +452,7 @@ endif # INCLUDE_IOS

ifdef INCLUDE_TVOS
DOTNET_PLATFORMS+=tvOS
DOTNET_CORECLR_PLATFORMS+=tvOS
DOTNET_MONOVM_PLATFORMS+=tvOS
DOTNET_TVOS_BITNESSES+=64
DOTNET_NATIVEAOT_PLATFORMS+=tvOS
Expand All @@ -468,6 +470,7 @@ endif

ifdef INCLUDE_MACCATALYST
DOTNET_PLATFORMS+=MacCatalyst
DOTNET_CORECLR_PLATFORMS+=MacCatalyst
DOTNET_MONOVM_PLATFORMS+=MacCatalyst
DOTNET_MACCATALYST_BITNESSES+=64
DOTNET_NATIVEAOT_PLATFORMS+=MacCatalyst
Expand Down
3 changes: 3 additions & 0 deletions dotnet/targets/Microsoft.Sdk.Versions.template.props
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,8 @@
RuntimePackRuntimeIdentifiers="@RUNTIME_PACK_RUNTIME_IDENTIFIERS@"
Profile="@PLATFORM@"
/>

<!-- Need this until https://github.com/dotnet/sdk/pull/51428 is completed -->
<KnownFrameworkReference Update="Microsoft.NETCore.App" RuntimePackRuntimeIdentifiers="%(RuntimePackRuntimeIdentifiers);ios-arm64;iossimulator-x64;iossimulator-arm64;tvos-arm64;tvossimulator-x64;tvossimulator-arm64;maccatalyst-arm64;maccatalyst-x64" />
</ItemGroup>
</Project>
6 changes: 4 additions & 2 deletions dotnet/targets/Xamarin.Shared.Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,8 @@
<RuntimeHostConfigurationOption Include="ObjCRuntime.Runtime.Arch.IsSimulator" Value="$(_IsSimulatorFeature)" Trim="true" />
<RuntimeHostConfigurationOption Include="ObjCRuntime.Runtime.IsManagedStaticRegistrar" Value="$(_IsManagedStaticRegistrarFeature)" Trim="true" />
<RuntimeHostConfigurationOption Include="ObjCRuntime.Runtime.IsNativeAOT" Value="$(_IsNativeAOTFeature)" Trim="true" />
<RuntimeHostConfigurationOption Include="ObjCRuntime.Runtime.IsCoreCLR" Value="true" Trim="true" Condition="'$(UseMonoRuntime)' != 'true'" />
<RuntimeHostConfigurationOption Include="ObjCRuntime.Runtime.IsCoreCLR" Value="false" Trim="true" Condition="'$(UseMonoRuntime)' == 'true'" />
<RuntimeHostConfigurationOption Include="ObjCRuntime.Class.ValidateObjectPointers" Value="$(_ValidateObjectPointers)" Trim="true" />

<!-- Configure System.Net.Http Native Handlers -->
Expand Down Expand Up @@ -1165,8 +1167,8 @@
<!-- Don't run the AOT compiler by default -->
<_RunAotCompiler>false</_RunAotCompiler>
</PropertyGroup>
<!-- We don't run Mono's AOT compiler if we're using NativeAOT -->
<PropertyGroup Condition="'$(_UseNativeAot)' != 'true'" >
<!-- We don't run Mono's AOT compiler if we're not using Mono (aka if we're using NativeAOT or CoreCLR) -->
<PropertyGroup Condition="'$(UseMonoRuntime)' == 'true'" >
<!-- We need it for device builds for mobile platforms -->
<_RunAotCompiler Condition="'$(_SdkIsSimulator)' != 'true' And '$(_PlatformName)' != 'macOS' And '$(_PlatformName)' != 'MacCatalyst'">true</_RunAotCompiler>
<!-- We need it if the interpreter is enabled, no matter where -->
Expand Down
9 changes: 7 additions & 2 deletions runtime/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,16 @@ $(foreach platform,$(DOTNET_NATIVEAOT_PLATFORMS),$(foreach rid,$(DOTNET_$(platfo

# a few lookup tables, because the data we have is not always in the format we need it
DOTNET_iphonesimulator_DYLIB_FLAGS=-lmonosgen-2.0 -framework UIKit
DOTNET_iphonesimulator_CORECLR_DYLIB_FLAGS=-lcoreclr
DOTNET_iphoneos_DYLIB_FLAGS=-lmonosgen-2.0 -framework UIKit
DOTNET_iphoneos_CORECLR_DYLIB_FLAGS=-lcoreclr
DOTNET_tvsimulator_DYLIB_FLAGS=-lmonosgen-2.0 -framework UIKit
DOTNET_tvsimulator_CORECLR_DYLIB_FLAGS=-lcoreclr
DOTNET_tvos_DYLIB_FLAGS=-lmonosgen-2.0 -framework UIKit
DOTNET_tvos_CORECLR_DYLIB_FLAGS=-lcoreclr
DOTNET_maccatalyst_DYLIB_FLAGS=-lmonosgen-2.0 -framework UIKit
DOTNET_mac_DYLIB_FLAGS=-lcoreclr
DOTNET_maccatalyst_CORECLR_DYLIB_FLAGS=-lcoreclr
DOTNET_mac_CORECLR_DYLIB_FLAGS=-lcoreclr

#
# DotNetInstallLibTemplate lipos or copies libraries into the destination directories
Expand Down Expand Up @@ -187,7 +192,7 @@ $(foreach platform,$(DOTNET_PLATFORMS),$(foreach rid,$(DOTNET_$(platform)_RUNTIM
define DotNetLibXamarinTemplate

DOTNET$(6)_$(2)_LIBDIR ?= $$(TOP)/packages/microsoft.netcore.app.runtime$(7).$(2)/$(BUNDLED_NETCORE_PLATFORMS_PACKAGE_VERSION)/runtimes/$(2)/native
DOTNET$(6)_$(2)_DYLIB_FLAGS = $(DOTNET_$(1)_DYLIB_FLAGS) -Wl,-install_name,libxamarin$(5).dylib -framework Foundation -framework CFNetwork -lz -L$(abspath $(DOTNET$(6)_$(2)_LIBDIR))
DOTNET$(6)_$(2)_DYLIB_FLAGS = $(DOTNET_$(1)$(6)_DYLIB_FLAGS) -Wl,-install_name,libxamarin$(5).dylib -framework Foundation -framework CFNetwork -lz -L$(abspath $(DOTNET$(6)_$(2)_LIBDIR))

DOTNET_$(2)_$(4)_OBJECTS = $$(patsubst %,.libs/$(2)/%$(5).o, $(MONOTOUCH_SOURCE_STEMS)) $$(patsubst %,.libs/$(2)/%$(5).o, $(MONOTOUCH_$(shell echo $(2) | sed 's/.*-//' | tr a-z A-Z)_SOURCE_STEMS))

Expand Down
4 changes: 2 additions & 2 deletions src/ILLink.Substitutions.MacCatalyst.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<method signature="System.Void WarnOnce()" body="stub" feature="System.Diagnostics.Debugger.IsSupported" featurevalue="false" />
</type>
<type fullname="ObjCRuntime.Runtime">
<method signature="System.Boolean get_IsCoreCLR()" body="stub" feature="ObjCRuntime.Runtime.IsNativeAOT" featurevalue="false" value="false" />
<method signature="System.Boolean get_IsCoreCLR()" body="stub" feature="ObjCRuntime.Runtime.IsNativeAOT" featurevalue="true" value="true" />
<method signature="System.Boolean get_IsCoreCLR()" body="stub" feature="ObjCRuntime.Runtime.IsCoreCLR" featurevalue="false" value="false" />
<method signature="System.Boolean get_IsCoreCLR()" body="stub" feature="ObjCRuntime.Runtime.IsCoreCLR" featurevalue="true" value="true" />
<method signature="System.Boolean get_IsNativeAOT()" body="stub" feature="ObjCRuntime.Runtime.IsNativeAOT" featurevalue="false" value="false" />
<method signature="System.Boolean get_IsNativeAOT()" body="stub" feature="ObjCRuntime.Runtime.IsNativeAOT" featurevalue="true" value="true" />
<method signature="System.Boolean get_IsManagedStaticRegistrar()" body="stub" feature="ObjCRuntime.Runtime.IsManagedStaticRegistrar" featurevalue="false" value="false" />
Expand Down
4 changes: 2 additions & 2 deletions src/ILLink.Substitutions.ios.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<method signature="System.Void WarnOnce()" body="stub" feature="System.Diagnostics.Debugger.IsSupported" featurevalue="false" />
</type>
<type fullname="ObjCRuntime.Runtime">
<method signature="System.Boolean get_IsCoreCLR()" body="stub" feature="ObjCRuntime.Runtime.IsNativeAOT" featurevalue="false" value="false" />
<method signature="System.Boolean get_IsCoreCLR()" body="stub" feature="ObjCRuntime.Runtime.IsNativeAOT" featurevalue="true" value="true" />
<method signature="System.Boolean get_IsCoreCLR()" body="stub" feature="ObjCRuntime.Runtime.IsCoreCLR" featurevalue="false" value="false" />
<method signature="System.Boolean get_IsCoreCLR()" body="stub" feature="ObjCRuntime.Runtime.IsCoreCLR" featurevalue="true" value="true" />
<method signature="System.Boolean get_IsNativeAOT()" body="stub" feature="ObjCRuntime.Runtime.IsNativeAOT" featurevalue="false" value="false" />
<method signature="System.Boolean get_IsNativeAOT()" body="stub" feature="ObjCRuntime.Runtime.IsNativeAOT" featurevalue="true" value="true" />
<method signature="System.Int32 GetRuntimeArch()" body="stub" feature="ObjCRuntime.Runtime.Arch.IsSimulator" featurevalue="false" value="0" />
Expand Down
4 changes: 2 additions & 2 deletions src/ILLink.Substitutions.tvos.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<method signature="System.Void WarnOnce()" body="stub" feature="System.Diagnostics.Debugger.IsSupported" featurevalue="false" />
</type>
<type fullname="ObjCRuntime.Runtime">
<method signature="System.Boolean get_IsCoreCLR()" body="stub" feature="ObjCRuntime.Runtime.IsNativeAOT" featurevalue="false" value="false" />
<method signature="System.Boolean get_IsCoreCLR()" body="stub" feature="ObjCRuntime.Runtime.IsNativeAOT" featurevalue="true" value="true" />
<method signature="System.Boolean get_IsCoreCLR()" body="stub" feature="ObjCRuntime.Runtime.IsCoreCLR" featurevalue="false" value="false" />
<method signature="System.Boolean get_IsCoreCLR()" body="stub" feature="ObjCRuntime.Runtime.IsCoreCLR" featurevalue="true" value="true" />
<method signature="System.Boolean get_IsNativeAOT()" body="stub" feature="ObjCRuntime.Runtime.IsNativeAOT" featurevalue="false" value="false" />
<method signature="System.Boolean get_IsNativeAOT()" body="stub" feature="ObjCRuntime.Runtime.IsNativeAOT" featurevalue="true" value="true" />
<method signature="System.Int32 GetRuntimeArch()" body="stub" feature="ObjCRuntime.Runtime.Arch.IsSimulator" featurevalue="false" value="0" />
Expand Down
2 changes: 2 additions & 0 deletions tests/dotnet/MySimpleApp/iOS/MySimpleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net$(BundledNETCoreAppTargetFrameworkVersion)-ios</TargetFramework>

<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
</PropertyGroup>
<Import Project="..\shared.csproj" />
</Project>
12 changes: 12 additions & 0 deletions tests/dotnet/MySimpleApp/shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,20 @@
<ApplicationTitle>MySimpleApp</ApplicationTitle>
<ApplicationId>com.xamarin.mysimpleapp</ApplicationId>
<ApplicationVersion>3.14</ApplicationVersion>

<UseMonoRuntime>false</UseMonoRuntime>
<ExcludeTouchUnitReference>true</ExcludeTouchUnitReference>
<ExcludeNUnitLiteReference>true</ExcludeNUnitLiteReference>
<_LibMonoLinkMode>dylib</_LibMonoLinkMode>
<NoSymbolStrip>true</NoSymbolStrip>
<MtouchLink>None</MtouchLink>
</PropertyGroup>

<ItemGroup>
<_BundlerEnvironmentVariables Include="DOTNET_Interpreter" Value="%2A%21%2A" />
<_BundlerEnvironmentVariables Include="DOTNET_ReadyToRun" Value="0" />
</ItemGroup>

<Import Project="../../common/shared-dotnet.csproj" />

<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions tools/common/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,9 @@ public bool IsAOTCompiled (string assembly)
if (Platform == ApplePlatform.MacOSX)
throw ErrorHelper.CreateError (99, Errors.MX0099, "IsAOTCompiled isn't a valid operation for macOS apps.");
#endif
if (XamarinRuntime == XamarinRuntime.CoreCLR)
return false;

if (!UseInterpreter) {
if (Platform == ApplePlatform.MacCatalyst)
return IsArchEnabled (Abi.ARM64);
Expand Down
4 changes: 3 additions & 1 deletion tools/common/Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ void GenerateIOSMain (StringWriter sw, Abi abi)
var assembly_location_count = 0;
var enable_llvm = (abi & Abi.LLVM) != 0;

if (app.XamarinRuntime != XamarinRuntime.NativeAOT) {
if (app.XamarinRuntime == XamarinRuntime.MonoVM) {
register_assemblies.AppendLine ("\tGCHandle exception_gchandle = INVALID_GCHANDLE;");
foreach (var s in assemblies) {
if (!s.IsAOTCompiled)
Expand Down Expand Up @@ -724,6 +724,8 @@ void GenerateIOSMain (StringWriter sw, Abi abi)
}
} else if (app.XamarinRuntime == XamarinRuntime.NativeAOT) {
// don't call mono_jit_set_aot_mode
} else if (app.XamarinRuntime == XamarinRuntime.CoreCLR) {
// don't call mono_jit_set_aot_mode
} else if (app.IsDeviceBuild) {
sw.WriteLine ("\tmono_jit_set_aot_mode (MONO_AOT_MODE_FULL);");
} else if (app.Platform == ApplePlatform.MacCatalyst && ((abi & Abi.ARM64) == Abi.ARM64)) {
Expand Down
11 changes: 11 additions & 0 deletions tools/mtouch/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ define RunRegistrar

.libs/Microsoft.$(9).registrar.$(10).a: .libs/Microsoft.$(9).registrar.$(10).m .libs/Microsoft.$(9).registrar.$(10).h | .libs
$$(Q_CC) $$(CLANG) -DDEBUG -g -gdwarf-2 $(6) -stdlib=libc++ -std=c++14 -x objective-c++ -o $$@ -c $$< -Wall -Wno-unguarded-availability-new -I$(TOP)/runtime

.libs/Microsoft.$(9).registrar.coreclr.$(10)%m .libs/Microsoft.$(9).registrar.coreclr.$(10)%h: $(TOP)/src/build/dotnet/$(1)/$(3)/Microsoft.$(9).dll $(LOCAL_MTOUCH) | .libs
$$(Q_GEN) $$(LOCAL_MTOUCH_COMMAND) $$(MTOUCH_VERBOSITY) --runregistrar:$$(abspath $$(basename $$@).m) --sdkroot $$(XCODE_DEVELOPER_ROOT) --sdk $(4) $$< --registrar:static --target-framework .NETCoreApp,Version=$(subst net,,$(DOTNET_TFM)),Profile=$(1) --abi $(2) --reference:$(DOTNET_BCL_DIR)/System.Runtime.dll --reference:$(DOTNET_BCL_DIR)/System.Runtime.InteropServices.dll --rid $(10) --xamarin-runtime CoreCLR
$$(Q) touch $$(basename $$@).m $$(basename $$@).h

.libs/Microsoft.$(9).registrar.coreclr.$(10).a: .libs/Microsoft.$(9).registrar.coreclr.$(10).m .libs/Microsoft.$(9).registrar.$(10).h | .libs
$$(Q_CC) $$(CLANG) -DDEBUG -g -gdwarf-2 $(6) -stdlib=libc++ -std=c++14 -x objective-c++ -o $$@ -c $$< -Wall -Wno-unguarded-availability-new -I$(TOP)/runtime
endef
$(eval $(call RunRegistrar,ios,x86_64,64,$(IOS_SDK_VERSION),iOS,$(iossimulator-x64_CFLAGS),,,iOS,iossimulator-x64))
$(eval $(call RunRegistrar,ios,arm64,64,$(IOS_SDK_VERSION),iOS,$(iossimulator-arm64_CFLAGS),,,iOS,iossimulator-arm64))
Expand All @@ -52,6 +59,7 @@ $(eval $(call RunRegistrar,maccatalyst,arm64,64,$(MACCATALYST_SDK_VERSION),MacCa

TARGETS_DOTNET = \
$(foreach platform,$(DOTNET_PLATFORMS_MTOUCH),$(foreach rid,$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS),$(DOTNET_DESTDIR)/$($(rid)_NUGET_RUNTIME_NAME)/runtimes/$(rid)/native/Microsoft.$(platform).registrar.a)) \
$(foreach platform,$(DOTNET_PLATFORMS_MTOUCH),$(foreach rid,$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS),$(DOTNET_DESTDIR)/$($(rid)_NUGET_RUNTIME_NAME)/runtimes/$(rid)/native/Microsoft.$(platform).registrar.coreclr.a)) \

TARGET_DIRS_DOTNET = \
$(foreach platform,$(DOTNET_PLATFORMS_MTOUCH),$(foreach rid,$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS),$(DOTNET_DESTDIR)/$($(rid)_NUGET_RUNTIME_NAME)/runtimes/$(rid)/native)) \
Expand All @@ -67,6 +75,9 @@ $(TARGET_DIRS):
define InstallRegistrar
$(DOTNET_DESTDIR)/$$($(2)_NUGET_RUNTIME_NAME)/runtimes/$(2)/native/Microsoft.$(1).registrar.a: .libs/Microsoft.$(1).registrar.$(rid).a | $(DOTNET_DESTDIR)/$($(2)_NUGET_RUNTIME_NAME)/runtimes/$(2)/native
$(Q) $(CP) $$< $$@

$(DOTNET_DESTDIR)/$$($(2)_NUGET_RUNTIME_NAME)/runtimes/$(2)/native/Microsoft.$(1).registrar.coreclr.a: .libs/Microsoft.$(1).registrar.coreclr.$(rid).a | $(DOTNET_DESTDIR)/$($(2)_NUGET_RUNTIME_NAME)/runtimes/$(2)/native
$(Q) $(CP) $$< $$@
endef

$(foreach platform,$(DOTNET_PLATFORMS_MTOUCH),$(foreach rid,$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS),$(eval $(call InstallRegistrar,$(platform),$(rid)))))
Expand Down
Loading