Add GR_DLL builds to Ganesh (minimal exports for Chrome multi-dll for now).

Review URL:  http://codereview.appspot.com/4301044/




git-svn-id: http://skia.googlecode.com/svn/trunk@970 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/include/GrConfig.h b/gpu/include/GrConfig.h
index 7805074..5a08077 100644
--- a/gpu/include/GrConfig.h
+++ b/gpu/include/GrConfig.h
@@ -113,8 +113,9 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 /*
- *  Pull stdint.h in before user-config, to be sure our __STDC... macros are
- *  defined before anyone else might try to include stdint.h
+ *  Include stdint.h with defines that trigger declaration of C99 limit/const
+ *  macros here before anyone else has a chance to include stdint.h without 
+ *  these.
  */
 #define __STDC_LIMIT_MACROS
 #define __STDC_CONSTANT_MACROS
@@ -141,6 +142,33 @@
 ///////////////////////////////////////////////////////////////////////////////
 // postconfig section:
 //
+
+// GR_IMPLEMENTATION should be define to 1 when building Gr and 0 when including
+// it in another dependent build. The Gr makefile/ide-project should define this
+// to 1.
+#if !defined(GR_IMPLEMENTATION)
+    #define GR_IMPLEMENTATION 0
+#endif
+
+// If Gr is built as a shared library then GR_DLL should be defined to 1 (both
+// when building Gr and when including its headers in dependent builds). Only
+// currently supported minimally for Chrome's Win32 Multi-DLL build (TODO:
+// correctly exort all of the public API correctly and support shared lib on
+// other platforms).
+#if !defined(GR_DLL)
+    #define GR_DLL 0
+#endif
+
+#if GR_WIN32_BUILD && GR_DLL
+    #if GR_IMPLEMENTATION
+        #define GR_API __declspec(dllexport)
+    #else
+        #define GR_API __declspec(dllimport)
+    #endif
+#else
+    #define GR_API
+#endif
+
 // By now we must have a GR_..._BUILD symbol set to 1, and a decision about
 // debug -vs- release
 //