Commit 2b6008c9 by Geoff Lang

Merge 36622943 from master.

Create a static translator project and allow the previous translator project to be used in component builds.
parent 7c697201
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
{ {
'target_name': 'essl_to_glsl', 'target_name': 'essl_to_glsl',
'type': 'executable', 'type': 'executable',
'dependencies': [ '../src/angle.gyp:translator', ], 'dependencies': [ '../src/angle.gyp:translator_static', ],
'include_dirs': [ '../include', ], 'include_dirs': [ '../include', ],
'sources': [ '<!@(python enumerate_files.py translator -types *.cpp *.h)' ], 'sources': [ '<!@(python enumerate_files.py translator -types *.cpp *.h)' ],
}, },
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
{ {
'target_name': 'essl_to_hlsl', 'target_name': 'essl_to_hlsl',
'type': 'executable', 'type': 'executable',
'dependencies': [ '../src/angle.gyp:translator', ], 'dependencies': [ '../src/angle.gyp:translator_static', ],
'include_dirs': 'include_dirs':
[ [
'../include', '../include',
......
...@@ -15,6 +15,34 @@ ...@@ -15,6 +15,34 @@
{ {
'target_name': 'translator', 'target_name': 'translator',
'type': '<(component)',
'dependencies': [ 'preprocessor' ],
'include_dirs':
[
'.',
'../include',
],
'defines':
[
'COMPILER_IMPLEMENTATION',
],
'sources': [ '<!@(python enumerate_files.py compiler/translator third_party/compiler common -types *.cpp *.h *.y *.l )', ],
'conditions':
[
['OS=="win"',
{
'msvs_disabled_warnings': [ 4267 ],
'sources/': [ [ 'exclude', 'compiler/translator/ossource_posix.cpp' ], ],
},
{ # else: posix
'sources/': [ [ 'exclude', 'compiler/translator/ossource_win.cpp' ], ],
}
],
],
},
{
'target_name': 'translator_static',
'type': 'static_library', 'type': 'static_library',
'dependencies': [ 'preprocessor' ], 'dependencies': [ 'preprocessor' ],
'include_dirs': 'include_dirs':
...@@ -26,6 +54,13 @@ ...@@ -26,6 +54,13 @@
[ [
'COMPILER_IMPLEMENTATION', 'COMPILER_IMPLEMENTATION',
], ],
'direct_dependent_settings':
{
'defines':
[
'ANGLE_TRANSLATOR_STATIC',
],
},
'sources': [ '<!@(python enumerate_files.py compiler/translator third_party/compiler common -types *.cpp *.h *.y *.l )', ], 'sources': [ '<!@(python enumerate_files.py compiler/translator third_party/compiler common -types *.cpp *.h *.y *.l )', ],
'conditions': 'conditions':
[ [
......
// //
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
#include "compiler/translator/TranslatorGLSL.h"
#include "compiler/translator/TranslatorESSL.h" #include "compiler/translator/TranslatorESSL.h"
#include "compiler/translator/TranslatorGLSL.h"
#include "compiler/translator/TranslatorHLSL.h"
// //
// This function must be provided to create the actual // This function must be provided to create the actual
...@@ -16,11 +17,14 @@ TCompiler* ConstructCompiler( ...@@ -16,11 +17,14 @@ TCompiler* ConstructCompiler(
ShShaderType type, ShShaderSpec spec, ShShaderOutput output) ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
{ {
switch (output) { switch (output) {
case SH_GLSL_OUTPUT: case SH_ESSL_OUTPUT:
return new TranslatorGLSL(type, spec);
case SH_ESSL_OUTPUT:
return new TranslatorESSL(type, spec); return new TranslatorESSL(type, spec);
default: case SH_GLSL_OUTPUT:
return new TranslatorGLSL(type, spec);
case SH_HLSL9_OUTPUT:
case SH_HLSL11_OUTPUT:
return new TranslatorHLSL(type, spec, output);
default:
return NULL; return NULL;
} }
} }
......
//
// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "compiler/translator/TranslatorHLSL.h"
//
// This function must be provided to create the actual
// compile object used by higher level code. It returns
// a subclass of TCompiler.
//
TCompiler* ConstructCompiler(
ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
{
switch (output)
{
case SH_HLSL9_OUTPUT:
case SH_HLSL11_OUTPUT:
return new TranslatorHLSL(type, spec, output);
default:
return NULL;
}
}
//
// Delete the compiler made by ConstructCompiler
//
void DeleteCompiler(TCompiler* compiler)
{
delete compiler;
}
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
{ {
'target_name': 'libGLESv2', 'target_name': 'libGLESv2',
'type': 'shared_library', 'type': 'shared_library',
'dependencies': [ 'translator' ], 'dependencies': [ 'translator_static' ],
'include_dirs': 'include_dirs':
[ [
'.', '.',
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
'type': 'executable', 'type': 'executable',
'dependencies': 'dependencies':
[ [
'../src/angle.gyp:translator', '../src/angle.gyp:translator_static',
'gtest', 'gtest',
'gmock', 'gmock',
], ],
......
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