Add GYP target for sk_tool_utils.* component.
This declares a static library target in gyp/sk_tool_utils.gyp, so other
targets can depend directly on it instead of including the source file
in their source lists.
BUG=None
TEST=make all
R=mtklein@google.com
Author: tfarina@chromium.org
Review URL: https://codereview.chromium.org/348623006
diff --git a/gyp/SampleApp.gyp b/gyp/SampleApp.gyp
index 9ced81b..2bbabf9 100644
--- a/gyp/SampleApp.gyp
+++ b/gyp/SampleApp.gyp
@@ -134,9 +134,6 @@
# Lua
'../src/utils/SkLuaCanvas.cpp',
'../src/utils/SkLua.cpp',
-
- # tools
- '../tools/sk_tool_utils.cpp',
],
'sources!': [
'../samplecode/SampleSkLayer.cpp', #relies on SkMatrix44 which doesn't compile
@@ -152,6 +149,7 @@
'pdf.gyp:pdf',
'skia_lib.gyp:skia_lib',
'tools.gyp:resources',
+ 'tools.gyp:sk_tool_utils',
'views.gyp:views',
'views_animated.gyp:views_animated',
'xml.gyp:xml',
diff --git a/gyp/bench.gyp b/gyp/bench.gyp
index 1c19437..9089bf8 100644
--- a/gyp/bench.gyp
+++ b/gyp/bench.gyp
@@ -15,6 +15,7 @@
'skia_lib.gyp:skia_lib',
'tools.gyp:crash_handler',
'tools.gyp:resources',
+ 'tools.gyp:sk_tool_utils',
'tools.gyp:timer',
],
'sources': [
@@ -24,7 +25,6 @@
'../bench/GMBench.h',
'../bench/ResultsWriter.cpp',
'../bench/benchmain.cpp',
- '../tools/sk_tool_utils.cpp',
],
'conditions': [
['skia_gpu == 1',
diff --git a/gyp/tests.gypi b/gyp/tests.gypi
index f135107..9876f18 100644
--- a/gyp/tests.gypi
+++ b/gyp/tests.gypi
@@ -23,6 +23,7 @@
'skia_lib.gyp:skia_lib',
'tools.gyp:picture_utils',
'tools.gyp:resources',
+ 'tools.gyp:sk_tool_utils',
],
'sources': [
'../tests/Test.cpp',
@@ -197,7 +198,5 @@
'../tests/TDStackNesterTest.cpp',
'../experimental/PdfViewer/src/SkTDStackNester.h',
-
- '../tools/sk_tool_utils.cpp',
],
}
diff --git a/gyp/tools.gyp b/gyp/tools.gyp
index eeb210a..6913cc1 100644
--- a/gyp/tools.gyp
+++ b/gyp/tools.gyp
@@ -49,10 +49,10 @@
'include_dirs' : [ '../src/utils/' ],
'sources': [
'../gm/gm_expectations.cpp',
- '../tools/sk_tool_utils.cpp',
],
'dependencies': [
'jsoncpp.gyp:jsoncpp',
+ 'sk_tool_utils',
'skia_lib.gyp:skia_lib',
],
'direct_dependent_settings': {
@@ -84,7 +84,18 @@
'skia_lib.gyp:skia_lib',
],
'direct_dependent_settings': {
- 'include_dirs': [ '../tools/', ],
+ 'include_dirs': [ '../tools', ],
+ },
+ },
+ {
+ 'target_name': 'sk_tool_utils',
+ 'type': 'static_library',
+ 'sources': [ '../tools/sk_tool_utils.cpp' ],
+ 'dependencies': [
+ 'skia_lib.gyp:skia_lib',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [ '../tools', ],
},
},
{
diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp
index 3eb5555..c75c496 100644
--- a/tools/sk_tool_utils.cpp
+++ b/tools/sk_tool_utils.cpp
@@ -1,5 +1,15 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
#include "sk_tool_utils.h"
+#include "SkBitmap.h"
+#include "SkCanvas.h"
+
namespace sk_tool_utils {
const char* colortype_name(SkColorType ct) {
@@ -29,4 +39,4 @@
canvas->writePixels(info, tmp.getPixels(), tmp.rowBytes(), x, y);
}
-}
+} // namespace sk_tool_utils
diff --git a/tools/sk_tool_utils.h b/tools/sk_tool_utils.h
index 48fd716..2bd42b6 100644
--- a/tools/sk_tool_utils.h
+++ b/tools/sk_tool_utils.h
@@ -8,8 +8,10 @@
#ifndef sk_tool_utils_DEFINED
#define sk_tool_utils_DEFINED
-#include "SkCanvas.h"
-#include "SkBitmap.h"
+#include "SkImageInfo.h"
+
+class SkBitmap;
+class SkCanvas;
namespace sk_tool_utils {
@@ -20,6 +22,7 @@
* the pixels are colorType + alphaType
*/
void write_pixels(SkCanvas*, const SkBitmap&, int x, int y, SkColorType, SkAlphaType);
-}
-#endif
+} // namespace sk_tool_utils
+
+#endif // sk_tool_utils_DEFINED