ports for mac, ios, android, linux, windows
R=djsollen@google.com
Review URL: https://codereview.chromium.org/19787006
git-svn-id: http://skia.googlecode.com/svn/trunk@10239 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/skpdiff/main.cpp b/experimental/skpdiff/main.cpp
index 7ed0e4d..9664f33 100644
--- a/experimental/skpdiff/main.cpp
+++ b/experimental/skpdiff/main.cpp
@@ -6,9 +6,16 @@
*/
#if SK_SUPPORT_OPENCL
+
#define __NO_STD_VECTOR // Uses cl::vectpr instead of std::vectpr
#define __NO_STD_STRING // Uses cl::STRING_CLASS instead of std::string
-#include <CL/cl.hpp>
+#if SK_BUILD_FOR_MAC
+// Note that some macs don't have this header and it can be downloaded from the Khronos registry
+# include <OpenCL/cl.hpp>
+#else
+# include <CL/cl.hpp>
+#endif
+
#endif
#include "SkCommandLineFlags.h"
@@ -36,7 +43,7 @@
#if SK_SUPPORT_OPENCL
/// A callback for any OpenCL errors
-CL_CALLBACK void error_notify(const char* errorInfo, const void* privateInfoSize, ::size_t cb, void* userData) {
+static void CL_CALLBACK error_notify(const char* errorInfo, const void* privateInfoSize, ::size_t cb, void* userData) {
SkDebugf("OpenCL error notify: %s\n", errorInfo);
exit(1);
}
@@ -56,8 +63,8 @@
// Query for a device
cl::vector<cl::Device> deviceList;
- platform.getDevices(CL_DEVICE_TYPE_GPU, &deviceList);
- SkDebugf("The number of GPU devices is %u\n", deviceList.size());
+ platform.getDevices(CL_DEVICE_TYPE_ALL, &deviceList);
+ SkDebugf("The number of devices is %u\n", deviceList.size());
// Print some information about the device for debugging
*device = deviceList[0];
@@ -100,7 +107,8 @@
// A null terminated array of pointer to every differ declared above
SkImageDiffer* gDiffers[] = { &gDiffPixel, &gPDiff, NULL };
-int main(int argc, char** argv) {
+int tool_main(int argc, char * argv[]);
+int tool_main(int argc, char * argv[]) {
// Setup command line parsing
SkCommandLineFlags::SetUsage("Compare images using various metrics.");
SkCommandLineFlags::Parse(argc, argv);
@@ -203,3 +211,9 @@
return 0;
}
+
+#if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
+int main(int argc, char * argv[]) {
+ return tool_main(argc, (char**) argv);
+}
+#endif