Commit ed409f93 by Jamie Madill

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/239193Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 0a4f1e27
...@@ -2,20 +2,17 @@ ...@@ -2,20 +2,17 @@
# 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.
if (is_win) { gles_gypi = exec_script(
# Only needed on Windows. "//build/gypi_to_gn.py",
gles_gypi = exec_script( [ rebase_path("src/libGLESv2.gypi") ],
"//build/gypi_to_gn.py", "scope",
[ rebase_path("src/libGLESv2.gypi") ], [ "src/libGLESv2.gypi" ])
"scope",
[ "src/libGLESv2.gypi" ])
}
compiler_gypi = exec_script( compiler_gypi = exec_script(
"//build/gypi_to_gn.py", "//build/gypi_to_gn.py",
[ rebase_path("src/compiler.gypi") ], [ rebase_path("src/compiler.gypi") ],
"scope", "scope",
[ "src/compiler.gypi" ]) [ "src/compiler.gypi" ])
# This config is exported to dependent targets (and also applied to internal # This config is exported to dependent targets (and also applied to internal
# ones). # ones).
...@@ -83,6 +80,14 @@ config("translator_static_config") { ...@@ -83,6 +80,14 @@ config("translator_static_config") {
defines = [ "ANGLE_TRANSLATOR_STATIC" ] 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") { static_library("translator_lib") {
sources = rebase_path(compiler_gypi.angle_translator_lib_sources, ".", "src") sources = rebase_path(compiler_gypi.angle_translator_lib_sources, ".", "src")
...@@ -137,6 +142,9 @@ action("commit_id") { ...@@ -137,6 +142,9 @@ action("commit_id") {
public_configs = [ ":commit_id_config" ] public_configs = [ ":commit_id_config" ]
} }
angle_enable_d3d9 = false
angle_enable_d3d11 = false
if (is_win) { if (is_win) {
angle_enable_d3d9 = true angle_enable_d3d9 = true
angle_enable_d3d11 = true angle_enable_d3d11 = true
...@@ -147,119 +155,127 @@ if (is_win) { ...@@ -147,119 +155,127 @@ if (is_win) {
outputs = [ "$root_build_dir/d3dcompiler_47.dll" ] outputs = [ "$root_build_dir/d3dcompiler_47.dll" ]
} }
config("libANGLE_config") { } # is_win
defines = []
if (angle_enable_d3d9) { config("libANGLE_config") {
defines += [ "ANGLE_ENABLE_D3D9" ] defines = []
} if (angle_enable_d3d9) {
if (angle_enable_d3d11) { defines += [ "ANGLE_ENABLE_D3D9" ]
defines += [ "ANGLE_ENABLE_D3D11" ] }
} if (angle_enable_d3d11) {
defines += [ defines += [ "ANGLE_ENABLE_D3D11" ]
"GL_APICALL=",
"GL_GLEXT_PROTOTYPES=",
"EGLAPI=",
]
} }
defines += [
"GL_APICALL=",
"GL_GLEXT_PROTOTYPES=",
"EGLAPI=",
]
}
static_library("libANGLE") {
sources = rebase_path(gles_gypi.libangle_sources, ".", "src")
libs = []
defines = [
"LIBANGLE_IMPLEMENTATION",
]
static_library("libANGLE") { # Shared D3dD sources.
sources = rebase_path(gles_gypi.libangle_sources, ".", "src") if (angle_enable_d3d9 || angle_enable_d3d11) {
sources += rebase_path(gles_gypi.libangle_common_sources, ".", "src") sources += rebase_path(gles_gypi.libangle_d3d_shared_sources, ".", "src")
libs = []
defines = []
# 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" ]
}
defines += [ defines += [
"LIBANGLE_IMPLEMENTATION",
"ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " + "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " +
"\"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }", "\"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }",
] ]
}
configs -= [ "//build/config/compiler:chromium_code" ] if (angle_enable_d3d9) {
configs += [ sources += rebase_path(gles_gypi.libangle_d3d9_sources, ".", "src")
":commit_id_config", libs += [ "d3d9.lib" ]
":libANGLE_config",
":internal_config",
"//build/config/compiler:no_chromium_code",
]
deps = [
":commit_id",
":includes",
":translator",
":copy_compiler_dll",
]
} }
shared_library("libGLESv2") { if (angle_enable_d3d11) {
sources = rebase_path(gles_gypi.libglesv2_sources, ".", "src") sources += rebase_path(gles_gypi.libangle_d3d11_sources, ".", "src")
sources += rebase_path(gles_gypi.libangle_d3d11_win32_sources, ".", "src")
libs += [ "dxguid.lib" ]
}
ldflags = [ "/DEF:" + if (is_debug) {
rebase_path("src/libGLESv2/libGLESv2.def", root_build_dir) ] defines += [
"ANGLE_GENERATE_SHADER_DEBUG_INFO",
configs -= [ "//build/config/compiler:chromium_code" ] "ANGLE_ENABLE_DEBUG_ANNOTATIONS",
configs += [
":internal_config",
":commit_id_config",
":libANGLE_config",
"//build/config/compiler:no_chromium_code",
] ]
}
defines = [ configs -= [ "//build/config/compiler:chromium_code" ]
"LIBGLESV2_IMPLEMENTATION", configs += [
] ":commit_id_config",
":libANGLE_config",
":internal_config",
"//build/config/compiler:no_chromium_code",
]
deps = [ deps = [
":includes", ":commit_id",
":libANGLE", ":includes",
] ":translator",
":angle_common",
]
if (is_win) {
deps += [ ":copy_compiler_dll" ]
} }
}
shared_library("libEGL") { shared_library("libGLESv2") {
sources = rebase_path(gles_gypi.libegl_sources, ".", "src") sources = rebase_path(gles_gypi.libglesv2_sources, ".", "src")
if (is_win) {
ldflags = [ "/DEF:" + ldflags = [ "/DEF:" +
rebase_path("src/libEGL/libEGL.def", root_build_dir) ] 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 = [ configs -= [ "//build/config/compiler:chromium_code" ]
"LIBEGL_IMPLEMENTATION", configs += [
] ":internal_config",
":commit_id_config",
":libANGLE_config",
"//build/config/compiler:no_chromium_code",
]
deps = [ defines = [
":includes", "LIBGLESV2_IMPLEMENTATION",
":libGLESv2", ]
]
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) ]
} }
} # 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 @@ ...@@ -3,8 +3,229 @@
# found in the LICENSE file. # 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': '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
} }
# 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 @@ ...@@ -21,21 +21,6 @@
'../include/GLSLANG/ShaderVars.h', '../include/GLSLANG/ShaderVars.h',
'../include/KHR/khrplatform.h', '../include/KHR/khrplatform.h',
'../include/angle_gl.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/BaseTypes.h',
'compiler/translator/BuiltInFunctionEmulator.cpp', 'compiler/translator/BuiltInFunctionEmulator.cpp',
'compiler/translator/BuiltInFunctionEmulator.h', 'compiler/translator/BuiltInFunctionEmulator.h',
...@@ -217,7 +202,7 @@ ...@@ -217,7 +202,7 @@
{ {
'target_name': 'translator_lib', 'target_name': 'translator_lib',
'type': 'static_library', 'type': 'static_library',
'dependencies': [ 'preprocessor' ], 'dependencies': [ 'preprocessor', 'angle_common' ],
'includes': [ '../build/common_defines.gypi', ], 'includes': [ '../build/common_defines.gypi', ],
'include_dirs': 'include_dirs':
[ [
...@@ -257,7 +242,7 @@ ...@@ -257,7 +242,7 @@
{ {
'target_name': 'translator', 'target_name': 'translator',
'type': '<(component)', 'type': '<(component)',
'dependencies': [ 'translator_lib' ], 'dependencies': [ 'translator_lib', 'angle_common' ],
'includes': [ '../build/common_defines.gypi', ], 'includes': [ '../build/common_defines.gypi', ],
'include_dirs': 'include_dirs':
[ [
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
'common/mathutil.cpp', 'common/mathutil.cpp',
'common/mathutil.h', 'common/mathutil.h',
'common/platform.h', 'common/platform.h',
'common/tls.cpp',
'common/tls.h',
'common/utilities.cpp', 'common/utilities.cpp',
'common/utilities.h', 'common/utilities.h',
'common/version.h', 'common/version.h',
...@@ -358,8 +360,6 @@ ...@@ -358,8 +360,6 @@
[ [
'common/angleutils.h', 'common/angleutils.h',
'common/debug.h', 'common/debug.h',
'common/tls.cpp',
'common/tls.h',
'libGLESv2/entry_points_egl.cpp', 'libGLESv2/entry_points_egl.cpp',
'libGLESv2/entry_points_egl.h', 'libGLESv2/entry_points_egl.h',
'libGLESv2/entry_points_egl_ext.cpp', 'libGLESv2/entry_points_egl_ext.cpp',
...@@ -395,7 +395,12 @@ ...@@ -395,7 +395,12 @@
{ {
'target_name': 'libANGLE', 'target_name': 'libANGLE',
'type': 'static_library', 'type': 'static_library',
'dependencies': [ 'translator_static', 'commit_id', ], 'dependencies':
[
'translator_static',
'commit_id',
'angle_common',
],
'includes': [ '../build/common_defines.gypi', ], 'includes': [ '../build/common_defines.gypi', ],
'include_dirs': 'include_dirs':
[ [
...@@ -405,7 +410,6 @@ ...@@ -405,7 +410,6 @@
'sources': 'sources':
[ [
'<@(libangle_sources)', '<@(libangle_sources)',
'<@(libangle_common_sources)',
'<@(libangle_includes)', '<@(libangle_includes)',
], ],
'defines': 'defines':
......
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