From 9ecf38fb6344028ea11ca415077986087d92ee0b Mon Sep 17 00:00:00 2001 From: Peter Marshall Date: Tue, 28 May 2019 15:02:29 +0200 Subject: [PATCH] [tracing] Fix perfetto build on windows Add .exe to the produced executable for the protoc compiler. Use include_dirs instead of -isystem. Remove some more warnings that that causes. Cq-Include-Trybots: luci.v8.try:v8_linux64_perfetto_dbg_ng Bug: v8:8339 Change-Id: Ia6b0df63107470ec78f8038834205a0e4fe34b21 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1632069 Commit-Queue: Peter Marshall Reviewed-by: Yang Guo Auto-Submit: Peter Marshall Cr-Commit-Position: refs/heads/master@{#61893} --- BUILD.gn | 27 +++++++++++++++++++-------- gni/proto_library.gni | 14 +++++++++++--- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 0798410b7d..2e08a7c11a 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -3681,8 +3681,8 @@ v8_component("v8_libplatform") { "src/libplatform/tracing/trace-event-listener.h", ] deps += [ - "third_party/perfetto:libperfetto", - "third_party/perfetto/protos/perfetto/trace/chrome:minimal_complete_lite", + "//third_party/perfetto:libperfetto", + "//third_party/perfetto/protos/perfetto/trace/chrome:minimal_complete_lite", ] } } @@ -4420,16 +4420,13 @@ if (!build_with_chromium && v8_use_perfetto) { "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER", ] cflags = [ - # Using -isystem instead of include_dirs (-I), so we don't need to suppress - # warnings coming from libprotobuf headers. Doing so would mask warnings in - # our own code. - "-isystem", - rebase_path("third_party/protobuf/src", root_build_dir), "-Wno-unknown-warning-option", "-Wno-deprecated", "-Wno-undef", "-Wno-zero-as-null-pointer-constant", + "-Wno-thread-safety-attributes", ] + include_dirs = [ "third_party/protobuf/src" ] } # Configuration used to build libprotobuf_* and the protoc compiler. @@ -4437,7 +4434,9 @@ if (!build_with_chromium && v8_use_perfetto) { # Apply the lighter supressions and macro definitions from above. configs = [ ":protobuf_gen_config" ] - defines = [ "HAVE_PTHREAD=1" ] + if (!is_win) { + defines = [ "HAVE_PTHREAD=1" ] + } if (is_clang) { cflags = [ "-Wno-unused-private-field", @@ -4449,6 +4448,9 @@ if (!build_with_chromium && v8_use_perfetto) { "-Wno-tautological-constant-compare", ] } + if (is_win) { + cflags += [ "-Wno-microsoft-unqualified-friend" ] + } } source_set("protobuf_lite") { @@ -4483,6 +4485,9 @@ if (!build_with_chromium && v8_use_perfetto) { "//build/config/compiler:no_chromium_code", ":protobuf_config", ] + if (is_win) { + configs -= [ "//build/config/win:lean_and_mean" ] + } public_configs = [ ":protobuf_gen_config" ] } @@ -4552,6 +4557,9 @@ if (!build_with_chromium && v8_use_perfetto) { "//build/config/compiler:no_chromium_code", ":protobuf_config", ] + if (is_win) { + configs -= [ "//build/config/win:lean_and_mean" ] + } public_configs = [ ":protobuf_gen_config" ] } @@ -4587,6 +4595,9 @@ if (!build_with_chromium && v8_use_perfetto) { "//build/config/compiler:no_chromium_code", ":protobuf_config", ] + if (is_win) { + configs -= [ "//build/config/win:lean_and_mean" ] + } public_configs = [ ":protobuf_gen_config" ] } diff --git a/gni/proto_library.gni b/gni/proto_library.gni index 6a00276289..cf581ed46e 100644 --- a/gni/proto_library.gni +++ b/gni/proto_library.gni @@ -13,6 +13,12 @@ template("proto_library") { set_sources_assignment_filter([]) + if (host_os == "win") { + host_executable_suffix = ".exe" + } else { + host_executable_suffix = "" + } + # All the proto imports should be relative to the project root. proto_in_dir = "//" if (defined(invoker.proto_in_dir)) { @@ -42,8 +48,9 @@ template("proto_library") { if (defined(invoker.generator_plugin_label)) { plugin_host_label = invoker.generator_plugin_label + "($host_toolchain)" - plugin_path = get_label_info(plugin_host_label, "root_out_dir") + "/" + - get_label_info(plugin_host_label, "name") + plugin_path = + get_label_info(plugin_host_label, "root_out_dir") + "/" + + get_label_info(plugin_host_label, "name") + host_executable_suffix generate_with_plugin = true } else if (defined(invoker.generator_plugin_script)) { plugin_path = invoker.generator_plugin_script @@ -107,7 +114,8 @@ template("proto_library") { outputs = get_path_info(protogens, "abspath") protoc_label = "//:protoc($host_toolchain)" - protoc_path = get_label_info(protoc_label, "root_out_dir") + "/protoc" + protoc_path = get_label_info(protoc_label, "root_out_dir") + "/protoc" + + host_executable_suffix args = [ # Path should be rebased because |root_build_dir| for current toolchain # may be different from |root_out_dir| of protoc built on host toolchain.