Commit 22eab922 by apatrick@chromium.org

Allowed translator_hlsl and glsl to be built as shared libs on windows.

The problem was gyp was out-of-date (I rolled it to 1080) and ShaderLang.cpp exports were not being exported because it was in translator_common which is a static lib. I tested shared library and static library builds in debug and release and also the checked in ANGLE.sln build. See original attempt: http://codereview.appspot.com/5305052/. Review URL: http://codereview.appspot.com/5305053 git-svn-id: https://angleproject.googlecode.com/svn/trunk@801 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 72e8f447
deps = { deps = {
"trunk/third_party/gyp": "trunk/third_party/gyp":
"http://gyp.googlecode.com/svn/trunk@800", "http://gyp.googlecode.com/svn/trunk@1080",
} }
hooks = [ hooks = [
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
{ {
'variables': { 'variables': {
'library%': 'shared_library', 'component%': 'static_library',
}, },
'target_defaults': { 'target_defaults': {
'default_configuration': 'Debug', 'default_configuration': 'Debug',
...@@ -81,6 +81,11 @@ ...@@ -81,6 +81,11 @@
}, },
}, # Release }, # Release
}, # configurations }, # configurations
'conditions': [
['component=="shared_library"', {
'defines': ['COMPONENT_BUILD'],
}],
],
}, # target_defaults }, # target_defaults
'conditions': [ 'conditions': [
['OS=="win"', { ['OS=="win"', {
......
...@@ -6,6 +6,23 @@ ...@@ -6,6 +6,23 @@
#ifndef _COMPILER_INTERFACE_INCLUDED_ #ifndef _COMPILER_INTERFACE_INCLUDED_
#define _COMPILER_INTERFACE_INCLUDED_ #define _COMPILER_INTERFACE_INCLUDED_
#if defined(COMPONENT_BUILD)
#if defined(_WIN32) || defined(_WIN64)
#if defined(COMPILER_IMPLEMENTATION)
#define COMPILER_EXPORT __declspec(dllexport)
#else
#define COMPILER_EXPORT __declspec(dllimport)
#endif // defined(COMPILER_IMPLEMENTATION)
#else // defined(WIN32)
#define COMPILER_EXPORT __attribute__((visibility("default")))
#endif
#else // defined(COMPONENT_BUILD)
#define COMPILER_EXPORT
#endif
// //
// This is the platform independent interface between an OGL driver // This is the platform independent interface between an OGL driver
// and the shading language compiler. // and the shading language compiler.
...@@ -93,12 +110,12 @@ typedef enum { ...@@ -93,12 +110,12 @@ typedef enum {
// compiler operations. // compiler operations.
// If the function succeeds, the return value is nonzero, else zero. // If the function succeeds, the return value is nonzero, else zero.
// //
int ShInitialize(); COMPILER_EXPORT int ShInitialize();
// //
// Driver should call this at shutdown. // Driver should call this at shutdown.
// If the function succeeds, the return value is nonzero, else zero. // If the function succeeds, the return value is nonzero, else zero.
// //
int ShFinalize(); COMPILER_EXPORT int ShFinalize();
// //
// Implementation dependent built-in resources (constants and extensions). // Implementation dependent built-in resources (constants and extensions).
...@@ -125,7 +142,7 @@ typedef struct ...@@ -125,7 +142,7 @@ typedef struct
// //
// Initialize built-in resources with minimum expected values. // Initialize built-in resources with minimum expected values.
// //
void ShInitBuiltInResources(ShBuiltInResources* resources); COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources* resources);
// //
// ShHandle held by but opaque to the driver. It is allocated, // ShHandle held by but opaque to the driver. It is allocated,
...@@ -148,10 +165,12 @@ typedef void* ShHandle; ...@@ -148,10 +165,12 @@ typedef void* ShHandle;
// output: Specifies the output code type - SH_ESSL_OUTPUT, SH_GLSL_OUTPUT, // output: Specifies the output code type - SH_ESSL_OUTPUT, SH_GLSL_OUTPUT,
// or SH_HLSL_OUTPUT. // or SH_HLSL_OUTPUT.
// resources: Specifies the built-in resources. // resources: Specifies the built-in resources.
ShHandle ShConstructCompiler(ShShaderType type, ShShaderSpec spec, COMPILER_EXPORT ShHandle ShConstructCompiler(
ShShaderOutput output, ShShaderType type,
const ShBuiltInResources* resources); ShShaderSpec spec,
void ShDestruct(ShHandle handle); ShShaderOutput output,
const ShBuiltInResources* resources);
COMPILER_EXPORT void ShDestruct(ShHandle handle);
// //
// Compiles the given shader source. // Compiles the given shader source.
...@@ -178,7 +197,7 @@ void ShDestruct(ShHandle handle); ...@@ -178,7 +197,7 @@ void ShDestruct(ShHandle handle);
// Can be queried by calling ShGetActiveAttrib() and // Can be queried by calling ShGetActiveAttrib() and
// ShGetActiveUniform(). // ShGetActiveUniform().
// //
int ShCompile( COMPILER_EXPORT int ShCompile(
const ShHandle handle, const ShHandle handle,
const char* const shaderStrings[], const char* const shaderStrings[],
const int numStrings, const int numStrings,
...@@ -206,7 +225,9 @@ int ShCompile( ...@@ -206,7 +225,9 @@ int ShCompile(
// the null termination character. // the null termination character.
// //
// params: Requested parameter // params: Requested parameter
void ShGetInfo(const ShHandle handle, ShShaderInfo pname, int* params); COMPILER_EXPORT void ShGetInfo(const ShHandle handle,
ShShaderInfo pname,
int* params);
// Returns nul-terminated information log for a compiled shader. // Returns nul-terminated information log for a compiled shader.
// Parameters: // Parameters:
...@@ -216,7 +237,7 @@ void ShGetInfo(const ShHandle handle, ShShaderInfo pname, int* params); ...@@ -216,7 +237,7 @@ void ShGetInfo(const ShHandle handle, ShShaderInfo pname, int* params);
// to accomodate the information log. The size of the buffer required // to accomodate the information log. The size of the buffer required
// to store the returned information log can be obtained by calling // to store the returned information log can be obtained by calling
// ShGetInfo with SH_INFO_LOG_LENGTH. // ShGetInfo with SH_INFO_LOG_LENGTH.
void ShGetInfoLog(const ShHandle handle, char* infoLog); COMPILER_EXPORT void ShGetInfoLog(const ShHandle handle, char* infoLog);
// Returns null-terminated object code for a compiled shader. // Returns null-terminated object code for a compiled shader.
// Parameters: // Parameters:
...@@ -226,7 +247,7 @@ void ShGetInfoLog(const ShHandle handle, char* infoLog); ...@@ -226,7 +247,7 @@ void ShGetInfoLog(const ShHandle handle, char* infoLog);
// accomodate the object code. The size of the buffer required to // accomodate the object code. The size of the buffer required to
// store the returned object code can be obtained by calling // store the returned object code can be obtained by calling
// ShGetInfo with SH_OBJECT_CODE_LENGTH. // ShGetInfo with SH_OBJECT_CODE_LENGTH.
void ShGetObjectCode(const ShHandle handle, char* objCode); COMPILER_EXPORT void ShGetObjectCode(const ShHandle handle, char* objCode);
// Returns information about an active attribute variable. // Returns information about an active attribute variable.
// Parameters: // Parameters:
...@@ -247,13 +268,13 @@ void ShGetObjectCode(const ShHandle handle, char* objCode); ...@@ -247,13 +268,13 @@ void ShGetObjectCode(const ShHandle handle, char* objCode);
// memory (SH_MAPPED_NAME_MAX_LENGTH), or NULL if don't care // memory (SH_MAPPED_NAME_MAX_LENGTH), or NULL if don't care
// about the mapped name. If the name is not mapped, then name and // about the mapped name. If the name is not mapped, then name and
// mappedName are the same. // mappedName are the same.
void ShGetActiveAttrib(const ShHandle handle, COMPILER_EXPORT void ShGetActiveAttrib(const ShHandle handle,
int index, int index,
int* length, int* length,
int* size, int* size,
ShDataType* type, ShDataType* type,
char* name, char* name,
char* mappedName); char* mappedName);
// Returns information about an active uniform variable. // Returns information about an active uniform variable.
// Parameters: // Parameters:
...@@ -274,13 +295,13 @@ void ShGetActiveAttrib(const ShHandle handle, ...@@ -274,13 +295,13 @@ void ShGetActiveAttrib(const ShHandle handle,
// memory (SH_MAPPED_NAME_MAX_LENGTH), or NULL if don't care // memory (SH_MAPPED_NAME_MAX_LENGTH), or NULL if don't care
// about the mapped name. If the name is not mapped, then name and // about the mapped name. If the name is not mapped, then name and
// mappedName are the same. // mappedName are the same.
void ShGetActiveUniform(const ShHandle handle, COMPILER_EXPORT void ShGetActiveUniform(const ShHandle handle,
int index, int index,
int* length, int* length,
int* size, int* size,
ShDataType* type, ShDataType* type,
char* name, char* name,
char* mappedName); char* mappedName);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
#define MAJOR_VERSION 0 #define MAJOR_VERSION 0
#define MINOR_VERSION 0 #define MINOR_VERSION 0
#define BUILD_VERSION 0 #define BUILD_VERSION 0
#define BUILD_REVISION 800 #define BUILD_REVISION 801
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment