Skip to content

Commit

Permalink
Align documentation to no longer set cxxbridge_flags manually
Browse files Browse the repository at this point in the history
  • Loading branch information
roligugus committed Sep 25, 2020
1 parent d328816 commit 4602329
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 21 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ cxxbridge-flags = { version = "=0.4.7", path = "flags", default-features = false
[dev-dependencies]
cxx-build = { version = "=0.4.7", path = "gen/build" }
cxx-test-suite = { version = "0", path = "tests/ffi" }
cxxbridge-flags = { version = "=0.4.7", path = "flags", default-features = false }
rustversion = "1.0"
trybuild = { version = "1.0.33", features = ["diff"] }

Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,10 @@ For builds that are orchestrated by Cargo, you will use a build script that runs
CXX's C++ code generator and compiles the resulting C++ code along with any
other C++ code for your crate.

Set CXX features such as support of a different C++ standard - default is
C++11 - by setting the feature on the CXX crate. This ensures that the CXX
bridge library code in cxx.h|cc gets compiled with the same feature flags
as your code.
CXX create features, such as support of a different C++ standard, are
automatically set if using cxx_build. This ensures that your code gets
compiled with the same feature flags as the CXX bridge library code in
cxx.h|cc. See the CXX crate for available features.

The canonical build script is as follows. The indicated line returns a
[`cc::Build`] instance (from the usual widely used `cc` crate) on which you can
Expand All @@ -233,7 +233,6 @@ cxx = "0.4"

[build-dependencies]
cxx-build = "0.4"
cxxbridge-flags = "0.4"
```

```rust
Expand All @@ -242,7 +241,6 @@ cxxbridge-flags = "0.4"
fn main() {
cxx_build::bridge("src/main.rs") // returns a cc::Build
.file("src/demo.cc")
.flag_if_supported(cxxbridge_flags::STD)
.compile("cxxbridge-demo");

println!("cargo:rerun-if-changed=src/main.rs");
Expand Down
10 changes: 4 additions & 6 deletions gen/build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
//! C++ code generator, set up any additional compiler flags depending on
//! the use case, and make the C++ compiler invocation.
//!
//! Set CXX features such as support of a different C++ standard - default is
//! C++11 - by setting the feature on the CXX crate. This ensures that the CXX
//! bridge library code in cxx.h|cc gets compiled with the same feature flags
//! as your code.
//! CXX create features, such as support of a different C++ standard, are
//! automatically set if using cxx_build. This ensures that your code gets
//! compiled with the same feature flags as the CXX bridge library code in
//! cxx.h|cc. See the CXX crate for available features.
//!
//! <br>
//!
Expand All @@ -21,7 +21,6 @@
//! fn main() {
//! cxx_build::bridge("src/main.rs")
//! .file("src/demo.cc")
//! .flag_if_supported(cxxbridge_flags::STD)
//! .compile("cxxbridge-demo");
//!
//! println!("cargo:rerun-if-changed=src/main.rs");
Expand Down Expand Up @@ -92,7 +91,6 @@ pub fn bridge(rust_source_file: impl AsRef<Path>) -> Build {
/// let source_files = vec!["src/main.rs", "src/path/to/other.rs"];
/// cxx_build::bridges(source_files)
/// .file("src/demo.cc")
/// .flag_if_supported(cxxbridge_flags::STD)
/// .compile("cxxbridge-demo");
/// ```
#[must_use]
Expand Down
10 changes: 4 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@
//! runs CXX's C++ code generator and compiles the resulting C++ code along with
//! any other C++ code for your crate.
//!
//! Set CXX features such as support of a different C++ standard - default is
//! C++11 - by setting the feature on the CXX crate. This ensures that the CXX
//! bridge library code in cxx.h|cc gets compiled with the same feature flags
//! as your code.
//! CXX create features, such as support of a different C++ standard, are
//! automatically set if using cxx_build. This ensures that your code gets
//! compiled with the same feature flags as the CXX bridge library code in
//! cxx.h|cc. See the CXX crate for available features.
//!
//! The canonical build script is as follows. The indicated line returns a
//! [`cc::Build`] instance (from the usual widely used `cc` crate) on which you
Expand All @@ -239,7 +239,6 @@
//!
//! [build-dependencies]
//! cxx-build = "0.4"
//! cxxbridge-flags = "0.4"
//! ```
//!
//! ```no_run
Expand All @@ -248,7 +247,6 @@
//! fn main() {
//! cxx_build::bridge("src/main.rs") // returns a cc::Build
//! .file("src/demo.cc")
//! .flag_if_supported(cxxbridge_flags::STD)
//! .compile("cxxbridge-demo");
//!
//! println!("cargo:rerun-if-changed=src/main.rs");
Expand Down
3 changes: 1 addition & 2 deletions third-party/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4602329

Please sign in to comment.