Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'Compile a C library while setting custom defines' (#295) #323

Merged
merged 2 commits into from Oct 12, 2017

Conversation

Projects
None yet
2 participants
@bobbo
Copy link
Contributor

bobbo commented Oct 9, 2017

Fixes #295

@budziq
Copy link
Collaborator

budziq left a comment

@bobbo Thanks for the PR!
Its nearly perfect, only some minor stylistic suggestions below and we are good to merge 👍

[![cc-badge]][cc] [![cat-development-tools-badge]][cat-development-tools]
It is simple to build bundled C code with custom defines using [`cc::Build::define`][cc-build-define].

This comment has been minimized.

@budziq

budziq Oct 11, 2017

Collaborator

Instead of

[cc::Build::define][cc-build-define]

we can use link descriptor with just

[cc::Build::define]

[![cc-badge]][cc] [![cat-development-tools-badge]][cat-development-tools]
It is simple to build bundled C code with custom defines using [`cc::Build::define`][cc-build-define].
It takes an [`Option`] value, so it is possible to create defines such as `#define FLAG`

This comment has been minimized.

@budziq

budziq Oct 11, 2017

Collaborator

I would suggest referencing the defines actually used in the snippet below instead of VALUE and FLAG or use these in the actual snippet.

also I would try to emphasize that #define FLAG type is created with None

{{#include links.md}}

<!-- Other Reference -->

[build-script-docs]: http://doc.crates.io/build-script.html
[playground]: https://play.rust-lang.org
[cc-build]: https://docs.rs/cc/*/cc/struct.Build.html
[cc-build-define]: https://docs.rs/cc/1.0.0/cc/struct.Build.html#method.define

This comment has been minimized.

@budziq

budziq Oct 11, 2017

Collaborator

please use wildcard version numbers
also we can use

[Build::define]: https://docs.rs/cc/*/cc/struct.Build.html#method.define

directly instead.

It would be great help if you could cleanup the other examples here with this type of reference (but this will not be a blocker for this PR ;) )

It is simple to build bundled C code with custom defines using [`cc::Build::define`][cc-build-define].
It takes an [`Option`] value, so it is possible to create defines such as `#define FLAG`
as well as `#define VALUE 123`. This example builds a bundled C file with dynamic defines set in
`build.rs` and prints `Welcome to foo - version 1.0.2` when run. Cargo sets some [environment

This comment has been minimized.

@budziq

budziq Oct 11, 2017

Collaborator

build.rs and prints Welcome to foo - version 1.0.2

Lets leave the backtick "`" emphasis for code. I would suggest bold emphasis here.

@bobbo

This comment has been minimized.

Copy link
Contributor Author

bobbo commented Oct 12, 2017

Hi @budziq, updated based on your feedback. How's it looking now?

@budziq budziq merged commit ac20edd into rust-lang-nursery:master Oct 12, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@budziq

This comment has been minimized.

Copy link
Collaborator

budziq commented Oct 12, 2017

Thanks @bobbo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.