Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: dev
- name: Install dependencies
run: dart pub get
- name: Publish
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# FVM Version Cache
.fvm/
.VSCodeCounter/
.idea/

.dart_tool/
pubspec.lock
Expand Down Expand Up @@ -131,3 +133,4 @@ app.*.symbols
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/dev/ci/**/Gemfile.lock

11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ffigen:
dart run ffigen --config ffigen.yaml

coverage:
flutter test --coverage

test:
flutter test

copy-debug:
cp -f src/cmake-build-debug/libmnn_c_api.dylib .dart_tool/lib/libmnn_c_api.dylib
3 changes: 3 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ analyzer:
# test_coverage
- test/.test_coverage.dart

- src/**

language:
# We've seen errors tied to use of implicit operations similar to the ones described in
# https://dart.dev/guides/language/analysis-options#enabling-additional-type-checks.
Expand All @@ -34,6 +36,7 @@ analyzer:

errors:
constant_identifier_names: ignore
library_prefixes: ignore
missing_required_param: error
missing_return: error
non_constant_identifier_names: ignore
Expand Down
6 changes: 6 additions & 0 deletions ffigen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ headers:
- "src/stb_image_resize2.h"
- "src/stb_image_write.h"
- "src/image_process.h"
- "src/expr.h"
- "src/expr_op.h"
- "src/stdvec.h"
include-directives:
- "src/autotime.h"
- "src/error_code.h"
Expand All @@ -39,6 +42,9 @@ headers:
- "src/stb_image_resize2.h"
- "src/stb_image_write.h"
- "src/image_process.h"
- "src/expr.h"
- "src/expr_op.h"
- "src/stdvec.h"
structs:
exclude:
- 'halide_type_t'
Expand Down
1 change: 1 addition & 0 deletions hook/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Future<void> _builder(BuildInput input, BuildOutputBuilder output) async {
'MNN_BUILD_CODEGEN': 'OFF',
'MNN_ENABLE_COVERAGE': 'OFF',
'MNN_JNI': 'OFF',
"MNN_KLEIDIAI": 'OFF',
...defines,
},
buildLocal: options["build_local"] as bool? ?? false,
Expand Down
3 changes: 3 additions & 0 deletions lib/mnn.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export 'src/backend.dart';
export 'src/base.dart';
export 'src/constant.dart';
export 'src/exception.dart';
export 'src/expr/expr.dart';
export 'src/expr/utils.dart';
export 'src/formatter.dart';
export 'src/g/mnn.g.dart'
show
DimensionType,
Expand Down
1 change: 1 addition & 0 deletions lib/numdart.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'src/expr/op.dart';
6 changes: 6 additions & 0 deletions lib/src/base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ Future<T> mnnRunAsync0<T>(
return completer.future;
}

void MnnAssert(bool condition, String message) {
if (!condition) {
throw MNNException(message);
}
}

typedef u8 = ffi.Uint8;
typedef u16 = ffi.Uint16;
typedef u32 = ffi.Uint32;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ class MNNException implements Exception {
MNNException(this.message);
@override
String toString() {
return '(MNNException: $message)';
return 'MNNException: $message';
}
}
Loading
Loading