Skip to content

Commit 7e5040d

Browse files
authored
Merge pull request #15 from danemadsen/main
support for building llama.cpp .so / dll
2 parents c51f7d8 + e896858 commit 7e5040d

30 files changed

+613
-360
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# See https://www.dartlang.org/guides/libraries/private-files
2+
.vscode/
23

34
# Files and directories created by pub
45
.dart_tool/

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "src/llama.cpp"]
22
path = src/llama.cpp
3-
url = https://github.com/ggerganov/llama.cpp.git
3+
url = https://github.com/Mobile-Artificial-Intelligence/llama.cpp.git

.metadata

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,33 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: "78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9"
7+
revision: "2e9cb0aa71a386a91f73f7088d115c0d96654829"
88
channel: "stable"
99

10-
project_type: package
10+
project_type: plugin_ffi
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
17+
base_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
18+
- platform: android
19+
create_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
20+
base_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
21+
- platform: linux
22+
create_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
23+
base_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
24+
- platform: windows
25+
create_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
26+
base_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
27+
28+
# User provided section
29+
30+
# List of Local paths (relative to this file) that should be
31+
# ignored by the migrate tool.
32+
#
33+
# Files that are not part of the templates will be ignored by default.
34+
unmanaged_files:
35+
- 'lib/main.dart'
36+
- 'ios/Runner.xcodeproj/project.pbxproj'

.vscode/settings.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

android/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures
9+
.cxx
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package io.flutter.plugins;
2+
3+
import io.flutter.plugin.common.PluginRegistry;
4+
import io.flutter.plugins.pathprovider.PathProviderPlugin;
5+
6+
/**
7+
* Generated file. Do not edit.
8+
*/
9+
public final class GeneratedPluginRegistrant {
10+
public static void registerWith(PluginRegistry registry) {
11+
if (alreadyRegisteredWith(registry)) {
12+
return;
13+
}
14+
PathProviderPlugin.registerWith(registry.registrarFor("io.flutter.plugins.pathprovider.PathProviderPlugin"));
15+
}
16+
17+
private static boolean alreadyRegisteredWith(PluginRegistry registry) {
18+
final String key = GeneratedPluginRegistrant.class.getCanonicalName();
19+
if (registry.hasPlugin(key)) {
20+
return true;
21+
}
22+
registry.registrarFor(key);
23+
return false;
24+
}
25+
}

android/build.gradle

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// The Android Gradle Plugin builds the native code with the Android NDK.
2+
3+
group 'com.example.llama_cpp_dart'
4+
version '1.0'
5+
6+
buildscript {
7+
repositories {
8+
google()
9+
mavenCentral()
10+
}
11+
12+
dependencies {
13+
// The Android Gradle Plugin knows how to build native code with the NDK.
14+
classpath 'com.android.tools.build:gradle:7.3.0'
15+
}
16+
}
17+
18+
rootProject.allprojects {
19+
repositories {
20+
google()
21+
mavenCentral()
22+
}
23+
}
24+
25+
apply plugin: 'com.android.library'
26+
27+
android {
28+
if (project.android.hasProperty("namespace")) {
29+
namespace 'com.example.llama_cpp_dart'
30+
}
31+
32+
// Bumping the plugin compileSdkVersion requires all clients of this plugin
33+
// to bump the version in their app.
34+
compileSdkVersion 31
35+
36+
// Use the NDK version
37+
// declared in /android/app/build.gradle file of the Flutter project.
38+
// Replace it with a version number if this plugin requires a specfic NDK version.
39+
// (e.g. ndkVersion "23.1.7779620")
40+
ndkVersion android.ndkVersion
41+
42+
// Invoke the shared CMake build with the Android Gradle Plugin.
43+
externalNativeBuild {
44+
cmake {
45+
path "../src/CMakeLists.txt"
46+
47+
// The default CMake version for the Android Gradle Plugin is 3.10.2.
48+
// https://developer.android.com/studio/projects/install-ndk#vanilla_cmake
49+
//
50+
// The Flutter tooling requires that developers have CMake 3.10 or later
51+
// installed. You should not increase this version, as doing so will cause
52+
// the plugin to fail to compile for some customers of the plugin.
53+
// version "3.10.2"
54+
}
55+
}
56+
57+
compileOptions {
58+
sourceCompatibility JavaVersion.VERSION_1_8
59+
targetCompatibility JavaVersion.VERSION_1_8
60+
}
61+
62+
defaultConfig {
63+
ndk {
64+
abiFilters 'arm64-v8a', 'x86_64'
65+
}
66+
minSdkVersion 23
67+
targetSdkVersion 31
68+
}
69+
}

android/settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'llama_cpp_dart'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.example.llama_cpp_dart">
3+
</manifest>
52.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)