forked from Henry-Hiles/nexus
working build of generated file
This commit is contained in:
parent
7de94531f7
commit
8d43313512
4 changed files with 19 additions and 5 deletions
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
perSystem =
|
perSystem =
|
||||||
{
|
{
|
||||||
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
system,
|
system,
|
||||||
...
|
...
|
||||||
|
|
@ -62,6 +63,7 @@
|
||||||
pkgs.sqlite
|
pkgs.sqlite
|
||||||
])
|
])
|
||||||
}:./.dart_tool/hooks_runner/shared/nexus/build/gomuks";
|
}:./.dart_tool/hooks_runner/shared/nexus/build/gomuks";
|
||||||
|
CPATH = lib.makeSearchPath "include" [ pkgs.glibc.dev ];
|
||||||
|
|
||||||
# ANDROID_HOME = "${android.androidsdk}/libexec/android-sdk";
|
# ANDROID_HOME = "${android.androidsdk}/libexec/android-sdk";
|
||||||
# ANDROID_SDK_ROOT = ANDROID_HOME;
|
# ANDROID_SDK_ROOT = ANDROID_HOME;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,11 @@ import "package:nexus/models/sync_status.dart";
|
||||||
import "package:nexus/src/third_party/gomuks.g.dart";
|
import "package:nexus/src/third_party/gomuks.g.dart";
|
||||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||||
|
|
||||||
void gomuksCallback(Pointer<Char> command, int requestId, GomuksBuffer data) {
|
void gomuksCallback(
|
||||||
|
Pointer<Char> command,
|
||||||
|
int requestId,
|
||||||
|
GomuksBorrowedBuffer data,
|
||||||
|
) {
|
||||||
try {
|
try {
|
||||||
final muksEventType = command.cast<Utf8>().toDartString();
|
final muksEventType = command.cast<Utf8>().toDartString();
|
||||||
final Map<String, dynamic> decodedMuksEvent = data.toJson();
|
final Map<String, dynamic> decodedMuksEvent = data.toJson();
|
||||||
|
|
@ -34,9 +38,9 @@ class ClientController extends Notifier<int> {
|
||||||
|
|
||||||
GomuksStart(
|
GomuksStart(
|
||||||
handle,
|
handle,
|
||||||
Pointer.fromFunction<Void Function(Pointer<Char>, Int64, GomuksBuffer)>(
|
Pointer.fromFunction<
|
||||||
gomuksCallback,
|
Void Function(Pointer<Char>, Int64, GomuksBorrowedBuffer)
|
||||||
),
|
>(gomuksCallback),
|
||||||
);
|
);
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,14 @@ import "dart:typed_data";
|
||||||
import "package:ffi/ffi.dart";
|
import "package:ffi/ffi.dart";
|
||||||
import "package:nexus/src/third_party/gomuks.g.dart";
|
import "package:nexus/src/third_party/gomuks.g.dart";
|
||||||
|
|
||||||
|
extension GomuksBufferToJson on GomuksBorrowedBuffer {
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final bytes = toBytes();
|
||||||
|
if (bytes.isEmpty) return {};
|
||||||
|
return jsonDecode(utf8.decode(bytes));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extension JsonToGomuksBuffer on Map<String, dynamic> {
|
extension JsonToGomuksBuffer on Map<String, dynamic> {
|
||||||
GomuksBuffer toGomuksBuffer() {
|
GomuksBuffer toGomuksBuffer() {
|
||||||
final jsonString = json.encode(this);
|
final jsonString = json.encode(this);
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ void main(List<String> args) async {
|
||||||
),
|
),
|
||||||
headers: Headers(
|
headers: Headers(
|
||||||
entryPoints: [File(join(buildDir.path, "libgomuks.h")).uri],
|
entryPoints: [File(join(buildDir.path, "libgomuks.h")).uri],
|
||||||
// compilerOptions: ["-I${String.fromEnvironment("CPATH")}"],
|
compilerOptions: ["--no-warnings"],
|
||||||
),
|
),
|
||||||
functions: Functions.includeAll,
|
functions: Functions.includeAll,
|
||||||
).generate();
|
).generate();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue