Skip to content
This repository was archived by the owner on Jan 28, 2024. It is now read-only.

Remove setup phase #135

Merged
merged 14 commits into from
Jan 8, 2021
Merged
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: 0 additions & 2 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ jobs:
run: dart pub get
- name: Install libclang-10-dev
run: sudo apt-get install libclang-10-dev
- name: Setup ffigen
run: dart --no-sound-null-safety run ffigen:setup
- name: Build test dylib
run: cd test/native_test && dart build_test_dylib.dart && cd ../..
- name: Run VM tests
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.0.0-dev.2
- Removed setup phase for ffigen. Added new optional config key `llvm-lib`
to specify path to `llvm/lib` folder.

# 2.0.0-dev.1
- Added support for passing and returning struct by value in functions.

Expand Down
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ typedef _dart_sum = int Function(int a, int b);
```
## Using this package
- Add `ffigen` under `dev_dependencies` in your `pubspec.yaml`.
- Setup for use (see [Setup](#Setup)).
- Install LLVM (see [Installing LLVM](#installing-llvm)).
- Configurations must be provided in `pubspec.yaml` or in a custom YAML file (see [configurations](#configurations)).
- Run the tool- `dart run ffigen`.

Jump to [FAQ](#faq).

## Setup
## Installing LLVM
`package:ffigen` uses LLVM. Install LLVM (9+) in the following way.

#### ubuntu/linux
Expand Down Expand Up @@ -87,6 +87,16 @@ The following configuration options are available-

```yaml
output: 'generated_bindings.dart'
```
</td>
</tr>
<tr>
<td>llvm-lib</td>
<td>Path to <i>llvm/lib</i> folder. Required if ffigen is unable to find this at default locations.</td>
<td>

```yaml
llvm-lib: '/usr/local/opt/llvm/lib'
```
</td>
</tr>
Expand Down Expand Up @@ -383,13 +393,12 @@ class ArrayHelper_CXFileUniqueID_data_level0 {
2. Run `pub run ffigen`.

## Running Tests
1. Run setup to build the LLVM wrapper - `pub run ffigen:setup`.
2. Dynamic library for some tests also need to be built before running the examples.
1. Dynamic library for some tests need to be built before running the examples.
1. `cd test/native_test`.
2. Run `dart build_test_dylib.dart`.

Run tests from the root of the package with `pub run test`.

> Note: If llvm is not installed in one of the default locations, tests may fail.
## FAQ
### Can ffigen be used for removing underscores or renaming declarations?
Ffigen supports **regexp based renaming**, the regexp must be a
Expand Down
12 changes: 0 additions & 12 deletions bin/ffigen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import 'package:ffigen/ffigen.dart';
import 'package:logging/logging.dart';
import 'package:yaml/yaml.dart' as yaml;

import 'setup.dart';

final _logger = Logger('ffigen.ffigen');
final _ansi = Ansi(Ansi.terminalSupportsAnsi);

Expand All @@ -31,16 +29,6 @@ void main(List<String> args) {
// Setup logging level and printing.
setupLogger(argResult);

/// Prompt user if dylib doesn't exist and cannot be auto created to run
/// `pub run ffigen:setup -Ipath/to/llvm/include -Lpath/to/llvm/lib`.
if (!checkDylibExist() && !autoCreateDylib()) {
_logger.severe('Unable to create dynamic library automatically.');
_logger.severe('If LLVM (9+) is installed, try running:');
_logger.severe(
' pub run ffigen:setup -Ipath/to/llvm/include -Lpath/to/llvm/lib');
exit(1);
}

// Create a config object.
Config config;
try {
Expand Down
275 changes: 0 additions & 275 deletions bin/setup.dart

This file was deleted.

3 changes: 3 additions & 0 deletions example/libclang-example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ ffigen:
output: 'generated_bindings.dart'
sort: true

# This is required if LLVM can't be found in default locations by ffigen.
# llvm-lib: '/usr/local/opt/llvm/lib'

# Bash style Glob matching is also supported.
# TODO(11): Globs dont work on windows if they begin with '.' or '..'.
headers:
Expand Down
Loading