فهرست منبع

add ios ios binding

jaelys 4 سال پیش
والد
کامیت
b43f72fcd2

+ 66 - 0
iOSBindingOpenCV/ApiDefinition.cs

@@ -0,0 +1,66 @@
+using System;
+
+using ObjCRuntime;
+using Foundation;
+using UIKit;
+
+namespace NativeLibrary
+{
+    // The first step to creating a binding is to add your native library ("libNativeLibrary.a")
+    // to the project by right-clicking (or Control-clicking) the folder containing this source
+    // file and clicking "Add files..." and then simply select the native library (or libraries)
+    // that you want to bind.
+    //
+    // When you do that, you'll notice that MonoDevelop generates a code-behind file for each
+    // native library which will contain a [LinkWith] attribute. VisualStudio auto-detects the
+    // architectures that the native library supports and fills in that information for you,
+    // however, it cannot auto-detect any Frameworks or other system libraries that the
+    // native library may depend on, so you'll need to fill in that information yourself.
+    //
+    // Once you've done that, you're ready to move on to binding the API...
+    //
+    //
+    // Here is where you'd define your API definition for the native Objective-C library.
+    //
+    // For example, to bind the following Objective-C class:
+    //
+    //     @interface Widget : NSObject {
+    //     }
+    //
+    // The C# binding would look like this:
+    //
+    //     [BaseType (typeof (NSObject))]
+    //     interface Widget {
+    //     }
+    //
+    // To bind Objective-C properties, such as:
+    //
+    //     @property (nonatomic, readwrite, assign) CGPoint center;
+    //
+    // You would add a property definition in the C# interface like so:
+    //
+    //     [Export ("center")]
+    //     CGPoint Center { get; set; }
+    //
+    // To bind an Objective-C method, such as:
+    //
+    //     -(void) doSomething:(NSObject *)object atIndex:(NSInteger)index;
+    //
+    // You would add a method definition to the C# interface like so:
+    //
+    //     [Export ("doSomething:atIndex:")]
+    //     void DoSomething (NSObject object, int index);
+    //
+    // Objective-C "constructors" such as:
+    //
+    //     -(id)initWithElmo:(ElmoMuppet *)elmo;
+    //
+    // Can be bound as:
+    //
+    //     [Export ("initWithElmo:")]
+    //     IntPtr Constructor (ElmoMuppet elmo);
+    //
+    // For more information, see https://aka.ms/ios-binding
+    //
+}
+

+ 34 - 0
iOSBindingOpenCV/Properties/AssemblyInfo.cs

@@ -0,0 +1,34 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+using Foundation;
+
+// This attribute allows you to mark your assemblies as “safe to link”.
+// When the attribute is present, the linker—if enabled—will process the assembly
+// even if you’re using the “Link SDK assemblies only” option, which is the default for device builds.
+
+[assembly: LinkerSafe]
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("NativeLibrary")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("NativeLibrary")]
+[assembly: AssemblyCopyright("Copyright ©  2017")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]

+ 6 - 0
iOSBindingOpenCV/Structs.cs

@@ -0,0 +1,6 @@
+using System;
+
+namespace NativeLibrary
+{
+}
+

+ 50 - 0
iOSBindingOpenCV/iOSBindingOpenCV.csproj

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectTypeGuids>{8FFB629D-F513-41CE-95D2-7ECE97B6EEEC};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <ProjectGuid>{40EDE8CD-C879-4D0B-834F-CCE8AF4F23A7}</ProjectGuid>
+    <TemplateGuid>{b6f3ff35-79b2-4f25-a2fc-60a7cf61013b}</TemplateGuid>
+    <OutputType>Library</OutputType>
+    <RootNamespace>NativeLibrary</RootNamespace>
+    <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
+    <AssemblyName>NativeLibrary</AssemblyName>
+    <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug</OutputPath>
+    <DefineConstants>DEBUG;</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>full</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release</OutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="Xamarin.iOS" />
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Resources\" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ObjcBindingApiDefinition Include="ApiDefinition.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ObjcBindingCoreSource Include="Structs.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.ObjCBinding.CSharp.targets" />
+</Project>