Repository metrics
- Stars
- (20 stars)
- PR merge metrics
- (PR metrics pending)
Description
Feature Request
Summary
In addition to building binaries, we should be able to build libraries too.
Motivation
This is useful for targeting non-cargo targets such as Android, iOS, and WASM. An example use case for this was brought up in https://github.com/datrs/hypercore/issues/36#issuecomment-420861424, where we're trying to build .so files targeting Android.
Guide-level explanation
When someone wants to use crossgen to build libraries, they can run:
$ crossgen --lib
And it'll setup a base version of crossgen, targeting most common platforms.
Reference-level explanation
- We should add a
lib: boolflag to the CLI. - We should create separate travis templates for CLI
- We should create a separate generator method for
lib; giving us a choice ofgen_bin()andgen_lib()from thelib.rsinterface. main.rsshould choose between thegen_bin()andgen_lib()based on thelib: boolflag.
Drawbacks
None.
Rationale and alternatives
crossgen --libwas chosen to be compatible withcargo init --libandcargo init, which target binaries by default, and libraries with a flag.- a separate subcommand could be chosen too, but that would be less consistent with
cargo, and possibly the wider rust ecosystem.
Unresolved Questions
This does not address setting up individual targets. For example there is currently no way to indicate you want Android support, but not WASM. This must be removed manually after crossgen has run.