Fix some syntax errors in the gyp build configuration, and make some modifications so the tests should work with chromium in component build.
We use a separate static translator for linking directly with unit tests, so they have more direct access to the translator classes.
ANGLEBUG=477
BUG=
R=shannonwoods@chromium.org, zmo@chromium.org
Review URL: https://codereview.appspot.com/13971043
diff --git a/build/common.gypi b/build/common.gypi
index fc9f295..25b4a12 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -59,6 +59,7 @@
'MinimalRebuild': 'false',
'PreprocessorDefinitions': [
'_CRT_SECURE_NO_DEPRECATE',
+ '_SCL_SECURE_NO_DEPRECATE',
'_HAS_EXCEPTIONS=0',
'_WIN32_WINNT=0x0600',
'_WINDOWS',
diff --git a/include/GLSLANG/ShaderLang.h b/include/GLSLANG/ShaderLang.h
index 28bf516..233f089 100644
--- a/include/GLSLANG/ShaderLang.h
+++ b/include/GLSLANG/ShaderLang.h
@@ -6,7 +6,7 @@
#ifndef _COMPILER_INTERFACE_INCLUDED_
#define _COMPILER_INTERFACE_INCLUDED_
-#if defined(COMPONENT_BUILD)
+#if (COMPONENT_BUILD)
#if defined(_WIN32) || defined(_WIN64)
#if defined(COMPILER_IMPLEMENTATION)
diff --git a/samples/build_samples.gyp b/samples/build_samples.gyp
index a70eb04..d79de06 100644
--- a/samples/build_samples.gyp
+++ b/samples/build_samples.gyp
@@ -8,7 +8,7 @@
'target_name': 'essl_to_glsl',
'type': 'executable',
'dependencies': [
- '../src/build_angle.gyp:translator_glsl',
+ '../src/build_angle.gyp:translator',
],
'include_dirs': [
'../include',
@@ -25,7 +25,7 @@
'target_name': 'essl_to_hlsl',
'type': 'executable',
'dependencies': [
- '../src/build_angle.gyp:translator_hlsl',
+ '../src/build_angle.gyp:translator',
],
'include_dirs': [
'../include',
diff --git a/src/build_angle.gypi b/src/build_angle.gypi
index 7f502e0..fb17bb2 100644
--- a/src/build_angle.gypi
+++ b/src/build_angle.gypi
@@ -5,65 +5,7 @@
{
'variables': {
'angle_code': 1,
- },
- 'target_defaults': {
- 'defines': [
- 'ANGLE_DISABLE_TRACE',
- 'ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1',
- 'ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }',
- ],
- },
- 'targets': [
- {
- 'target_name': 'preprocessor',
- 'type': 'static_library',
- 'include_dirs': [
- ],
- 'sources': [
- 'compiler/preprocessor/DiagnosticsBase.cpp',
- 'compiler/preprocessor/DiagnosticsBase.h',
- 'compiler/preprocessor/DirectiveHandlerBase.cpp',
- 'compiler/preprocessor/DirectiveHandlerBase.h',
- 'compiler/preprocessor/DirectiveParser.cpp',
- 'compiler/preprocessor/DirectiveParser.h',
- 'compiler/preprocessor/ExpressionParser.cpp',
- 'compiler/preprocessor/ExpressionParser.h',
- 'compiler/preprocessor/Input.cpp',
- 'compiler/preprocessor/Input.h',
- 'compiler/preprocessor/length_limits.h',
- 'compiler/preprocessor/Lexer.cpp',
- 'compiler/preprocessor/Lexer.h',
- 'compiler/preprocessor/Macro.cpp',
- 'compiler/preprocessor/Macro.h',
- 'compiler/preprocessor/MacroExpander.cpp',
- 'compiler/preprocessor/MacroExpander.h',
- 'compiler/preprocessor/numeric_lex.h',
- 'compiler/preprocessor/pp_utils.h',
- 'compiler/preprocessor/Preprocessor.cpp',
- 'compiler/preprocessor/Preprocessor.h',
- 'compiler/preprocessor/SourceLocation.h',
- 'compiler/preprocessor/Token.cpp',
- 'compiler/preprocessor/Token.h',
- 'compiler/preprocessor/Tokenizer.cpp',
- 'compiler/preprocessor/Tokenizer.h',
- ],
- # TODO(jschuh): http://crbug.com/167187
- 'msvs_disabled_warnings': [
- 4267,
- ],
- },
- {
- 'target_name': 'translator_static',
- 'type': 'static_library',
- 'dependencies': ['preprocessor'],
- 'include_dirs': [
- '.',
- '../include',
- ],
- 'defines': [
- 'COMPILER_IMPLEMENTATION',
- ],
- 'sources': [
+ 'translator_sources': [
'compiler/BaseTypes.h',
'compiler/BuiltInFunctionEmulator.cpp',
'compiler/BuiltInFunctionEmulator.h',
@@ -110,7 +52,7 @@
'compiler/MMap.h',
'compiler/osinclude.h',
'compiler/OutputESSL.cpp',
- 'compiler/OutputESSL.h',
+ 'compiler/OutputESSL.h',
'compiler/OutputGLSLBase.cpp',
'compiler/OutputGLSLBase.h',
'compiler/OutputGLSL.cpp',
@@ -170,6 +112,89 @@
'third_party/compiler/ArrayBoundsClamper.cpp',
'third_party/compiler/ArrayBoundsClamper.h',
],
+ },
+ 'target_defaults': {
+ 'defines': [
+ 'ANGLE_DISABLE_TRACE',
+ 'ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1',
+ 'ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }',
+ ],
+ },
+ 'targets': [
+ {
+ 'target_name': 'preprocessor',
+ 'type': 'static_library',
+ 'include_dirs': [
+ ],
+ 'sources': [
+ 'compiler/preprocessor/DiagnosticsBase.cpp',
+ 'compiler/preprocessor/DiagnosticsBase.h',
+ 'compiler/preprocessor/DirectiveHandlerBase.cpp',
+ 'compiler/preprocessor/DirectiveHandlerBase.h',
+ 'compiler/preprocessor/DirectiveParser.cpp',
+ 'compiler/preprocessor/DirectiveParser.h',
+ 'compiler/preprocessor/ExpressionParser.cpp',
+ 'compiler/preprocessor/ExpressionParser.h',
+ 'compiler/preprocessor/Input.cpp',
+ 'compiler/preprocessor/Input.h',
+ 'compiler/preprocessor/length_limits.h',
+ 'compiler/preprocessor/Lexer.cpp',
+ 'compiler/preprocessor/Lexer.h',
+ 'compiler/preprocessor/Macro.cpp',
+ 'compiler/preprocessor/Macro.h',
+ 'compiler/preprocessor/MacroExpander.cpp',
+ 'compiler/preprocessor/MacroExpander.h',
+ 'compiler/preprocessor/numeric_lex.h',
+ 'compiler/preprocessor/pp_utils.h',
+ 'compiler/preprocessor/Preprocessor.cpp',
+ 'compiler/preprocessor/Preprocessor.h',
+ 'compiler/preprocessor/SourceLocation.h',
+ 'compiler/preprocessor/Token.cpp',
+ 'compiler/preprocessor/Token.h',
+ 'compiler/preprocessor/Tokenizer.cpp',
+ 'compiler/preprocessor/Tokenizer.h',
+ ],
+ # TODO(jschuh): http://crbug.com/167187
+ 'msvs_disabled_warnings': [
+ 4267,
+ ],
+ },
+ {
+ 'target_name': 'translator',
+ 'type': '<(component)',
+ 'dependencies': ['preprocessor'],
+ 'include_dirs': [
+ '.',
+ '../include',
+ ],
+ 'defines': [
+ 'COMPILER_IMPLEMENTATION',
+ ],
+ 'sources': ['<@(translator_sources)'],
+ # TODO(jschuh): http://crbug.com/167187 size_t -> int
+ 'msvs_disabled_warnings': [ 4267 ],
+ 'conditions': [
+ ['OS=="win"', {
+ 'sources': ['compiler/ossource_win.cpp'],
+ }, { # else: posix
+ 'sources': ['compiler/ossource_posix.cpp'],
+ }],
+ ],
+ },
+ # TODO(zmo): once we rid the webkit dependency to tranlator_glsl,
+ # we can get rid of this translator_glsl.
+ {
+ 'target_name': 'translator_glsl',
+ 'type': '<(component)',
+ 'dependencies': ['preprocessor'],
+ 'include_dirs': [
+ '.',
+ '../include',
+ ],
+ 'defines': [
+ 'COMPILER_IMPLEMENTATION',
+ ],
+ 'sources': ['<@(translator_sources)'],
# TODO(jschuh): http://crbug.com/167187 size_t -> int
'msvs_disabled_warnings': [ 4267 ],
'conditions': [
@@ -181,16 +206,27 @@
],
},
{
- 'target_name': 'translator',
- 'type': '<(component)',
- 'dependencies': ['translator_static'],
- },
- # TODO(zmo): once we rid the webkit dependency to tranlator_glsl,
- # we can get rid of this translator_glsl.
- {
- 'target_name': 'translator_glsl',
- 'type': '<(component)',
- 'dependencies': ['translator_static'],
+ 'target_name': 'translator_static',
+ 'type': 'static_library',
+ 'dependencies': ['preprocessor'],
+ 'include_dirs': [
+ '.',
+ '../include',
+ ],
+ 'defines': [
+ 'COMPILER_IMPLEMENTATION',
+ 'COMPONENT_BUILD=0',
+ ],
+ 'sources': ['<@(translator_sources)'],
+ # TODO(jschuh): http://crbug.com/167187 size_t -> int
+ 'msvs_disabled_warnings': [ 4267 ],
+ 'conditions': [
+ ['OS=="win"', {
+ 'sources': ['compiler/ossource_win.cpp'],
+ }, { # else: posix
+ 'sources': ['compiler/ossource_posix.cpp'],
+ }],
+ ],
},
],
'conditions': [
@@ -348,6 +384,7 @@
'AdditionalDependencies': [
'd3d9.lib',
'dxguid.lib',
+ '%(AdditionalDependencies)',
],
}
},
@@ -386,6 +423,7 @@
'VCLinkerTool': {
'AdditionalDependencies': [
'd3d9.lib',
+ '%(AdditionalDependencies)',
],
}
},
diff --git a/tests/build_tests.gyp b/tests/build_tests.gyp
index 82b3085..aa930f1 100644
--- a/tests/build_tests.gyp
+++ b/tests/build_tests.gyp
@@ -40,7 +40,7 @@
},
'includes': [
'preprocessor_tests/preprocessor_tests.gypi',
- ]
+ ],
'include_dirs': [
'../src/compiler/preprocessor',
'../third_party/googletest/include',
@@ -53,9 +53,8 @@
{
'target_name': 'compiler_tests',
'type': 'executable',
- 'dependencies':
- '../src/build_angle.gyp:translator_common',
- '../src/build_angle.gyp:translator_glsl',
+ 'dependencies': [
+ '../src/build_angle.gyp:translator_static',
'gtest',
'gmock',
],
@@ -64,7 +63,7 @@
},
'includes': [
'compiler_tests/compiler_tests.gypi',
- ]
+ ],
'include_dirs': [
'../include',
'../src',