diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 5b84f6753..a8ac7166b 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -527,19 +527,17 @@ jobs: if-no-files-found: error compile-android: - # Disable android build - if: false - + name: Compile (Android) strategy: fail-fast: true matrix: include: - build: 'x86' - defines: '-DANDROID_ABI=x86' + defines: '-DANDROID_ABI=x86 -DCMAKE_C_FLAGS=-march=i686 -DCMAKE_CXX_FLAGS=-march=i686' - build: 'x86_64' - defines: '-DANDROID_ABI=x86_64' + defines: '-DANDROID_ABI=x86_64 -DCMAKE_C_FLAGS=-march=x86-64 -DCMAKE_CXX_FLAGS=-march=x86-64' - build: 'arm64-v8a' - defines: '-DANDROID_ABI=arm64-v8a' + defines: '-DANDROID_ABI=arm64-v8a -DCMAKE_C_FLAGS=-march=armv8.7a -DCMAKE_C_FLAGS=-march=armv8.7a' runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 @@ -555,28 +553,39 @@ jobs: - name: Build id: cmake_build env: - CMAKE_FLAGS: '-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-23' + CMAKE_FLAGS: '-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-23 -DGGML_OPENMP=OFF -DGGML_LLAMAFILE=OFF' run: | - mkdir build - cd build - cmake .. ${{ env.COMMON_DEFINE }} ${{ env.CMAKE_FLAGS }} ${{ matrix.defines }} - cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS} - cd .. - ls -R + # export-lora not supported on 32 bit machines hence breaks x86 build + sed -i '/add_subdirectory(export-lora)/d' examples/CMakeLists.txt # remove export-lora from examples + cmake ${{ env.COMMON_DEFINE }} ${{ env.CMAKE_FLAGS }} ${{ matrix.defines }} -B build + cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS} - name: Upload Llama uses: actions/upload-artifact@v4 with: - path: ./build/src/libllama.so + path: ./build/bin/libllama.so name: llama-bin-android-${{ matrix.build }}.so - - uses: actions/upload-artifact@v4 + - name: Upload GGML + uses: actions/upload-artifact@v4 with: - path: ./build/ggml/src/libggml.so + path: ./build/bin/libggml.so name: ggml-bin-android-${{ matrix.build }}.so if-no-files-found: error + - name: Upload GGML Base + uses: actions/upload-artifact@v4 + with: + path: ./build/bin/libggml-base.so + name: ggml-base-bin-android-${{ matrix.build }}.so + if-no-files-found: error + - name: Upload GGML CPU + uses: actions/upload-artifact@v4 + with: + path: ./build/bin/libggml-cpu.so + name: ggml-cpu-bin-android-${{ matrix.build }}.so + if-no-files-found: error - name: Upload Llava uses: actions/upload-artifact@v4 with: - path: ./build/examples/llava/libllava_shared.so + path: ./build/bin/libllava_shared.so name: llava-bin-android-${{ matrix.build }}.so build-deps: @@ -703,17 +712,23 @@ jobs: cp artifacts/llava-bin-osx-x64-rosetta2.dylib/libllava_shared.dylib deps/osx-x64-rosetta2/libllava_shared.dylib # Android - #cp artifacts/ggml-bin-android-arm64-v8a.so/libggml.so deps/android-arm64-v8a/libggml.so - #cp artifacts/llama-bin-android-arm64-v8a.so/libllama.so deps/android-arm64-v8a/libllama.so - #cp artifacts/llava-bin-android-arm64-v8a.so/libllava_shared.so deps/android-arm64-v8a/libllava_shared.so - - #cp artifacts/ggml-bin-android-x86.so/libggml.so deps/android-x86/libggml.so - #cp artifacts/llama-bin-android-x86.so/libllama.so deps/android-x86/libllama.so - #cp artifacts/llava-bin-android-x86.so/libllava_shared.so deps/android-x86/libllava_shared.so - - #cp artifacts/ggml-bin-android-x86_64.so/libggml.so deps/android-x86_64/libggml.so - #cp artifacts/llama-bin-android-x86_64.so/libllama.so deps/android-x86_64/libllama.so - #cp artifacts/llava-bin-android-x86_64.so/libllava_shared.so deps/android-x86_64/libllava_shared.so + cp artifacts/ggml-bin-android-arm64-v8a.so/libggml.so deps/android-arm64-v8a/libggml.so + cp artifacts/ggml-base-bin-android-arm64-v8a.so/libggml-base.so deps/android-arm64-v8a/libggml-base.so + cp artifacts/ggml-cpu-bin-android-arm64-v8a.so/libggml-cpu.so deps/android-arm64-v8a/libggml-cpu.so + cp artifacts/llama-bin-android-arm64-v8a.so/libllama.so deps/android-arm64-v8a/libllama.so + cp artifacts/llava-bin-android-arm64-v8a.so/libllava_shared.so deps/android-arm64-v8a/libllava_shared.so + + cp artifacts/ggml-bin-android-x86.so/libggml.so deps/android-x86/libggml.so + cp artifacts/ggml-base-bin-android-x86.so/libggml-base.so deps/android-x86/libggml-base.so + cp artifacts/ggml-cpu-bin-android-x86.so/libggml-cpu.so deps/android-x86/libggml-cpu.so + cp artifacts/llama-bin-android-x86.so/libllama.so deps/android-x86/libllama.so + cp artifacts/llava-bin-android-x86.so/libllava_shared.so deps/android-x86/libllava_shared.so + + cp artifacts/ggml-bin-android-x86_64.so/libggml.so deps/android-x86_64/libggml.so + cp artifacts/ggml-base-bin-android-x86_64.so/libggml-base.so deps/android-x86_64/libggml-base.so + cp artifacts/ggml-cpu-bin-android-x86_64.so/libggml-cpu.so deps/android-x86_64/libggml-cpu.so + cp artifacts/llama-bin-android-x86_64.so/libllama.so deps/android-x86_64/libllama.so + cp artifacts/llava-bin-android-x86_64.so/libllava_shared.so deps/android-x86_64/libllava_shared.so # Windows CUDA cp artifacts/ggml-bin-win-cublas-cu11.7.1-x64.dll/ggml.dll deps/cu11.7.1/ggml.dll diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8aa198549..859aee28c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,6 +38,10 @@ jobs: with: dotnet-version: | 8.0.x + - name: Install Mobile Workloads + run: | + dotnet workload install android --ignore-failed-sources + dotnet workload install maui --ignore-failed-sources - name: Cache Packages uses: actions/cache@v4 with: diff --git a/.gitignore b/.gitignore index 056ba6163..206b0dac1 100644 --- a/.gitignore +++ b/.gitignore @@ -337,7 +337,6 @@ test/TensorFlowNET.Examples/mnist # training model resources .resources /redist -*.xml *.xsd # docs diff --git a/LLama/LLamaSharp.Runtime.targets b/LLama/LLamaSharp.Runtime.targets index 22a3e04e1..74e8fafa2 100644 --- a/LLama/LLamaSharp.Runtime.targets +++ b/LLama/LLamaSharp.Runtime.targets @@ -466,4 +466,94 @@ runtimes/linux-x64/native/vulkan/libllava_shared.so + + + + + runtimes/android-x86/native/libllama.so + x86 + + + runtimes/android-x86/native/libggml.so + x86 + + + runtimes/android-x86/native/libggml-base.so + x86 + + + runtimes/android-x86/native/libggml-cpu.so + x86 + + + runtimes/android-x86/native/libllava_shared.so + x86 + + + + + + lib/x86_64/libllama.so + x86_64 + + + lib/x86_64/libggml.so + x86_64 + + + lib/x86_64/libggml-base.so + x86_64 + + + lib/x86_64/libggml-cpu.so + x86_64 + + + lib/x86_64/libllava_shared.so + x86_64 + + + + + + lib/arm64-v8a/libllama.so + arm64-v8a + + + lib/arm64-v8a/libggml.so + arm64-v8a + + + lib/arm64-v8a/libggml-base.so + arm64-v8a + + + lib/arm64-v8a/libggml-cpu.so + arm64-v8a + + + lib/arm64-v8a/libllava_shared.so + arm64-v8a + + + + \ No newline at end of file diff --git a/LLama/Native/NativeApi.Load.cs b/LLama/Native/NativeApi.Load.cs index 5ad30d032..2d5be063f 100644 --- a/LLama/Native/NativeApi.Load.cs +++ b/LLama/Native/NativeApi.Load.cs @@ -53,6 +53,12 @@ private static void SetDllImportResolver() // NativeLibrary is not available on older runtimes. We'll have to depend on // the normal runtime dll resolution there. #if NET5_0_OR_GREATER + if (OperatingSystem.IsAndroid()) + { + // Android doesn't support DllImportResolver, so we have to rely on the default search path + return; + } + NativeLibrary.SetDllImportResolver(typeof(NativeApi).Assembly, (name, _, _) => { if (name == "llama") diff --git a/LLama/runtimes/build/LLamaSharp.Backend.Cpu.Android.nuspec b/LLama/runtimes/build/LLamaSharp.Backend.Cpu.Android.nuspec new file mode 100644 index 000000000..0d45b1492 --- /dev/null +++ b/LLama/runtimes/build/LLamaSharp.Backend.Cpu.Android.nuspec @@ -0,0 +1,41 @@ + + + + LLamaSharp.Backend.Cpu.Android + $version$ + LLamaSharp.Backend.Cpu.Android, the backend for LLamaSharp + llama.cpp Authors + false + MIT + icon512.png + https://github.com/SciSharp/LLamaSharp + LLamaSharp.Backend.Cpu.Android is a backend for LLamaSharp to use with Android Cpu only. + + Copyright 2023 The llama.cpp Authors. All rights reserved. + LLamaSharp LLama LLM GPT AI ChatBot SciSharp + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LLama/runtimes/build/LLamaSharp.Backend.Cpu.nuspec b/LLama/runtimes/build/LLamaSharp.Backend.Cpu.nuspec index 7c69534da..1f69b97ab 100644 --- a/LLama/runtimes/build/LLamaSharp.Backend.Cpu.nuspec +++ b/LLama/runtimes/build/LLamaSharp.Backend.Cpu.nuspec @@ -1,46 +1,46 @@ - - LLamaSharp.Backend.Cpu - $version$ - LLamaSharp.Backend.Cpu, the backend for LLamaSharp - llama.cpp Authors - false - MIT - icon512.png - https://github.com/SciSharp/LLamaSharp - LLamaSharp.Backend.Cpu is a backend for LLamaSharp to use with Cpu only. - - Copyright 2023 The llama.cpp Authors. All rights reserved. - LLamaSharp LLama LLM GPT AI ChatBot SciSharp - + + LLamaSharp.Backend.Cpu + $version$ + LLamaSharp.Backend.Cpu, the backend for LLamaSharp + llama.cpp Authors + false + MIT + icon512.png + https://github.com/SciSharp/LLamaSharp + LLamaSharp.Backend.Cpu is a backend for LLamaSharp to use with Cpu only. + + Copyright 2023 The llama.cpp Authors. All rights reserved. + LLamaSharp LLama LLM GPT AI ChatBot SciSharp + - - + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -97,22 +97,22 @@ - - - - - - + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/LLama/runtimes/build/LLamaSharpBackend.props b/LLama/runtimes/build/LLamaSharpBackend.props index 422969d88..006b4dabc 100644 --- a/LLama/runtimes/build/LLamaSharpBackend.props +++ b/LLama/runtimes/build/LLamaSharpBackend.props @@ -14,4 +14,93 @@ + + + + runtimes\android-x86\native\libllama.so + x86 + + + runtimes\android-x86\native\libggml.so + x86 + + + runtimes\android-x86\native\libggml-base.so + x86 + + + runtimes\android-x86\native\libggml-cpu.so + x86 + + + runtimes\android-x86\native\libllava_shared.so + x86 + + + + + + lib\x86_64\libllama.so + x86_64 + + + lib\x86_64\libggml.so + x86_64 + + + lib\x86_64\libggml-base.so + x86_64 + + + lib\x86_64\libggml-cpu.so + x86_64 + + + lib\x86_64\libllava_shared.so + x86_64 + + + + + + lib\arm64-v8a\libllama.so + arm64-v8a + + + lib\arm64-v8a\libggml.so + arm64-v8a + + + lib\arm64-v8a\libggml-base.so + arm64-v8a + + + lib\arm64-v8a\libggml-cpu.so + arm64-v8a + + + lib\arm64-v8a\libllava_shared.so + arm64-v8a + + + + diff --git a/LLamaSharp.sln b/LLamaSharp.sln index 7c970aa99..6c0bc6133 100644 --- a/LLamaSharp.sln +++ b/LLamaSharp.sln @@ -21,6 +21,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LLama.Experimental", "LLama EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LLama.Benchmark", "LLama.Benchmark\LLama.Benchmark.csproj", "{90D38FEE-68EA-459E-A4EE-268B9DFA1CD5}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Llama.Mobile", "Llama.Mobile\Llama.Mobile.csproj", "{B7B3AAFA-025A-4656-A03A-E364800D5ACB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -196,6 +198,33 @@ Global {90D38FEE-68EA-459E-A4EE-268B9DFA1CD5}.Release|Arm64.Build.0 = Release|Any CPU {90D38FEE-68EA-459E-A4EE-268B9DFA1CD5}.Release|x64.ActiveCfg = Release|Any CPU {90D38FEE-68EA-459E-A4EE-268B9DFA1CD5}.Release|x64.Build.0 = Release|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Debug|Arm64.ActiveCfg = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Debug|Arm64.Build.0 = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Debug|Arm64.Deploy.0 = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Debug|x64.ActiveCfg = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Debug|x64.Build.0 = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Debug|x64.Deploy.0 = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.GPU|Any CPU.ActiveCfg = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.GPU|Any CPU.Build.0 = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.GPU|Any CPU.Deploy.0 = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.GPU|Arm64.ActiveCfg = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.GPU|Arm64.Build.0 = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.GPU|Arm64.Deploy.0 = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.GPU|x64.ActiveCfg = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.GPU|x64.Build.0 = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.GPU|x64.Deploy.0 = Debug|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Release|Any CPU.Build.0 = Release|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Release|Any CPU.Deploy.0 = Release|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Release|Arm64.ActiveCfg = Release|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Release|Arm64.Build.0 = Release|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Release|Arm64.Deploy.0 = Release|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Release|x64.ActiveCfg = Release|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Release|x64.Build.0 = Release|Any CPU + {B7B3AAFA-025A-4656-A03A-E364800D5ACB}.Release|x64.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Llama.Mobile/App.xaml b/Llama.Mobile/App.xaml new file mode 100644 index 000000000..e5b403011 --- /dev/null +++ b/Llama.Mobile/App.xaml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/Llama.Mobile/App.xaml.cs b/Llama.Mobile/App.xaml.cs new file mode 100644 index 000000000..c2db0b0b9 --- /dev/null +++ b/Llama.Mobile/App.xaml.cs @@ -0,0 +1,12 @@ +namespace Llama.Mobile +{ + public partial class App : Application + { + public App() + { + InitializeComponent(); + + MainPage = new AppShell(); + } + } +} diff --git a/Llama.Mobile/AppShell.xaml b/Llama.Mobile/AppShell.xaml new file mode 100644 index 000000000..65ae2f591 --- /dev/null +++ b/Llama.Mobile/AppShell.xaml @@ -0,0 +1,15 @@ + + + + + + diff --git a/Llama.Mobile/AppShell.xaml.cs b/Llama.Mobile/AppShell.xaml.cs new file mode 100644 index 000000000..33f40ba5c --- /dev/null +++ b/Llama.Mobile/AppShell.xaml.cs @@ -0,0 +1,10 @@ +namespace Llama.Mobile +{ + public partial class AppShell : Shell + { + public AppShell() + { + InitializeComponent(); + } + } +} diff --git a/Llama.Mobile/Llama.Mobile.csproj b/Llama.Mobile/Llama.Mobile.csproj new file mode 100644 index 000000000..085f1ed2e --- /dev/null +++ b/Llama.Mobile/Llama.Mobile.csproj @@ -0,0 +1,71 @@ + + + + net8.0-android + + + + + + + + + + Exe + Llama.Mobile + true + true + enable + enable + + + Llama.Mobile + + + com.llama.mobile + + + 1.0 + 1 + + 11.0 + 13.1 + 21.0 + 10.0.17763.0 + 10.0.17763.0 + 6.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Llama.Mobile/MainPage.xaml b/Llama.Mobile/MainPage.xaml new file mode 100644 index 000000000..5bd8e7e94 --- /dev/null +++ b/Llama.Mobile/MainPage.xaml @@ -0,0 +1,14 @@ + + + + \ No newline at end of file diff --git a/Llama.Mobile/MainPage.xaml.cs b/Llama.Mobile/MainPage.xaml.cs new file mode 100644 index 000000000..8c9cb310c --- /dev/null +++ b/Llama.Mobile/MainPage.xaml.cs @@ -0,0 +1,16 @@ +namespace Llama.Mobile; + +using LLama.Native; + +public partial class MainPage : ContentPage +{ + public MainPage() + { + InitializeComponent(); + + //Load the native library + NativeApi.llama_empty_call(); + + label1.Text = "llama.cpp loaded successfully"; + } +} diff --git a/Llama.Mobile/MauiProgram.cs b/Llama.Mobile/MauiProgram.cs new file mode 100644 index 000000000..fe17dcd27 --- /dev/null +++ b/Llama.Mobile/MauiProgram.cs @@ -0,0 +1,25 @@ +using Microsoft.Extensions.Logging; + +namespace Llama.Mobile +{ + public static class MauiProgram + { + public static MauiApp CreateMauiApp() + { + var builder = MauiApp.CreateBuilder(); + builder + .UseMauiApp() + .ConfigureFonts(fonts => + { + fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); + fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); + }); + +#if DEBUG + builder.Logging.AddDebug(); +#endif + + return builder.Build(); + } + } +} diff --git a/Llama.Mobile/Platforms/Android/AndroidManifest.xml b/Llama.Mobile/Platforms/Android/AndroidManifest.xml new file mode 100644 index 000000000..e9937ad77 --- /dev/null +++ b/Llama.Mobile/Platforms/Android/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Llama.Mobile/Platforms/Android/MainActivity.cs b/Llama.Mobile/Platforms/Android/MainActivity.cs new file mode 100644 index 000000000..8a0d5c68a --- /dev/null +++ b/Llama.Mobile/Platforms/Android/MainActivity.cs @@ -0,0 +1,11 @@ +using Android.App; +using Android.Content.PM; +using Android.OS; + +namespace Llama.Mobile +{ + [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] + public class MainActivity : MauiAppCompatActivity + { + } +} diff --git a/Llama.Mobile/Platforms/Android/MainApplication.cs b/Llama.Mobile/Platforms/Android/MainApplication.cs new file mode 100644 index 000000000..9bf5331af --- /dev/null +++ b/Llama.Mobile/Platforms/Android/MainApplication.cs @@ -0,0 +1,16 @@ +using Android.App; +using Android.Runtime; + +namespace Llama.Mobile +{ + [Application] + public class MainApplication : MauiApplication + { + public MainApplication(IntPtr handle, JniHandleOwnership ownership) + : base(handle, ownership) + { + } + + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + } +} diff --git a/Llama.Mobile/Platforms/Android/Resources/values/colors.xml b/Llama.Mobile/Platforms/Android/Resources/values/colors.xml new file mode 100644 index 000000000..c04d7492a --- /dev/null +++ b/Llama.Mobile/Platforms/Android/Resources/values/colors.xml @@ -0,0 +1,6 @@ + + + #512BD4 + #2B0B98 + #2B0B98 + \ No newline at end of file diff --git a/Llama.Mobile/Platforms/MacCatalyst/AppDelegate.cs b/Llama.Mobile/Platforms/MacCatalyst/AppDelegate.cs new file mode 100644 index 000000000..5af0d2d6f --- /dev/null +++ b/Llama.Mobile/Platforms/MacCatalyst/AppDelegate.cs @@ -0,0 +1,10 @@ +using Foundation; + +namespace Llama.Mobile +{ + [Register("AppDelegate")] + public class AppDelegate : MauiUIApplicationDelegate + { + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + } +} diff --git a/Llama.Mobile/Platforms/MacCatalyst/Entitlements.plist b/Llama.Mobile/Platforms/MacCatalyst/Entitlements.plist new file mode 100644 index 000000000..de4adc94a --- /dev/null +++ b/Llama.Mobile/Platforms/MacCatalyst/Entitlements.plist @@ -0,0 +1,14 @@ + + + + + + + com.apple.security.app-sandbox + + + com.apple.security.network.client + + + + diff --git a/Llama.Mobile/Platforms/MacCatalyst/Info.plist b/Llama.Mobile/Platforms/MacCatalyst/Info.plist new file mode 100644 index 000000000..726897715 --- /dev/null +++ b/Llama.Mobile/Platforms/MacCatalyst/Info.plist @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + UIDeviceFamily + + 2 + + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + XSAppIconAssets + Assets.xcassets/appicon.appiconset + + diff --git a/Llama.Mobile/Platforms/MacCatalyst/Program.cs b/Llama.Mobile/Platforms/MacCatalyst/Program.cs new file mode 100644 index 000000000..d3bd693a9 --- /dev/null +++ b/Llama.Mobile/Platforms/MacCatalyst/Program.cs @@ -0,0 +1,16 @@ +using ObjCRuntime; +using UIKit; + +namespace Llama.Mobile +{ + public class Program + { + // This is the main entry point of the application. + static void Main(string[] args) + { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, typeof(AppDelegate)); + } + } +} diff --git a/Llama.Mobile/Platforms/Tizen/Main.cs b/Llama.Mobile/Platforms/Tizen/Main.cs new file mode 100644 index 000000000..030e40e44 --- /dev/null +++ b/Llama.Mobile/Platforms/Tizen/Main.cs @@ -0,0 +1,17 @@ +using Microsoft.Maui; +using Microsoft.Maui.Hosting; +using System; + +namespace Llama.Mobile +{ + internal class Program : MauiApplication + { + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + + static void Main(string[] args) + { + var app = new Program(); + app.Run(args); + } + } +} diff --git a/Llama.Mobile/Platforms/Tizen/tizen-manifest.xml b/Llama.Mobile/Platforms/Tizen/tizen-manifest.xml new file mode 100644 index 000000000..58d0846a5 --- /dev/null +++ b/Llama.Mobile/Platforms/Tizen/tizen-manifest.xml @@ -0,0 +1,15 @@ + + + + + + maui-appicon-placeholder + + + + + http://tizen.org/privilege/internet + + + + \ No newline at end of file diff --git a/Llama.Mobile/Platforms/Windows/App.xaml b/Llama.Mobile/Platforms/Windows/App.xaml new file mode 100644 index 000000000..51d994306 --- /dev/null +++ b/Llama.Mobile/Platforms/Windows/App.xaml @@ -0,0 +1,8 @@ + + + diff --git a/Llama.Mobile/Platforms/Windows/App.xaml.cs b/Llama.Mobile/Platforms/Windows/App.xaml.cs new file mode 100644 index 000000000..17804342a --- /dev/null +++ b/Llama.Mobile/Platforms/Windows/App.xaml.cs @@ -0,0 +1,25 @@ +using Microsoft.UI.Xaml; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace Llama.Mobile.WinUI +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + public partial class App : MauiWinUIApplication + { + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() + { + this.InitializeComponent(); + } + + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + } + +} diff --git a/Llama.Mobile/Platforms/Windows/Package.appxmanifest b/Llama.Mobile/Platforms/Windows/Package.appxmanifest new file mode 100644 index 000000000..eb72027fd --- /dev/null +++ b/Llama.Mobile/Platforms/Windows/Package.appxmanifest @@ -0,0 +1,46 @@ + + + + + + + + + $placeholder$ + User Name + $placeholder$.png + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Llama.Mobile/Platforms/Windows/app.manifest b/Llama.Mobile/Platforms/Windows/app.manifest new file mode 100644 index 000000000..9991c324d --- /dev/null +++ b/Llama.Mobile/Platforms/Windows/app.manifest @@ -0,0 +1,15 @@ + + + + + + + + true/PM + PerMonitorV2, PerMonitor + + + diff --git a/Llama.Mobile/Platforms/iOS/AppDelegate.cs b/Llama.Mobile/Platforms/iOS/AppDelegate.cs new file mode 100644 index 000000000..5af0d2d6f --- /dev/null +++ b/Llama.Mobile/Platforms/iOS/AppDelegate.cs @@ -0,0 +1,10 @@ +using Foundation; + +namespace Llama.Mobile +{ + [Register("AppDelegate")] + public class AppDelegate : MauiUIApplicationDelegate + { + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + } +} diff --git a/Llama.Mobile/Platforms/iOS/Info.plist b/Llama.Mobile/Platforms/iOS/Info.plist new file mode 100644 index 000000000..0004a4fde --- /dev/null +++ b/Llama.Mobile/Platforms/iOS/Info.plist @@ -0,0 +1,32 @@ + + + + + LSRequiresIPhoneOS + + UIDeviceFamily + + 1 + 2 + + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + XSAppIconAssets + Assets.xcassets/appicon.appiconset + + diff --git a/Llama.Mobile/Platforms/iOS/Program.cs b/Llama.Mobile/Platforms/iOS/Program.cs new file mode 100644 index 000000000..d3bd693a9 --- /dev/null +++ b/Llama.Mobile/Platforms/iOS/Program.cs @@ -0,0 +1,16 @@ +using ObjCRuntime; +using UIKit; + +namespace Llama.Mobile +{ + public class Program + { + // This is the main entry point of the application. + static void Main(string[] args) + { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, typeof(AppDelegate)); + } + } +} diff --git a/Llama.Mobile/Platforms/iOS/Resources/PrivacyInfo.xcprivacy b/Llama.Mobile/Platforms/iOS/Resources/PrivacyInfo.xcprivacy new file mode 100644 index 000000000..24ab3b433 --- /dev/null +++ b/Llama.Mobile/Platforms/iOS/Resources/PrivacyInfo.xcprivacy @@ -0,0 +1,51 @@ + + + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryDiskSpace + NSPrivacyAccessedAPITypeReasons + + E174.1 + + + + + + diff --git a/Llama.Mobile/Resources/AppIcon/appicon.svg b/Llama.Mobile/Resources/AppIcon/appicon.svg new file mode 100644 index 000000000..9d63b6513 --- /dev/null +++ b/Llama.Mobile/Resources/AppIcon/appicon.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Llama.Mobile/Resources/AppIcon/appiconfg.svg b/Llama.Mobile/Resources/AppIcon/appiconfg.svg new file mode 100644 index 000000000..21dfb25f1 --- /dev/null +++ b/Llama.Mobile/Resources/AppIcon/appiconfg.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Llama.Mobile/Resources/Fonts/OpenSans-Regular.ttf b/Llama.Mobile/Resources/Fonts/OpenSans-Regular.ttf new file mode 100644 index 000000000..ee3f28f4a Binary files /dev/null and b/Llama.Mobile/Resources/Fonts/OpenSans-Regular.ttf differ diff --git a/Llama.Mobile/Resources/Fonts/OpenSans-Semibold.ttf b/Llama.Mobile/Resources/Fonts/OpenSans-Semibold.ttf new file mode 100644 index 000000000..bc81019ae Binary files /dev/null and b/Llama.Mobile/Resources/Fonts/OpenSans-Semibold.ttf differ diff --git a/Llama.Mobile/Resources/Images/dotnet_bot.png b/Llama.Mobile/Resources/Images/dotnet_bot.png new file mode 100644 index 000000000..f93ce025a Binary files /dev/null and b/Llama.Mobile/Resources/Images/dotnet_bot.png differ diff --git a/Llama.Mobile/Resources/Raw/AboutAssets.txt b/Llama.Mobile/Resources/Raw/AboutAssets.txt new file mode 100644 index 000000000..89dc758d6 --- /dev/null +++ b/Llama.Mobile/Resources/Raw/AboutAssets.txt @@ -0,0 +1,15 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories). Deployment of the asset to your application +is automatically handled by the following `MauiAsset` Build Action within your `.csproj`. + + + +These files will be deployed with your package and will be accessible using Essentials: + + async Task LoadMauiAsset() + { + using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt"); + using var reader = new StreamReader(stream); + + var contents = reader.ReadToEnd(); + } diff --git a/Llama.Mobile/Resources/Splash/splash.svg b/Llama.Mobile/Resources/Splash/splash.svg new file mode 100644 index 000000000..21dfb25f1 --- /dev/null +++ b/Llama.Mobile/Resources/Splash/splash.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Llama.Mobile/Resources/Styles/Colors.xaml b/Llama.Mobile/Resources/Styles/Colors.xaml new file mode 100644 index 000000000..30307a5dd --- /dev/null +++ b/Llama.Mobile/Resources/Styles/Colors.xaml @@ -0,0 +1,45 @@ + + + + + + + #512BD4 + #ac99ea + #242424 + #DFD8F7 + #9880e5 + #2B0B98 + + White + Black + #D600AA + #190649 + #1f1f1f + + #E1E1E1 + #C8C8C8 + #ACACAC + #919191 + #6E6E6E + #404040 + #212121 + #141414 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Llama.Mobile/Resources/Styles/Styles.xaml b/Llama.Mobile/Resources/Styles/Styles.xaml new file mode 100644 index 000000000..6641e3aed --- /dev/null +++ b/Llama.Mobile/Resources/Styles/Styles.xaml @@ -0,0 +1,427 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +