-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Emgu.TF.Lite.runtime.macos project
- Loading branch information
Showing
5 changed files
with
163 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
namespace Emgu.TF.Lite.Platform.Maui.iOS | ||
{ | ||
|
||
// The first step to creating a binding is to add your native framework ("MyLibrary.xcframework") | ||
// to the project. | ||
// Open your binding csproj and add a section like this | ||
// <ItemGroup> | ||
// <NativeReference Include="MyLibrary.xcframework"> | ||
// <Kind>Framework</Kind> | ||
// <Frameworks></Frameworks> | ||
// </NativeReference> | ||
// </ItemGroup> | ||
// | ||
// Once you've added it, you will need to customize it for your specific library: | ||
// - Change the Include to the correct path/name of your library | ||
// - Change Kind to Static (.a) or Framework (.framework/.xcframework) based upon the library kind and extension. | ||
// - Dynamic (.dylib) is a third option but rarely if ever valid, and only on macOS and Mac Catalyst | ||
// - If your library depends on other frameworks, add them inside <Frameworks></Frameworks> | ||
// Example: | ||
// <NativeReference Include="libs\MyTestFramework.xcframework"> | ||
// <Kind>Framework</Kind> | ||
// <Frameworks>CoreLocation ModelIO</Frameworks> | ||
// </NativeReference> | ||
// | ||
// 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, nint index); | ||
// | ||
// Objective-C "constructors" such as: | ||
// | ||
// -(id)initWithElmo:(ElmoMuppet *)elmo; | ||
// | ||
// Can be bound as: | ||
// | ||
// [Export ("initWithElmo:")] | ||
// NativeHandle Constructor (ElmoMuppet elmo); | ||
// | ||
// For more information, see https://aka.ms/ios-binding | ||
// | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# -------------------------------------------------------- | ||
# Copyright (C) 2004-2024 by EMGU Corporation. All rights reserved. | ||
# -------------------------------------------------------- | ||
|
||
IF(HAVE_MAUI_MAC_LITE) | ||
|
||
INSTALL( | ||
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
DESTINATION Emgu.TF.Runtime/Maui | ||
COMPONENT emgutf_source | ||
FILES_MATCHING | ||
PATTERN "*.csproj" | ||
PATTERN "*.cs" | ||
PATTERN "Directory.Build.props" | ||
PATTERN "README.md" | ||
PATTERN ".svn" EXCLUDE | ||
PATTERN "obj" EXCLUDE | ||
PATTERN "CMakeFiles" EXCLUDE | ||
PATTERN "${PROJECT_NAME}.dir" EXCLUDE | ||
) | ||
|
||
IF (APPLE) | ||
PROJECT(Emgu.TF.Lite.runtime.maui.macos) | ||
SET(EXTRA_BUILD_FLAGS "/p:Platform=\"AnyCPU\"") | ||
BUILD_DOTNET_PROJ(${PROJECT_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.csproj" "${EXTRA_BUILD_FLAGS}" ALL) | ||
|
||
ADD_DEPENDENCIES(${PROJECT_NAME} Emgu.TF.Lite) | ||
if(ENABLE_SOLUTION_FOLDERS) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER "emgu") | ||
endif() | ||
ENDIF() | ||
|
||
INSTALL( | ||
DIRECTORY | ||
${LIBRARY_OUTPUT_PATH}/Build/Emgu.TF.Lite.runtime.maui.macos | ||
DESTINATION ${CPACK_PACKAGE_CLI_FOLDER} | ||
COMPONENT emgutf_binary) | ||
|
||
ENDIF() |
50 changes: 50 additions & 0 deletions
50
Emgu.TF.Runtime/Maui/Mac/Emgu.TF.Lite.runtime.maui.macos.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net9.0-maccatalyst</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>true</ImplicitUsings> | ||
<IsBindingProject>true</IsBindingProject> | ||
<AssemblyName>Emgu.TF.Lite.runtime.maui.macos</AssemblyName> | ||
<GenerateDocumentationFile>True</GenerateDocumentationFile> | ||
<TfLiteBinaryDir>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\..\..\lib))</TfLiteBinaryDir> | ||
<EmguTfLiteCatalystBinaryDir>$(TfLiteBinaryDir)\ios</EmguTfLiteCatalystBinaryDir> | ||
<EmguTfLiteCatalystNativeFileX64>$(EmguTfLiteCatalystBinaryDir)\libtfliteextern_darwin_x86_64.a</EmguTfLiteCatalystNativeFileX64> | ||
<EmguTfLiteCatalystNativeFileARM64>$(EmguTfLiteCatalystBinaryDir)\libtfliteextern_darwin_arm64.a</EmguTfLiteCatalystNativeFileARM64> | ||
<EmguTfLiteLinkTarget>MAUI MacCatalyst Library</EmguTfLiteLinkTarget> | ||
<EmguTfLiteMauiMacErrorMessage Condition="!Exists('$(EmguTfLiteCatalystNativeFileX64)')">This package do not contains necessary binary for $(EmguTfLiteLinkTarget). Emgu TF for MacOS Commercial license is required, Mac Catalyst x86_64 is targeted, but file $(EmguTfLiteCatalystNativeFileX64) is missing.</EmguTfLiteMauiMacErrorMessage> | ||
<EmguTfLiteMauiMacErrorMessage Condition="!Exists('$(EmguTfLiteCatalystNativeFileARM64)')">This package do not contains necessary binary for $(EmguTfLiteLinkTarget). Emgu TF for MacOS Commercial license is required, Mac Catalyst ARM64 is targeted, but file $(EmguTfLiteCatalystNativeFileARM64) is missing.</EmguTfLiteMauiMacErrorMessage> | ||
<BaseOutputPath>$(TfLiteBinaryDir)\Build\$(AssemblyName)\$(Platform)\</BaseOutputPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ObjcBindingApiDefinition Include="ApiDefinition.cs" /> | ||
<ObjcBindingCoreSource Include="StructsAndEnums.cs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="Exists('$(EmguTfLiteCatalystNativeFileX64)')"> | ||
<NativeReference Include="$(EmguTfLiteCatalystNativeFileX64)"> | ||
<Kind>Static</Kind> | ||
<SmartLink>True</SmartLink> | ||
<ForceLoad>True</ForceLoad> | ||
<IsCxx>True</IsCxx> | ||
<LinkerFlags>-stdlib=libc++ -ObjC -lc++</LinkerFlags> | ||
<Frameworks>Foundation Accelerate CoreFoundation CoreGraphics AssetsLibrary AVFoundation CoreImage CoreMedia CoreVideo QuartzCore ImageIO UIKit CoreText</Frameworks> | ||
</NativeReference> | ||
</ItemGroup> | ||
<ItemGroup Condition="Exists('$(EmguTfLiteCatalystNativeFileARM64)')"> | ||
<NativeReference Include="$(EmguTfLiteCatalystNativeFileARM64)"> | ||
<Kind>Static</Kind> | ||
<SmartLink>True</SmartLink> | ||
<ForceLoad>True</ForceLoad> | ||
<IsCxx>True</IsCxx> | ||
<LinkerFlags>-stdlib=libc++ -ObjC -lc++</LinkerFlags> | ||
<Frameworks>Foundation Accelerate CoreFoundation CoreGraphics AssetsLibrary AVFoundation CoreImage CoreMedia CoreVideo QuartzCore ImageIO UIKit CoreText</Frameworks> | ||
</NativeReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\Emgu.TF.Lite\NetStandard\Emgu.TF.Lite.csproj" /> | ||
</ItemGroup> | ||
<Target Name="DeployBinary" AfterTargets="AfterBuild"> | ||
<Warning Text="'$(EmguTfLiteMauiMacErrorMessage)'" Condition="'$(EmguTfLiteMauiMacErrorMessage)'!=''" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace Emgu.TF.Lite.Platform.Maui.iOS | ||
{ | ||
|
||
} |
This file was deleted.
Oops, something went wrong.