aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-03-21 19:51:57 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-03-21 19:51:57 +0000
commit918261018f7a7754a5e7f0fbb6ec96f9b269fd26 (patch)
tree3b604735d28f1bb5eea66c81df6d944712e0f20b
parente6507632c15ddd05c5e7a51f41b94b6208f3ab25 (diff)
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
-rw-r--r--Makefile2
-rw-r--r--gpu/include/GrConfig.h32
-rw-r--r--gpu/include/GrContext.h2
-rw-r--r--gpu/include/GrGLInterface.h5
-rw-r--r--gpu/include/GrNoncopyable.h2
-rw-r--r--gpu/include/GrRefCnt.h2
-rw-r--r--gpu/src/GrGLInterface.cpp4
-rw-r--r--gyp/skia.gyp11
-rw-r--r--include/gpu/SkGpuDevice.h2
-rw-r--r--include/gpu/SkGpuDeviceFactory.h2
-rw-r--r--vs/SampleApp/SampleApp.vcxproj4
-rw-r--r--xcode/gpu/gpu.xcodeproj/project.pbxproj9
12 files changed, 59 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index 3af2582dc4..c37f4c7501 100644
--- a/Makefile
+++ b/Makefile
@@ -26,6 +26,8 @@ else
DEFINES += -DSK_RELEASE -DGR_DEBUG=0
endif
+DEFINES += -DGR_IMPLEMENTATION=1
+
DEFINES += -DSK_SUPPORT_LCDTEXT
ifneq ($(SKIA_PDF_SUPPORT),false)
diff --git a/gpu/include/GrConfig.h b/gpu/include/GrConfig.h
index 780507495d..5a08077002 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
//
diff --git a/gpu/include/GrContext.h b/gpu/include/GrContext.h
index 1f90603f5d..4058c5b5dd 100644
--- a/gpu/include/GrContext.h
+++ b/gpu/include/GrContext.h
@@ -29,7 +29,7 @@ class GrIndexBufferAllocPool;
class GrInOrderDrawBuffer;
class GrPathRenderer;
-class GrContext : public GrRefCnt {
+class GR_API GrContext : public GrRefCnt {
public:
/**
* Creates a GrContext from within a 3D context.
diff --git a/gpu/include/GrGLInterface.h b/gpu/include/GrGLInterface.h
index 7a44f4f5e4..b43baccf8f 100644
--- a/gpu/include/GrGLInterface.h
+++ b/gpu/include/GrGLInterface.h
@@ -19,6 +19,7 @@
#define GrGLInterface_DEFINED
#include "GrGLPlatformIncludes.h"
+#include "GrTypes.h"
#if !defined(GR_GL_FUNCTION_TYPE)
#define GR_GL_FUNCTION_TYPE
@@ -38,8 +39,8 @@ void gl_version(int* major, int* minor);
* Routines managing the global interface used to invoke OpenGL calls.
*/
struct GrGLInterface;
-extern GrGLInterface* GrGLGetGLInterface();
-extern void GrGLSetGLInterface(GrGLInterface* gl_interface);
+GR_API GrGLInterface* GrGLGetGLInterface();
+GR_API void GrGLSetGLInterface(GrGLInterface* gl_interface);
/*
* Populates the global GrGLInterface pointer with an instance pointing to the
diff --git a/gpu/include/GrNoncopyable.h b/gpu/include/GrNoncopyable.h
index 888e3b173b..ab5d8ec45b 100644
--- a/gpu/include/GrNoncopyable.h
+++ b/gpu/include/GrNoncopyable.h
@@ -24,7 +24,7 @@
* Base for classes that want to disallow copying themselves. It makes its
* copy-constructor and assignment operators private (and unimplemented).
*/
-class GrNoncopyable {
+class GR_API GrNoncopyable {
public:
GrNoncopyable() {}
diff --git a/gpu/include/GrRefCnt.h b/gpu/include/GrRefCnt.h
index 7204aff198..a4667608c9 100644
--- a/gpu/include/GrRefCnt.h
+++ b/gpu/include/GrRefCnt.h
@@ -29,7 +29,7 @@
* It is an error (though only checked for in the debug build) to call unref()
* such that the reference count becomes 0.
*/
-class GrRefCnt : GrNoncopyable {
+class GR_API GrRefCnt : GrNoncopyable {
public:
GrRefCnt() : fRefCnt(1) {}
virtual ~GrRefCnt() {
diff --git a/gpu/src/GrGLInterface.cpp b/gpu/src/GrGLInterface.cpp
index 0bddd98a75..cc2c7bf07d 100644
--- a/gpu/src/GrGLInterface.cpp
+++ b/gpu/src/GrGLInterface.cpp
@@ -350,11 +350,11 @@ void GrGLInitializeGLInterface(GrGLInterface* glBindings) {
} // unnamed namespace
-void GrGLSetGLInterface(GrGLInterface* gl_interface) {
+GR_API void GrGLSetGLInterface(GrGLInterface* gl_interface) {
gGLInterface = gl_interface;
}
-GrGLInterface* GrGLGetGLInterface() {
+GR_API GrGLInterface* GrGLGetGLInterface() {
return gGLInterface;
}
diff --git a/gyp/skia.gyp b/gyp/skia.gyp
index e50122d878..53ea83b77d 100644
--- a/gyp/skia.gyp
+++ b/gyp/skia.gyp
@@ -300,7 +300,7 @@
'libraries': [
'-lfreetype',
],
- },
+ },
}],
[ 'OS == "mac"', {
'include_dirs': [
@@ -932,6 +932,9 @@
'../gpu/src/GrTextureCache.cpp',
'../gpu/src/gr_unittests.cpp',
],
+ 'defines': [
+ 'GR_IMPLEMENTATION=1',
+ ],
'conditions': [
[ 'OS == "linux"', {
'defines': [
@@ -942,7 +945,7 @@
'-lGL',
'-lX11',
],
- },
+ },
}],
[ 'OS == "mac"', {
'defines': [
@@ -952,7 +955,7 @@
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
],
- },
+ },
}],
[ 'OS == "win"', {
'defines': [
@@ -1015,7 +1018,7 @@
'../src/animator/SkAnimatorScript.cpp',
'../src/animator/SkAnimatorScript.h',
#'../src/animator/SkAnimatorScript2.cpp', fails on windows
- #'../src/animator/SkAnimatorScript2.h',
+ #'../src/animator/SkAnimatorScript2.h',
'../src/animator/SkBase64.cpp',
'../src/animator/SkBase64.h',
'../src/animator/SkBoundable.cpp',
diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h
index 8852803a06..fbe59297e7 100644
--- a/include/gpu/SkGpuDevice.h
+++ b/include/gpu/SkGpuDevice.h
@@ -30,7 +30,7 @@ class GrTextContext;
* Subclass of SkDevice, which directs all drawing to the GrGpu owned by the
* canvas.
*/
-class SkGpuDevice : public SkDevice {
+class SK_API SkGpuDevice : public SkDevice {
public:
/**
* The SkGpuDevice will render to the GrRenderTarget, or if the paremeter is
diff --git a/include/gpu/SkGpuDeviceFactory.h b/include/gpu/SkGpuDeviceFactory.h
index 5dcba6a293..a2e67f2336 100644
--- a/include/gpu/SkGpuDeviceFactory.h
+++ b/include/gpu/SkGpuDeviceFactory.h
@@ -21,7 +21,7 @@
class GrContext;
-class SkGpuDeviceFactory : public SkDeviceFactory {
+class SK_API SkGpuDeviceFactory : public SkDeviceFactory {
public:
/**
* The constructor will ref() the context, passing it to each device
diff --git a/vs/SampleApp/SampleApp.vcxproj b/vs/SampleApp/SampleApp.vcxproj
index 319d0b9714..602fda0d3c 100644
--- a/vs/SampleApp/SampleApp.vcxproj
+++ b/vs/SampleApp/SampleApp.vcxproj
@@ -54,7 +54,7 @@
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;GR_DEBUG=1;GR_IMPLEMENTATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include\core;..\..\include\xml;..\..\include\utils;..\..\include\config;..\..\include\views;..\..\src\core;..\..\include\images;..\..\include\effects;..\..\include\gpu;..\..\include\pdf;..\..\gpu\include;..\..\include\ports</AdditionalIncludeDirectories>
</ClCompile>
<Link>
@@ -72,7 +72,7 @@
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;GR_RELEASE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;GR_RELEASE=1;GR_IMPLEMENTATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include\core;..\..\include\xml;..\..\include\utils;..\..\include\config;..\..\include\views;..\..\src\core;..\..\include\images;..\..\include\effects;..\..\include\gpu;..\..\include\pdf;..\..\gpu\include;..\..\include\ports</AdditionalIncludeDirectories>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
</ClCompile>
diff --git a/xcode/gpu/gpu.xcodeproj/project.pbxproj b/xcode/gpu/gpu.xcodeproj/project.pbxproj
index e85c7ab459..155c2460e0 100644
--- a/xcode/gpu/gpu.xcodeproj/project.pbxproj
+++ b/xcode/gpu/gpu.xcodeproj/project.pbxproj
@@ -540,6 +540,10 @@
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "GR_IMPLEMENTATION=1",
+ "GR_DEBUG=1",
+ );
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
@@ -553,7 +557,10 @@
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_PREPROCESSOR_DEFINITIONS = "GR_RELEASE=1";
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "GR_IMPLMENTATION=1",
+ "GR_RELEASE=1",
+ );
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;