diff options
author | David Tolnay <dtolnay@gmail.com> | 2024-03-05 23:54:41 -0800 |
---|---|---|
committer | David Tolnay <dtolnay@gmail.com> | 2024-03-05 23:54:41 -0800 |
commit | fe8fdcad16068c94be86b414bec9be179771c769 (patch) | |
tree | 20eb2c39ec9249014e88a6ffc48ceb1b8c4f0c4f | |
parent | 04b3a754da0646fbaa9c508d48d3e5760bb9070e (diff) | |
download | cxx-fe8fdcad16068c94be86b414bec9be179771c769.tar.gz |
Set C++ standard version using cc::Build::std
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | build.rs | 2 | ||||
-rw-r--r-- | flags/src/impl.rs | 13 | ||||
-rw-r--r-- | gen/build/Cargo.toml | 2 | ||||
-rw-r--r-- | tests/ffi/build.rs | 2 | ||||
-rw-r--r-- | third-party/Cargo.toml | 2 |
6 files changed, 9 insertions, 14 deletions
@@ -27,7 +27,7 @@ cxxbridge-macro = { version = "=1.0.118", path = "macro" } link-cplusplus = "1.0.9" [build-dependencies] -cc = "1.0.79" +cc = "1.0.83" cxxbridge-flags = { version = "=1.0.118", path = "flags", default-features = false } [dev-dependencies] @@ -10,7 +10,7 @@ fn main() { .file(manifest_dir.join("src/cxx.cc")) .cpp(true) .cpp_link_stdlib(None) // linked via link-cplusplus crate - .flag_if_supported(cxxbridge_flags::STD) + .std(cxxbridge_flags::STD) .warnings_into_errors(cfg!(deny_warnings)) .compile("cxxbridge1"); diff --git a/flags/src/impl.rs b/flags/src/impl.rs index 4f7b8fb4..4cf0713e 100644 --- a/flags/src/impl.rs +++ b/flags/src/impl.rs @@ -1,20 +1,15 @@ #[allow(unused_assignments, unused_mut, unused_variables)] pub const STD: &str = { - let mut flags = ["-std=c++11", "/std:c++11"]; + let mut flag = "c++11"; #[cfg(feature = "c++14")] - (flags = ["-std=c++14", "/std:c++14"]); + (flag = "c++14"); #[cfg(feature = "c++17")] - (flags = ["-std=c++17", "/std:c++17"]); + (flag = "c++17"); #[cfg(feature = "c++20")] - (flags = ["-std=c++20", "/std:c++20"]); - - let [mut flag, msvc_flag] = flags; - - #[cfg(target_env = "msvc")] - (flag = msvc_flag); + (flag = "c++20"); flag }; diff --git a/gen/build/Cargo.toml b/gen/build/Cargo.toml index 5c349800..ef6783f8 100644 --- a/gen/build/Cargo.toml +++ b/gen/build/Cargo.toml @@ -19,7 +19,7 @@ parallel = ["cc/parallel"] experimental-async-fn = [] [dependencies] -cc = "1.0.79" +cc = "1.0.83" codespan-reporting = "0.11.1" once_cell = "1.18" proc-macro2 = { version = "1.0.74", default-features = false, features = ["span-locations"] } diff --git a/tests/ffi/build.rs b/tests/ffi/build.rs index a1a64b7f..7051cf0b 100644 --- a/tests/ffi/build.rs +++ b/tests/ffi/build.rs @@ -9,7 +9,7 @@ fn main() { let sources = vec!["lib.rs", "module.rs"]; let mut build = cxx_build::bridges(sources); build.file("tests.cc"); - build.flag_if_supported(cxxbridge_flags::STD); + build.std(cxxbridge_flags::STD); build.warnings_into_errors(cfg!(deny_warnings)); if cfg!(not(target_env = "msvc")) { build.define("CXX_TEST_INSTANTIATIONS", None); diff --git a/third-party/Cargo.toml b/third-party/Cargo.toml index adfe29d4..2160b114 100644 --- a/third-party/Cargo.toml +++ b/third-party/Cargo.toml @@ -9,7 +9,7 @@ publish = false path = "/dev/null" [dependencies] -cc = "1.0.49" +cc = "1.0.83" clap = { version = "4", default-features = false, features = ["error-context", "help", "std", "usage"] } codespan-reporting = "0.11.1" once_cell = "1.9" |