resources:  optionally link them into our binary

To enable, set skia_embed_resources=true in args.gn.

Also add *-EmbededResouces bots.

Change-Id: Ia69b26e926a3ad4676a4fa021894432ea2104538
Reviewed-on: https://skia-review.googlesource.com/82626
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index f4740cf..c9e77bd 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -30,6 +30,7 @@
   skia_use_zlib = true
   skia_use_metal = false
   skia_use_libheif = is_skia_dev_build
+  skia_embed_resources = false
 
   skia_android_serial = ""
   skia_enable_discrete_gpu = true
@@ -903,6 +904,17 @@
       include_dirs += [ "tools/gpu/vk" ]
     }
   }
+  action("binary_resources.cpp") {
+    script = "gn/generate_binary_asset.py"
+    args = [
+      rebase_path("resources"),
+      "gResources",
+      rebase_path("$target_gen_dir/binary_resources.cpp", root_build_dir),
+    ]
+    outputs = [
+      "$target_gen_dir/binary_resources.cpp",
+    ]
+  }
   action("skia.h") {
     public_configs = [ ":skia.h_config" ]
     skia_h = "$target_gen_dir/skia.h"
@@ -1251,6 +1263,11 @@
     public_deps = [
       "//third_party/jsoncpp",
     ]
+    if (skia_embed_resources) {
+      defines = [ "SK_EMBED_RESOURCES" ]
+      sources += [ "$target_gen_dir/binary_resources.cpp" ]
+      deps += [ ":binary_resources.cpp" ]
+    }
   }
 
   import("gn/gm.gni")