Commit 50c84ec7 authored by Martin Finkel's avatar Martin Finkel

Add Unity AOT support (IL2CPP)

Close videolan/LibVLCSharp#51
parent 5e8d54a7
......@@ -48,6 +48,10 @@ Features:
<TargetFramework>netstandard2.0</TargetFramework>
<DefineConstants>$(DefineConstants);UNITY_ANDROID</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(UNITY_ANDROID_AOT)=='true'">
<TargetFramework>netstandard2.0</TargetFramework>
<DefineConstants>$(DefineConstants);UNITY_ANDROID;UNITY_AOT</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(NETSTANDARD_ONLY)=='true'">
<TargetFrameworks>netstandard2.0;netstandard1.1</TargetFrameworks>
</PropertyGroup>
......
......@@ -73,7 +73,7 @@ namespace LibVLCSharp.Shared
}
}
#if IOS
#if IOS || UNITY_AOT
internal protected static LibVLCEvent RetrieveEvent(IntPtr eventPtr) => MarshalUtils.PtrToStructure<LibVLCEvent>(eventPtr);
#else
internal protected LibVLCEvent RetrieveEvent(IntPtr eventPtr) => MarshalUtils.PtrToStructure<LibVLCEvent>(eventPtr);
......
......@@ -6,7 +6,7 @@ namespace LibVLCSharp.Shared
internal class MediaDiscovererEventManager : EventManager
{
readonly object _lock = new object();
#if IOS
#if IOS || UNITY_AOT
static EventHandler<EventArgs> _mediaDiscovererStarted;
static EventHandler<EventArgs> _mediaDiscovererStopped;
#else
......@@ -74,7 +74,7 @@ namespace LibVLCSharp.Shared
}
}
#if IOS
#if IOS || UNITY_AOT
[MonoPInvokeCallback(typeof(EventCallback))]
static void OnStarted(IntPtr ptr)
{
......
......@@ -6,7 +6,7 @@ namespace LibVLCSharp.Shared
internal class MediaEventManager : EventManager
{
readonly object _lock = new object();
#if IOS
#if IOS || UNITY_AOT
static EventHandler<MediaMetaChangedEventArgs> _mediaMetaChanged;
static EventHandler<MediaParsedChangedEventArgs> _mediaParsedChanged;
static EventHandler<MediaSubItemAddedEventArgs> _mediaSubItemAdded;
......@@ -154,7 +154,7 @@ namespace LibVLCSharp.Shared
}
}
#if IOS
#if IOS || UNITY_AOT
[MonoPInvokeCallback(typeof(EventCallback))]
static void OnSubItemTreeAdded(IntPtr ptr)
{
......
......@@ -6,7 +6,7 @@ namespace LibVLCSharp.Shared
internal class MediaListEventManager : EventManager
{
readonly object _lock = new object();
#if IOS
#if IOS || UNITY_AOT
static EventHandler<MediaListItemAddedEventArgs> _mediaListItemAdded;
static EventHandler<MediaListWillAddItemEventArgs> _mediaListWillAddItem;
static EventHandler<MediaListItemDeletedEventArgs> _mediaListItemDeleted;
......@@ -123,7 +123,7 @@ namespace LibVLCSharp.Shared
}
}
#if IOS
#if IOS || UNITY_AOT
[MonoPInvokeCallback(typeof(EventCallback))]
static void OnItemAdded(IntPtr ptr)
{
......
......@@ -6,7 +6,7 @@ namespace LibVLCSharp.Shared
internal class MediaPlayerEventManager : EventManager
{
readonly object _lock = new object();
#if IOS
#if IOS || UNITY_AOT
static EventHandler<MediaPlayerMediaChangedEventArgs> _mediaPlayerMediaChanged;
static EventHandler<EventArgs> _mediaPlayerNothingSpecial;
static EventHandler<EventArgs> _mediaPlayerOpening;
......@@ -520,8 +520,8 @@ namespace LibVLCSharp.Shared
}
}
}
#if IOS
#if IOS || UNITY_AOT
[MonoPInvokeCallback(typeof(EventCallback))]
static void OnMediaChanged(IntPtr ptr)
{
......
......@@ -6,7 +6,7 @@ namespace LibVLCSharp.Shared
internal class RendererDiscovererEventManager : EventManager
{
readonly object _lock = new object();
#if IOS
#if IOS || UNITY_AOT
static EventHandler<RendererDiscovererItemAddedEventArgs> _itemAdded;
static EventHandler<RendererDiscovererItemDeletedEventArgs> _itemDeleted;
#else
......@@ -74,7 +74,7 @@ namespace LibVLCSharp.Shared
}
}
#if IOS
#if IOS || UNITY_AOT
[MonoPInvokeCallback(typeof(EventCallback))]
static void OnItemDeleted(IntPtr args)
{
......
#!/bin/bash
dotnet build ../LibVLCSharp/LibVLCSharp.csproj /p:UNITY_ANDROID_AOT=true -f netstandard2.0 -c Release
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment