Add support for WGSL writing to BUILD.gn

BUG=tint:49

Change-Id: I4473176d4177a719b7b2659f765b6b467ac43c84
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19682
Reviewed-by: dan sinclair <dsinclair@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 41e7327..a3b566b 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -38,6 +38,12 @@
   } else {
     defines += [ "TINT_BUILD_WGSL_READER=0" ]
   }
+
+  if (tint_build_wgsl_writer) {
+    defines += [ "TINT_BUILD_WGSL_WRITER=1" ]
+  } else {
+    defines += [ "TINT_BUILD_WGSL_WRITER=0" ]
+  }
 }
 
 # libtint source sets are divided into a non-optional core in :libtint_core and
@@ -302,6 +308,22 @@
   }
 }
 
+source_set("libtint_wgsl_writer") {
+  sources = [
+    "src/writer/wgsl/generator.cc",
+    "src/writer/wgsl/generator.h",
+    "src/writer/wgsl/generator_impl.cc",
+    "src/writer/wgsl/generator_impl.h",
+  ]
+
+  configs += [ ":tint_common_config" ]
+
+  if (build_with_chromium) {
+    configs -= [ "//build/config/compiler:chromium_code" ]
+    configs += [ "//build/config/compiler:no_chromium_code" ]
+  }
+}
+
 source_set("libtint") {
   deps = [ ":libtint_core" ]
 
@@ -317,6 +339,10 @@
     deps += [ ":libtint_wgsl_reader" ]
   }
 
+  if (tint_build_wgsl_writer) {
+    deps += [ ":libtint_wgsl_writer" ]
+  }
+
   configs += [ ":tint_common_config" ]
 
   if (build_with_chromium) {