Skip to content

Commit

Permalink
Harmonize README.md with reality. (#835)
Browse files Browse the repository at this point in the history
  • Loading branch information
dot-asm committed Jul 23, 2023
1 parent e84367b commit df2f86c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ you can call them from Rust by declaring them in
your Rust code like so:

```rust,no_run
extern {
extern "C" {
fn foo_function();
fn bar_function(x: i32) -> i32;
}
Expand Down Expand Up @@ -138,9 +138,9 @@ required varies per platform, but there are three broad categories:
* Unix platforms require `cc` to be the C compiler. This can be found by
installing cc/clang on Linux distributions and Xcode on macOS, for example.
* Windows platforms targeting MSVC (e.g. your target triple ends in `-msvc`)
require `cl.exe` to be available and in `PATH`. This is typically found in
standard Visual Studio installations and the `PATH` can be set up by running
the appropriate developer tools shell.
require Visual Studio to be installed. `cc-rs` attempts to locate it, and
if it fails, `cl.exe` is expected to be available in `PATH`. This can be
set up by running the appropriate developer tools shell.
* Windows platforms targeting MinGW (e.g. your target triple ends in `-gnu`)
require `cc` to be available in `PATH`. We recommend the
[MinGW-w64](https://www.mingw-w64.org/) distribution, which is using the
Expand All @@ -163,7 +163,7 @@ fn main() {
cc::Build::new()
.cpp(true) // Switch to C++ library compilation.
.file("foo.cpp")
.compile("libfoo.a");
.compile("foo");
}
```

Expand All @@ -178,7 +178,7 @@ The C++ standard library may be linked to the crate target. By default it's `lib
.cpp(true)
.file("foo.cpp")
.cpp_link_stdlib("stdc++") // use libstdc++
.compile("libfoo.a");
.compile("foo");
}
```
2. by setting the `CXXSTDLIB` environment variable.
Expand All @@ -190,7 +190,7 @@ Remember that C++ does name mangling so `extern "C"` might be required to enable
## CUDA C++ support

`cc-rs` also supports compiling CUDA C++ libraries by using the `cuda` method
on `Build` (currently for GNU/Clang toolchains only):
on `Build`:

```rust,no_run
fn main() {
Expand All @@ -208,8 +208,10 @@ fn main() {
.flag("-gencode").flag("arch=compute_60,code=sm_60")
// Generate code for Pascal (Jetson TX2).
.flag("-gencode").flag("arch=compute_62,code=sm_62")
// Generate code in parallel
.flag("-t0")
.file("bar.cu")
.compile("libbar.a");
.compile("bar");
}
```

Expand Down

0 comments on commit df2f86c

Please sign in to comment.