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
6 changes: 5 additions & 1 deletion lib/flutter_pty.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ const _libName = 'flutter_pty';

final DynamicLibrary _dylib = () {
if (Platform.isMacOS || Platform.isIOS) {
return DynamicLibrary.open('$_libName.framework/$_libName');
// DynamicLibrary.process() resolves symbols from the already-loaded process
// image, which works for both SPM static linking and CocoaPods dynamic
// embedding (in the latter case the framework is already mapped into the
// process by the time any Dart code runs).
return DynamicLibrary.process();
}
if (Platform.isAndroid || Platform.isLinux) {
return DynamicLibrary.open('lib$_libName.so');
Expand Down
2 changes: 1 addition & 1 deletion macos/flutter_pty.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A new Flutter FFI plugin project.
# paths, so Classes contains a forwarder C file that relatively imports
# `../src/*` so that the C sources can be shared among all target platforms.
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.source_files = 'flutter_pty/Classes/**/*'
s.dependency 'FlutterMacOS'

s.platform = :osx, '10.11'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Relative import to be able to reuse the C sources.
// See the comment in ../{projectName}}.podspec for more information.
#include "../../src/flutter_pty.c"
#include "../../../src/flutter_pty.c"
19 changes: 19 additions & 0 deletions macos/flutter_pty/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// swift-tools-version: 5.9
import PackageDescription

let package = Package(
name: "flutter_pty",
platforms: [
.macOS("10.14")
],
products: [
.library(name: "flutter-pty", type: .static, targets: ["flutter_pty"])
],
targets: [
.target(
name: "flutter_pty",
path: "Classes",
publicHeadersPath: "."
)
]
)