Fix Linux build, and update BUILD.gn.

We were getting multiply defined symbol errors on Linux for some
stuff in the common sources. Switch to using a static lib target
for the common sources, and also sync BUILD.gn with the latest gyp.

BUG=angle:773

Change-Id: I212284cfa90cd117a784a5f17057f47dd08900d1
Reviewed-on: https://chromium-review.googlesource.com/239193
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
Jamie Madill 2015-01-07 13:22:02 -05:00
Родитель 0a4f1e27e5
Коммит ed409f938b
5 изменённых файлов: 355 добавлений и 345 удалений

230
BUILD.gn
Просмотреть файл

@ -2,20 +2,17 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
if (is_win) {
# Only needed on Windows.
gles_gypi = exec_script(
"//build/gypi_to_gn.py",
[ rebase_path("src/libGLESv2.gypi") ],
"scope",
[ "src/libGLESv2.gypi" ])
}
gles_gypi = exec_script(
"//build/gypi_to_gn.py",
[ rebase_path("src/libGLESv2.gypi") ],
"scope",
[ "src/libGLESv2.gypi" ])
compiler_gypi = exec_script(
"//build/gypi_to_gn.py",
[ rebase_path("src/compiler.gypi") ],
"scope",
[ "src/compiler.gypi" ])
"//build/gypi_to_gn.py",
[ rebase_path("src/compiler.gypi") ],
"scope",
[ "src/compiler.gypi" ])
# This config is exported to dependent targets (and also applied to internal
# ones).
@ -83,6 +80,14 @@ config("translator_static_config") {
defines = [ "ANGLE_TRANSLATOR_STATIC" ]
}
static_library("angle_common") {
sources = rebase_path(gles_gypi.libangle_common_sources, ".", "src")
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
":internal_config",
]
}
static_library("translator_lib") {
sources = rebase_path(compiler_gypi.angle_translator_lib_sources, ".", "src")
@ -137,6 +142,9 @@ action("commit_id") {
public_configs = [ ":commit_id_config" ]
}
angle_enable_d3d9 = false
angle_enable_d3d11 = false
if (is_win) {
angle_enable_d3d9 = true
angle_enable_d3d11 = true
@ -147,119 +155,127 @@ if (is_win) {
outputs = [ "$root_build_dir/d3dcompiler_47.dll" ]
}
config("libANGLE_config") {
defines = []
if (angle_enable_d3d9) {
defines += [ "ANGLE_ENABLE_D3D9" ]
}
if (angle_enable_d3d11) {
defines += [ "ANGLE_ENABLE_D3D11" ]
}
defines += [
"GL_APICALL=",
"GL_GLEXT_PROTOTYPES=",
"EGLAPI=",
]
} # is_win
config("libANGLE_config") {
defines = []
if (angle_enable_d3d9) {
defines += [ "ANGLE_ENABLE_D3D9" ]
}
if (angle_enable_d3d11) {
defines += [ "ANGLE_ENABLE_D3D11" ]
}
defines += [
"GL_APICALL=",
"GL_GLEXT_PROTOTYPES=",
"EGLAPI=",
]
}
static_library("libANGLE") {
sources = rebase_path(gles_gypi.libangle_sources, ".", "src")
sources += rebase_path(gles_gypi.libangle_common_sources, ".", "src")
static_library("libANGLE") {
sources = rebase_path(gles_gypi.libangle_sources, ".", "src")
libs = []
defines = []
libs = []
defines = [
"LIBANGLE_IMPLEMENTATION",
]
# Shared D3dD sources.
if (angle_enable_d3d9 || angle_enable_d3d11) {
sources += rebase_path(gles_gypi.libangle_d3d_shared_sources, ".", "src")
}
if (angle_enable_d3d9) {
sources += rebase_path(gles_gypi.libangle_d3d9_sources, ".", "src")
libs += [ "d3d9.lib" ]
}
if (angle_enable_d3d11) {
sources += rebase_path(gles_gypi.libangle_d3d11_sources, ".", "src")
sources += rebase_path(gles_gypi.libangle_d3d11_win32_sources, ".", "src")
libs += [ "dxguid.lib" ]
}
if (is_debug) {
defines += [
"ANGLE_GENERATE_SHADER_DEBUG_INFO",
"ANGLE_ENABLE_DEBUG_ANNOTATIONS",
]
libs += [ "d3d9.lib" ]
}
# Shared D3dD sources.
if (angle_enable_d3d9 || angle_enable_d3d11) {
sources += rebase_path(gles_gypi.libangle_d3d_shared_sources, ".", "src")
defines += [
"LIBANGLE_IMPLEMENTATION",
"ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " +
"\"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }",
]
}
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
":commit_id_config",
":libANGLE_config",
":internal_config",
"//build/config/compiler:no_chromium_code",
]
if (angle_enable_d3d9) {
sources += rebase_path(gles_gypi.libangle_d3d9_sources, ".", "src")
libs += [ "d3d9.lib" ]
}
deps = [
":commit_id",
":includes",
":translator",
":copy_compiler_dll",
if (angle_enable_d3d11) {
sources += rebase_path(gles_gypi.libangle_d3d11_sources, ".", "src")
sources += rebase_path(gles_gypi.libangle_d3d11_win32_sources, ".", "src")
libs += [ "dxguid.lib" ]
}
if (is_debug) {
defines += [
"ANGLE_GENERATE_SHADER_DEBUG_INFO",
"ANGLE_ENABLE_DEBUG_ANNOTATIONS",
]
}
shared_library("libGLESv2") {
sources = rebase_path(gles_gypi.libglesv2_sources, ".", "src")
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
":commit_id_config",
":libANGLE_config",
":internal_config",
"//build/config/compiler:no_chromium_code",
]
deps = [
":commit_id",
":includes",
":translator",
":angle_common",
]
if (is_win) {
deps += [ ":copy_compiler_dll" ]
}
}
shared_library("libGLESv2") {
sources = rebase_path(gles_gypi.libglesv2_sources, ".", "src")
if (is_win) {
ldflags = [ "/DEF:" +
rebase_path("src/libGLESv2/libGLESv2.def", root_build_dir) ]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
":internal_config",
":commit_id_config",
":libANGLE_config",
"//build/config/compiler:no_chromium_code",
]
defines = [
"LIBGLESV2_IMPLEMENTATION",
]
deps = [
":includes",
":libANGLE",
]
rebase_path("src/libGLESv2/libGLESv2.def", root_build_dir) ]
}
shared_library("libEGL") {
sources = rebase_path(gles_gypi.libegl_sources, ".", "src")
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
":internal_config",
":commit_id_config",
":libANGLE_config",
"//build/config/compiler:no_chromium_code",
]
defines = [
"LIBGLESV2_IMPLEMENTATION",
]
deps = [
":includes",
":libANGLE",
]
}
shared_library("libEGL") {
sources = rebase_path(gles_gypi.libegl_sources, ".", "src")
if (is_win) {
ldflags = [ "/DEF:" +
rebase_path("src/libEGL/libEGL.def", root_build_dir) ]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
":internal_config",
":commit_id_config",
":libANGLE_config",
"//build/config/compiler:no_chromium_code",
]
defines = [
"LIBEGL_IMPLEMENTATION",
]
deps = [
":includes",
":libGLESv2",
]
rebase_path("src/libEGL/libEGL.def", root_build_dir) ]
}
} # is_win
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
":internal_config",
":commit_id_config",
":libANGLE_config",
"//build/config/compiler:no_chromium_code",
]
defines = [
"LIBEGL_IMPLEMENTATION",
]
deps = [
":includes",
":libGLESv2",
]
}

Просмотреть файл

@ -3,8 +3,229 @@
# found in the LICENSE file.
{
'variables':
{
'angle_code': 1,
'angle_post_build_script%': 0,
'angle_gen_path': '<(SHARED_INTERMEDIATE_DIR)/angle',
'angle_id_script_base': 'commit_id.py',
'angle_id_script': '<(angle_gen_path)/<(angle_id_script_base)',
'angle_id_header_base': 'commit.h',
'angle_id_header': '<(angle_gen_path)/id/<(angle_id_header_base)',
'angle_use_commit_id%': '<!(python <(angle_id_script_base) check ..)',
'angle_enable_d3d9%': 0,
'angle_enable_d3d11%': 0,
'conditions':
[
['OS=="win"',
{
'angle_enable_d3d9%': 1,
'angle_enable_d3d11%': 1,
}],
],
},
'includes':
[
'angle.gypi',
'compiler.gypi',
'libGLESv2.gypi',
'libEGL.gypi'
],
'targets':
[
{
'target_name': 'angle_common',
'type': 'static_library',
'includes': [ '../build/common_defines.gypi', ],
'sources':
[
'<@(libangle_common_sources)',
],
'include_dirs':
[
'.',
'../include',
],
},
{
'target_name': 'copy_scripts',
'type': 'none',
'includes': [ '../build/common_defines.gypi', ],
'hard_dependency': 1,
'copies':
[
{
'destination': '<(angle_gen_path)',
'files': [ 'copy_compiler_dll.bat', '<(angle_id_script_base)' ],
},
],
'conditions':
[
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
'type' : 'shared_library',
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
],
},
],
'conditions':
[
['angle_use_commit_id!=0',
{
'targets':
[
{
'target_name': 'commit_id',
'type': 'none',
'includes': [ '../build/common_defines.gypi', ],
'dependencies': [ 'copy_scripts', ],
'hard_dependency': 1,
'actions':
[
{
'action_name': 'Generate ANGLE Commit ID Header',
'message': 'Generating ANGLE Commit ID',
# reference the git index as an input, so we rebuild on changes to the index
'inputs': [ '<(angle_id_script)', '<(angle_path)/.git/index' ],
'outputs': [ '<(angle_id_header)' ],
'msvs_cygwin_shell': 0,
'action':
[
'python', '<(angle_id_script)', 'gen', '<(angle_path)', '<(angle_id_header)'
],
},
],
'all_dependent_settings':
{
'include_dirs':
[
'<(angle_gen_path)',
],
},
'conditions':
[
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
'type' : 'shared_library',
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
],
}
]
},
{ # angle_use_commit_id==0
'targets':
[
{
'target_name': 'commit_id',
'type': 'none',
'hard_dependency': 1,
'includes': [ '../build/common_defines.gypi', ],
'copies':
[
{
'destination': '<(angle_gen_path)/id',
'files': [ '<(angle_id_header_base)' ]
}
],
'all_dependent_settings':
{
'include_dirs':
[
'<(angle_gen_path)',
],
},
'conditions':
[
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
'type' : 'shared_library',
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
],
}
]
}],
['OS=="win"',
{
'targets':
[
{
'target_name': 'copy_compiler_dll',
'type': 'none',
'dependencies': [ 'copy_scripts', ],
'includes': [ '../build/common_defines.gypi', ],
'conditions':
[
['angle_build_winrt==0',
{
'actions':
[
{
'action_name': 'copy_dll',
'message': 'Copying D3D Compiler DLL...',
'msvs_cygwin_shell': 0,
'inputs': [ 'copy_compiler_dll.bat' ],
'outputs': [ '<(PRODUCT_DIR)/d3dcompiler_47.dll' ],
'action':
[
"<(angle_gen_path)/copy_compiler_dll.bat",
"$(PlatformName)",
"<(windows_sdk_path)",
"<(PRODUCT_DIR)"
],
},
], #actions
}],
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
'type' : 'shared_library',
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
]
},
], # targets
}],
['angle_post_build_script!=0 and OS=="win"',
{
'targets':
[
{
'target_name': 'post_build',
'type': 'none',
'includes': [ '../build/common_defines.gypi', ],
'dependencies': [ 'libGLESv2', 'libEGL' ],
'actions':
[
{
'action_name': 'ANGLE Post-Build Script',
'message': 'Running <(angle_post_build_script)...',
'msvs_cygwin_shell': 0,
'inputs': [ '<(angle_post_build_script)', '<!@(["python", "<(angle_post_build_script)", "inputs", "<(angle_path)", "<(CONFIGURATION_NAME)", "$(PlatformName)", "<(PRODUCT_DIR)"])' ],
'outputs': [ '<!@(python <(angle_post_build_script) outputs "<(angle_path)" "<(CONFIGURATION_NAME)" "$(PlatformName)" "<(PRODUCT_DIR)")' ],
'action': ['python', '<(angle_post_build_script)', 'run', '<(angle_path)', '<(CONFIGURATION_NAME)', '$(PlatformName)', '<(PRODUCT_DIR)'],
},
], #actions
},
], # targets
}],
] # conditions
}

Просмотреть файл

@ -1,216 +0,0 @@
# Copyright (c) 2012 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.
{
'variables':
{
'angle_code': 1,
'angle_post_build_script%': 0,
'angle_gen_path': '<(SHARED_INTERMEDIATE_DIR)/angle',
'angle_id_script_base': 'commit_id.py',
'angle_id_script': '<(angle_gen_path)/<(angle_id_script_base)',
'angle_id_header_base': 'commit.h',
'angle_id_header': '<(angle_gen_path)/id/<(angle_id_header_base)',
'angle_use_commit_id%': '<!(python <(angle_id_script_base) check ..)',
'angle_enable_d3d9%': 0,
'angle_enable_d3d11%': 0,
'conditions':
[
['OS=="win"',
{
'angle_enable_d3d9%': 1,
'angle_enable_d3d11%': 1,
}],
],
},
'includes':
[
'compiler.gypi',
'libGLESv2.gypi',
'libEGL.gypi'
],
'targets':
[
{
'target_name': 'copy_scripts',
'type': 'none',
'includes': [ '../build/common_defines.gypi', ],
'hard_dependency': 1,
'copies':
[
{
'destination': '<(angle_gen_path)',
'files': [ 'copy_compiler_dll.bat', '<(angle_id_script_base)' ],
},
],
'conditions':
[
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
'type' : 'shared_library',
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
],
},
],
'conditions':
[
['angle_use_commit_id!=0',
{
'targets':
[
{
'target_name': 'commit_id',
'type': 'none',
'includes': [ '../build/common_defines.gypi', ],
'dependencies': [ 'copy_scripts', ],
'hard_dependency': 1,
'actions':
[
{
'action_name': 'Generate ANGLE Commit ID Header',
'message': 'Generating ANGLE Commit ID',
# reference the git index as an input, so we rebuild on changes to the index
'inputs': [ '<(angle_id_script)', '<(angle_path)/.git/index' ],
'outputs': [ '<(angle_id_header)' ],
'msvs_cygwin_shell': 0,
'action':
[
'python', '<(angle_id_script)', 'gen', '<(angle_path)', '<(angle_id_header)'
],
},
],
'all_dependent_settings':
{
'include_dirs':
[
'<(angle_gen_path)',
],
},
'conditions':
[
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
'type' : 'shared_library',
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
],
}
]
},
{ # angle_use_commit_id==0
'targets':
[
{
'target_name': 'commit_id',
'type': 'none',
'hard_dependency': 1,
'includes': [ '../build/common_defines.gypi', ],
'copies':
[
{
'destination': '<(angle_gen_path)/id',
'files': [ '<(angle_id_header_base)' ]
}
],
'all_dependent_settings':
{
'include_dirs':
[
'<(angle_gen_path)',
],
},
'conditions':
[
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
'type' : 'shared_library',
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
],
}
]
}],
['OS=="win"',
{
'targets':
[
{
'target_name': 'copy_compiler_dll',
'type': 'none',
'dependencies': [ 'copy_scripts', ],
'includes': [ '../build/common_defines.gypi', ],
'conditions':
[
['angle_build_winrt==0',
{
'actions':
[
{
'action_name': 'copy_dll',
'message': 'Copying D3D Compiler DLL...',
'msvs_cygwin_shell': 0,
'inputs': [ 'copy_compiler_dll.bat' ],
'outputs': [ '<(PRODUCT_DIR)/d3dcompiler_47.dll' ],
'action':
[
"<(angle_gen_path)/copy_compiler_dll.bat",
"$(PlatformName)",
"<(windows_sdk_path)",
"<(PRODUCT_DIR)"
],
},
], #actions
}],
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
'type' : 'shared_library',
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
]
},
], # targets
}],
['angle_post_build_script!=0 and OS=="win"',
{
'targets':
[
{
'target_name': 'post_build',
'type': 'none',
'includes': [ '../build/common_defines.gypi', ],
'dependencies': [ 'libGLESv2', 'libEGL' ],
'actions':
[
{
'action_name': 'ANGLE Post-Build Script',
'message': 'Running <(angle_post_build_script)...',
'msvs_cygwin_shell': 0,
'inputs': [ '<(angle_post_build_script)', '<!@(["python", "<(angle_post_build_script)", "inputs", "<(angle_path)", "<(CONFIGURATION_NAME)", "$(PlatformName)", "<(PRODUCT_DIR)"])' ],
'outputs': [ '<!@(python <(angle_post_build_script) outputs "<(angle_path)" "<(CONFIGURATION_NAME)" "$(PlatformName)" "<(PRODUCT_DIR)")' ],
'action': ['python', '<(angle_post_build_script)', 'run', '<(angle_path)', '<(CONFIGURATION_NAME)', '$(PlatformName)', '<(PRODUCT_DIR)'],
},
], #actions
},
], # targets
}],
] # conditions
}

Просмотреть файл

@ -21,21 +21,6 @@
'../include/GLSLANG/ShaderVars.h',
'../include/KHR/khrplatform.h',
'../include/angle_gl.h',
'common/angleutils.h',
'common/angleutils.cpp',
'common/blocklayout.cpp',
'common/blocklayout.h',
'common/debug.cpp',
'common/debug.h',
'common/event_tracer.cpp',
'common/event_tracer.h',
'common/mathutil.cpp',
'common/mathutil.h',
'common/platform.h',
'common/tls.cpp',
'common/tls.h',
'common/utilities.cpp',
'common/utilities.h',
'compiler/translator/BaseTypes.h',
'compiler/translator/BuiltInFunctionEmulator.cpp',
'compiler/translator/BuiltInFunctionEmulator.h',
@ -217,7 +202,7 @@
{
'target_name': 'translator_lib',
'type': 'static_library',
'dependencies': [ 'preprocessor' ],
'dependencies': [ 'preprocessor', 'angle_common' ],
'includes': [ '../build/common_defines.gypi', ],
'include_dirs':
[
@ -257,7 +242,7 @@
{
'target_name': 'translator',
'type': '<(component)',
'dependencies': [ 'translator_lib' ],
'dependencies': [ 'translator_lib', 'angle_common' ],
'includes': [ '../build/common_defines.gypi', ],
'include_dirs':
[

Просмотреть файл

@ -17,6 +17,8 @@
'common/mathutil.cpp',
'common/mathutil.h',
'common/platform.h',
'common/tls.cpp',
'common/tls.h',
'common/utilities.cpp',
'common/utilities.h',
'common/version.h',
@ -358,8 +360,6 @@
[
'common/angleutils.h',
'common/debug.h',
'common/tls.cpp',
'common/tls.h',
'libGLESv2/entry_points_egl.cpp',
'libGLESv2/entry_points_egl.h',
'libGLESv2/entry_points_egl_ext.cpp',
@ -395,7 +395,12 @@
{
'target_name': 'libANGLE',
'type': 'static_library',
'dependencies': [ 'translator_static', 'commit_id', ],
'dependencies':
[
'translator_static',
'commit_id',
'angle_common',
],
'includes': [ '../build/common_defines.gypi', ],
'include_dirs':
[
@ -405,7 +410,6 @@
'sources':
[
'<@(libangle_sources)',
'<@(libangle_common_sources)',
'<@(libangle_includes)',
],
'defines':