Don't use shared libraries in the wire fuzzer.

Otherwise UBSan complains that C++ types are different between the
shared libraries because libc++ is linked statically.

BUG=chromium:904736

Change-Id: I51ef40d1f7910fd693a4585c74ff404812472d2e
Reviewed-on: https://dawn-review.googlesource.com/c/2380
Reviewed-by: Dan Sinclair <dsinclair@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index cc0fc28..9d5983e 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -244,16 +244,32 @@
   ]
 }
 
+config("libdawn_export") {
+  defines = [ "DAWN_IMPLEMENTATION" ]
+}
+
+source_set("libdawn_sources") {
+  public_deps = [
+    ":dawn_headers",
+  ]
+
+  deps = [
+    ":libdawn_gen",
+  ]
+  sources = get_target_outputs(":libdawn_gen")
+
+  # Put the export config public so that dependents use the same declspec.
+  public_configs = [ ":libdawn_export" ]
+}
+
 shared_library("libdawn") {
   public_deps = [
     ":dawn_headers",
   ]
 
-  defines = [ "DAWN_IMPLEMENTATION" ]
   deps = [
-    ":libdawn_gen",
+    ":libdawn_sources",
   ]
-  sources = get_target_outputs(":libdawn_gen")
 
   # Tell dependents where to find this shared library
   if (is_mac) {
@@ -270,7 +286,6 @@
 
 config("libdawn_native_internal") {
   configs = [ ":dawn_internal" ]
-  defines = [ "DAWN_NATIVE_IMPLEMENTATION" ]
 
   # Suppress warnings that Metal isn't in the deployment target of Chrome
   if (is_mac) {
@@ -278,6 +293,10 @@
   }
 }
 
+config("libdawn_native_export") {
+  defines = [ "DAWN_NATIVE_IMPLEMENTATION" ]
+}
+
 dawn_generator("libdawn_native_utils_gen") {
   target = "dawn_native_utils"
   outputs = [
@@ -319,14 +338,10 @@
     "third_party:spirv_cross",
   ]
 
-  # Put the internal config public so that unittests can see internal headers
-  public_configs = [ ":libdawn_native_internal" ]
+  # Put the export config public so that dependents use the same declspec.
+  public_configs = [ ":libdawn_native_export" ]
 
-  # Set the headers as a public dependency so they are visible to unittests
-  public_deps = [
-    ":libdawn_native_headers",
-  ]
-
+  configs += [ ":libdawn_native_internal" ]
   libs = []
 
   sources = get_target_outputs(":libdawn_native_utils_gen")
@@ -633,6 +648,10 @@
   ]
 }
 
+config("libdawn_wire_export") {
+  defines = [ "DAWN_WIRE_IMPLEMENTATION" ]
+}
+
 dawn_generator("libdawn_wire_gen") {
   target = "dawn_wire"
   outputs = [
@@ -643,7 +662,7 @@
   ]
 }
 
-shared_library("libdawn_wire") {
+source_set("libdawn_wire_sources") {
   deps = [
     ":dawn_common",
     ":libdawn_wire_gen",
@@ -651,11 +670,23 @@
   ]
 
   configs += [ ":dawn_internal" ]
-  defines = [ "DAWN_WIRE_IMPLEMENTATION" ]
   sources = get_target_outputs(":libdawn_wire_gen")
   sources += [ "src/dawn_wire/WireCmd.h" ]
 
-  #Make headers publically visible
+  # Make headers publically visible
+  public_deps = [
+    ":libdawn_wire_headers",
+  ]
+  public_configs = [ ":libdawn_public" ]
+
+  # Put the export config public so that dependents use the same declspec.
+  public_configs += [ ":libdawn_wire_export" ]
+}
+
+shared_library("libdawn_wire") {
+  deps = [ ":libdawn_wire_sources" ]
+
+  # Make headers publically visible
   public_deps = [
     ":libdawn_wire_headers",
   ]
@@ -754,6 +785,10 @@
     "third_party:gmock_and_gtest",
   ]
 
+  # Add internal Dawn Native headers and config for internal unittests.
+  deps += [ ":libdawn_native_headers" ]
+  configs += [ ":libdawn_native_internal" ]
+
   sources = get_target_outputs(":mock_dawn_gen")
   sources += [
     "src/tests/unittests/BitSetIteratorTests.cpp",