56 Commits

Author SHA1 Message Date
Ryan Hunt
a4f4d0bf95 Update README.md to reference cbindgen::generate()
Fixes issue #218
2018-10-16 16:24:22 -05:00
Rahul Gurung
ad33aae017 added installation 2018-10-01 16:38:47 -05:00
Vincent Esche
6df2fcb316 Added [defines] to sample ‘cbindgen.toml’ file in ‘README.md’ 2018-08-14 00:32:28 -05:00
Basile Clement
7a88f0b6a6 Fix typos in the README 2018-07-31 08:31:43 -05:00
Basile Clement
33c45a26bb Add ability to specify features to use for macro expansion
Currently, `cbindgen` uses the `--all-features` flag when expanding a
dependent crate. However, this may not be desirable in a number of
cases:

 - Some C APIs may be gated by a feature flag and would not be present
   in the final cdylib depending on the features provided (for instance
   one could want to have the ability to build a "debug" version of the
   library which provides extra unstable hooks). In such cases, a
   programmatic `cbindgen` call in a build script would want to use only
   the features that will get used in the current build.

 - Some features may bring in large dependencies and/or potentially
   increase compilation time without affecting the FFI surface, and it
   would be faster and more efficient to disable them when running
   `cbindgen`.

 - Some features may require external libraries and/or hardware (e.g.
   dependencies on GPU libraries such as CUDA) that may not be available
   on the current machine without affecting the FFI surface.

To alleviate this problem, this PR adds an extended version of the
`parse.expand` configuration key, allowing control over the features
used when expanding in a way similar to the way cargo handles extended
dependencies (although note that there is a single version of each key,
since the features refer to the features of the current crate). So for
instance instead of writing `expand = ["euclid"]` one would write:

```
[parse.expand]
crates = ["euclid"]
```

which is equivalent to:

```
[parse.expand]
crates = ["euclid"]
all_features = false
default_features = true
features = ["feature1", "feature2"]
```

Note that `all_features` is set to `false` by default in order to match
cargo's behavior.

For backwards compatibility, the old syntax `expand = ["euclid"]` is
still supported and is equivalent to:

```
[parse.expand]
crates = ["euclid"]
all_features = true
default_features = true
features = null
```

In this case, `all_features` is set to `true` in order to match the
previous behavior of cbindgen.
2018-07-31 08:31:43 -05:00
Emilio Cobos Álvarez
c1c0205905 config: Add a configuration option to control which kinds of items are generated. 2018-07-25 13:54:10 -05:00
Philip Jenvey
2bdd534cff fix the docs link 2018-05-18 08:02:00 -05:00
Nikolai Vazquez
256e50e923 Make CLI example more prominent in README.md 2018-04-16 10:11:36 -04:00
Markus Unterwaditzer
d8e5ee69ed Add CLI and toml config option 2018-04-05 06:43:21 -05:00
Johan Anderholm
608a67b4b2 Introduce declaration styles on C structs and enums
Allow structs, enums and unions to be declared as:

struct Name {};
typedef struct {} Name;
typedef struct Name {} Name;

Opaque enums will be declared as:
struct Name;
typedef struct Name Name;
2018-03-27 10:05:45 -05:00
Ryan Hunt
cc98a02495 Nightly is no longer required 2018-03-12 14:37:47 -05:00
Ryan Hunt
e231d9abbe Note the dependency on nightly
Fixes #146
2018-03-09 12:35:37 -06:00
Ryan Hunt
ee89f77a37 Update the README for sized tagged enums 2018-01-29 11:51:41 -06:00
Ryan Hunt
60d95258ba Add item renaming, prefixing, force including, and excluding 2018-01-04 23:29:21 -06:00
Ingvar Stepanyan
4ee1a8bcc8 Remove obsolete template specialization 2017-11-18 14:40:42 -06:00
Ryan Hunt
fd407f122e Specify the correct helper function 2017-11-14 22:50:43 -05:00
Ryan Hunt
cc9c15bbc1 Update README.md to recommend using Builder for build scripts 2017-11-14 22:09:14 -05:00
Ryan Hunt
6b90c00e9c Update documentation 2017-11-14 21:31:58 -05:00
Jeff Muizelaar
68eed64f88 Include a "Prominent users" section 2017-11-14 17:06:51 -06:00
Ryan Hunt
0e47088114 Update README for new features 2017-10-19 00:45:24 -04:00
Ryan Hunt
57bfb90153 Add an explanation of differences between rusty-cheddar and cbindgen
Fixes #48.
2017-09-29 16:02:55 -04:00
Ryan Hunt
c436351290 Add rustdoc link 2017-09-29 15:49:56 -04:00
Ryan Hunt
055fdc20da Update the version to 0.1.22 2017-08-17 20:15:33 -04:00
Ryan Hunt
99294d6bda Update the version to 0.1.21 2017-08-12 04:18:04 -04:00
Ryan Hunt
0ca4620192 Update the travis status url 2017-08-01 03:56:02 -04:00
Evgeniy Reizner
18d011fc6c Fixed example building.
Fix:

```rust
 --> build.rs:8:24
  |
8 |     cbindgen::generate(crate_dir)
  |                        ^^^^^^^^^ expected &str, found struct `std::string::String`
  |
  = note: expected type `&str`
             found type `std::string::String`
  = help: try with `&crate_dir`
```
2017-07-19 15:07:58 -05:00
Ryan Hunt
86f3a1e38c Mention that any generics can now be used 2017-07-18 00:14:41 -04:00
Ryan Hunt
5c7f88a361 Remove trailing comma 2017-07-17 22:59:05 -04:00
Ryan Hunt
58caa33f09 Put template specialization behind a config 2017-07-17 22:57:43 -04:00
Ryan Hunt
d633bd4b1e One last formatting change to README.md, redux 2017-06-29 00:38:53 -04:00
Ryan Hunt
4a09343309 One last formatting change to README.md, again 2017-06-29 00:37:38 -04:00
Ryan Hunt
7590865ca6 One last formatting change 2017-06-29 00:29:18 -04:00
Ryan Hunt
b88fd711b8 Fix some formatting 2017-06-29 00:25:56 -04:00
Ryan Hunt
c9eadb883a Update the config documentation in README.md 2017-06-29 00:12:09 -04:00
Ryan Hunt
95f0ab0f98 Improve formatting of README 2017-06-21 04:47:03 -04:00
Ryan Hunt
068f9e563a Update README.md with some configuration options 2017-06-21 04:39:02 -04:00
Ryan Hunt
42454fede2 Make build scripts more ergonomic
Fixes #19
2017-06-21 03:33:45 -04:00
Ryan Hunt
4064a09238 Do a bunch of clean up and add some comments 2017-06-20 01:25:42 -04:00
Ryan Hunt
2f655fa870 Update the version to 0.1.9 2017-05-11 04:21:06 -04:00
Ryan Hunt
b04df026d9 Rename directive to annotation 2017-05-11 03:57:57 -04:00
Ryan Hunt
0aada672cd Add a test harness
Fixes #3
2017-05-11 01:16:27 -04:00
Ryan Hunt
11f90a561e Update README.md 2017-05-08 01:26:44 -04:00
Ryan Hunt
e7cddcfd6a Try and load cbindgen.toml for config automatically 2017-04-30 02:29:39 -04:00
Ryan Hunt
4f7baace56 Change build-script's build script 2017-04-29 19:55:03 -04:00
Ryan Hunt
1ec87b6d56 Cleanup config.rs and switch to toml 2017-04-29 14:02:31 -04:00
Ryan Hunt
464c7f6562 Add status badges 2017-04-27 17:41:01 -04:00
Ryan Hunt
93541ddc21 Update version to 0.1.5 2017-04-18 03:17:39 -04:00
Ryan Hunt
b86d9a9a62 Rename Library::build to Library::generate
It's called bindings generation not bindings building.
2017-04-17 23:02:34 -04:00
Ryan Hunt
953d622639 Only pass Config into bindgen once 2017-04-17 22:57:31 -04:00
Ryan Hunt
2bf0ca2762 Update the README for build script instructions 2017-04-17 22:26:18 -04:00