Start on fiddle.
authormtklein <mtklein@chromium.org>
Tue, 26 Jul 2016 20:55:45 +0000 (13:55 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 26 Jul 2016 20:55:45 +0000 (13:55 -0700)
Mostly stolen from Joe.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2188493002

Review-Url: https://codereview.chromium.org/2188493002

BUILD.gn
gn/echo_headers.py [new file with mode: 0644]

index 7ead5f7bbfc0c4de18f251c793d5a82485e8ded8..1ddf12a9579855a38fdfe746e655ca0bb2958514 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -6,21 +6,25 @@
 declare_args() {
 }
 
+skia_public_includes = [
+  "include/codec",
+  "include/config",
+  "include/core",
+  "include/effects",
+  "include/gpu",
+  "include/gpu/gl",
+  "include/images",
+  "include/pathops",
+  "include/ports",
+  "include/utils",
+  "include/utils/mac",
+
+  "include/c",   # TODO: move back to top, order shouldn't matter
+]
+
 # Skia public API, generally provided by :skia.
 config("skia_public") {
-  include_dirs = [
-    "include/c",
-    "include/config",
-    "include/core",
-    "include/effects",
-    "include/gpu",
-    "include/images",
-    "include/lazy",
-    "include/pathops",
-    "include/ports",
-    "include/utils",
-    "include/utils/mac",
-  ]
+  include_dirs = skia_public_includes
   defines = [ "SKIA_DLL" ]
 }
 
@@ -31,6 +35,7 @@ config("skia_private") {
   include_dirs = [
     "include/private",
     "src/c",
+    "src/codec",
     "src/config",
     "src/core",
     "src/effects",
@@ -146,6 +151,11 @@ component("skia") {
     "//third_party/zlib",
   ]
 
+  defines = [
+    "SK_HAS_JPEG_LIBRARY",
+    "SK_HAS_PNG_LIBRARY",
+  ]
+
   libs = [ "pthread" ]
 
   sources = []
@@ -156,11 +166,27 @@ component("skia") {
   sources += pdf_gypi.sources
   sources += utils_gypi.sources
   sources += [
+    "src/codec/SkBmpCodec.cpp",
+    "src/codec/SkBmpMaskCodec.cpp",
+    "src/codec/SkBmpRLECodec.cpp",
+    "src/codec/SkBmpStandardCodec.cpp",
+    "src/codec/SkCodec.cpp",
+    "src/codec/SkCodecImageGenerator.cpp",
+    "src/codec/SkIcoCodec.cpp",
+    "src/codec/SkJpegCodec.cpp",
+    "src/codec/SkJpegDecoderMgr.cpp",
+    "src/codec/SkJpegUtility.cpp",
+    "src/codec/SkMaskSwizzler.cpp",
+    "src/codec/SkMasks.cpp",
+    "src/codec/SkPngCodec.cpp",
+    "src/codec/SkSampler.cpp",
+    "src/codec/SkSwizzler.cpp",
+    "src/codec/SkWbmpCodec.cpp",
     "src/images/SkImageEncoder.cpp",
     "src/images/SkImageEncoder_Factory.cpp",
     "src/ports/SkDiscardableMemory_none.cpp",
     "src/ports/SkGlobalInitialization_default.cpp",
-    "src/ports/SkImageGenerator_none.cpp",
+    "src/ports/SkImageGenerator_skia.cpp",
     "src/ports/SkMemory_malloc.cpp",
     "src/ports/SkOSFile_stdio.cpp",
     "src/sfnt/SkOTTable_name.cpp",
@@ -225,16 +251,25 @@ component("skia") {
   }
 }
 
-executable("example") {
+action("skia.h") {
+  script = "gn/echo_headers.py"
+  args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
+         rebase_path(skia_public_includes, root_build_dir)
+  outputs = [
+    "$target_gen_dir/skia.h",
+  ]
+}
+
+executable("fiddle") {
+  include_dirs = [ "$target_gen_dir" ]
+  libs = [ "OSMesa" ]
+
   sources = [
-    "cmake/example.cpp",
+    "tools/fiddle/draw.cpp",
+    "tools/fiddle/fiddle_main.cpp",
   ]
   deps = [
     ":skia",
+    ":skia.h",
   ]
-
-  libs = []
-  if (is_mac) {
-    libs += [ "OpenGL.framework" ]
-  }
 }
diff --git a/gn/echo_headers.py b/gn/echo_headers.py
new file mode 100644 (file)
index 0000000..325124f
--- /dev/null
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+#
+# Copyright 2016 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+import os
+import os.path
+
+blacklist = [
+  'GrGLConfig_chrome.h',
+]
+
+headers = []
+for d in sys.argv[2:]:
+  headers.extend([f for f in os.listdir(d)
+                  if os.path.isfile(os.path.join(d,f))])
+with open(sys.argv[1], "w") as f:
+  f.write('// skia.h generated by GN.\n')
+  f.write('#ifndef skia_h_DEFINED\n')
+  f.write('#define skia_h_DEFINED\n')
+  for h in headers:
+    if h not in blacklist:
+      f.write('#include "' + h + '"\n')
+  f.write('#endif//skia_h_DEFINED\n')