Skip to content

Commit

Permalink
Use c++14 and fix test_name_doc
Browse files Browse the repository at this point in the history
Signed-off-by: Neil Shen <overvenus@gmail.com>
  • Loading branch information
overvenus committed Aug 4, 2023
1 parent 53fc7ae commit b4b170f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
23 changes: 17 additions & 6 deletions grpc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,6 @@ fn build_grpc(cc: &mut cc::Build, library: &str) {
config.define("gRPC_BENCHMARK_PROVIDER", "none");
// Check https://github.com/protocolbuffers/protobuf/issues/12185
config.define("ABSL_ENABLE_INSTALL", "ON");
if cfg!(feature = "internals") {
config.define("ABSL_PROPAGATE_CXX_STD", "ON");
}

// `package` should only be set for secure feature, otherwise cmake will always search for
// ssl library.
Expand All @@ -255,7 +252,12 @@ fn build_grpc(cc: &mut cc::Build, library: &str) {
if !cfg!(feature = "_list-package") {
config.build_target(library);
}
config.uses_cxx11().build()

config.define("CMAKE_CXX_STANDARD", "14");
config.define("CMAKE_CXX_STANDARD_REQUIRED", "ON");
// Use -std=c++yy rather than -std=gnu++yy.
config.define("CMAKE_CXX_EXTENSIONS", "OFF");
config.build()
};

let lib_suffix = if target.contains("msvc") {
Expand Down Expand Up @@ -550,7 +552,6 @@ fn config_binding_path() {
.join()
.unwrap();
}
let _ = binding;
};

config_binding(Binding::GrpcWrap {
Expand Down Expand Up @@ -600,11 +601,21 @@ fn main() {
}

cc.cpp(true);
if !cfg!(target_env = "msvc") {
if cfg!(target_env = "msvc") {
cc.flag("-std:c++14");
} else {
cc.flag("-std=c++14");
}
cc.file("grpc_wrap.cc");
if cfg!(feature = "internals") {
if cfg!(target_env = "msvc") {
// grpc_wrap_internals.cc includes <ostream> implicitly which uses
// C++ exception handler. Specify -EHsc to use unwind semantics.
cc.flag("-EHsc");
// Disable warnings from included files on windows.
cc.flag("-external:W0");
cc.flag("-external:anglebrackets");
}
cc.file("grpc_wrap_internals.cc");
}
cc.warnings_into_errors(true);
Expand Down
3 changes: 0 additions & 3 deletions grpc-sys/grpc_wrap_internals.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// Copyright 2023 TiKV Project Authors. Licensed under Apache-2.0.

// #ifdef GRPC_SYS_METRICS
// #endif

#include <src/core/lib/debug/stats.h>
#include <src/core/lib/debug/stats_data.h>

Expand Down

0 comments on commit b4b170f

Please sign in to comment.