processor: Allow building in chromium as a lib

Makes it possible to build TraceProcessor as a library in chromium, in
preparation for switching to TraceProcessor for proto2json trace
conversion.

Change-Id: Ia55317b3c8d88de73d2c2df4d53db77df9d1af51
diff --git a/BUILD.gn b/BUILD.gn
index bf85e54..b14cf0c 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -296,11 +296,11 @@
 
 if (perfetto_build_with_embedder) {
   if (build_with_chromium) {
-    libperfetto_target_type = "component"
+    lib_target_type = "component"
   } else {
-    libperfetto_target_type = "source_set"
+    lib_target_type = "source_set"
   }
-  target(libperfetto_target_type, "libperfetto") {
+  target(lib_target_type, "libperfetto") {
     public_configs = [ "gn:public_config" ]
     deps = [
       "src/tracing",
@@ -316,6 +316,17 @@
       "protos/perfetto/trace/track_event:zero",
     ]
   }
+  target(lib_target_type, "libtrace_processor") {
+    public_configs = [ "gn:public_config" ]
+    deps = [
+      "src/trace_processor:lib",
+    ]
+    configs -= [ "//build/config/compiler:chromium_code" ]
+    configs += [ "//build/config/compiler:no_chromium_code" ]
+    public_deps = [
+      "include/perfetto/trace_processor",
+    ]
+  }
 }
 
 if (perfetto_build_standalone) {