diff options
-rw-r--r-- | gn/BUILD.gn | 39 | ||||
-rw-r--r-- | gn/cp.py | 23 | ||||
-rw-r--r-- | third_party/angle2/BUILD.gn | 69 |
3 files changed, 109 insertions, 22 deletions
diff --git a/gn/BUILD.gn b/gn/BUILD.gn index df45ada0f5..c972735915 100644 --- a/gn/BUILD.gn +++ b/gn/BUILD.gn @@ -399,6 +399,36 @@ toolchain("msvc") { description = "link {{output}}" } + tool("solink") { + dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" + libname = "${dllname}.lib" + pdbname = "${dllname}.pdb" + rspfile = "${dllname}.rsp" + + command = "$env_setup$bin/link.exe /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:$pdbname @$rspfile" + outputs = [ + dllname, + libname, + pdbname, + ] + default_output_extension = ".dll" + default_output_dir = "{{root_out_dir}}" + + link_output = libname + depend_output = libname + runtime_outputs = [ + dllname, + pdbname, + ] + + # I don't quite understand this. Aping Chrome's toolchain/win/BUILD.gn. + restat = true + + # inputs_newline works around a fixed per-line buffer size in the linker. + rspfile_content = "{{inputs_newline}} {{libs}} {{solibs}} {{ldflags}}" + description = "link {{output}}" + } + tool("link") { exename = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" pdbname = "$exename.pdb" @@ -422,6 +452,12 @@ toolchain("msvc") { command = "cmd.exe /c echo > {{output}}" description = "stamp {{output}}" } + + tool("copy") { + cp_py = rebase_path("cp.py") + command = "python.exe $cp_py {{source}} {{output}}" + description = "copy {{source}} {{output}}" + } } toolchain("gcc_like") { @@ -499,7 +535,8 @@ toolchain("gcc_like") { } tool("copy") { - command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})" + cp_py = rebase_path("cp.py") + command = "python $cp_py {{source}} {{output}}" description = "copy {{source}} {{output}}" } } diff --git a/gn/cp.py b/gn/cp.py new file mode 100644 index 0000000000..eedfcb2c7e --- /dev/null +++ b/gn/cp.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os +import shutil +import sys + +src, dst = sys.argv[1:] + +if os.path.exists(dst): + if os.path.isdir(dst): + shutil.rmtree(dst) + else: + os.remove(dst) + +if os.path.isdir(src): + shutil.copytree(src, dst) +else: + shutil.copy2(src, dst) diff --git a/third_party/angle2/BUILD.gn b/third_party/angle2/BUILD.gn index 3ae0f8efe5..b3958cacff 100644 --- a/third_party/angle2/BUILD.gn +++ b/third_party/angle2/BUILD.gn @@ -33,24 +33,32 @@ config("common") { defines = [ "ANGLE_ENABLE_ESSL", "ANGLE_ENABLE_GLSL", - "GL_GLEXT_PROTOTYPES", + "ANGLE_ENABLE_OPENGL", "EGL_EGLEXT_PROTOTYPES", + "GL_GLEXT_PROTOTYPES", ] include_dirs = [ "$root_gen_dir/angle2", "$angle_root/include", "$angle_root/src", "$angle_root/src/common/third_party/numerics", + "$angle_root/src/third_party/khronos", ] - assert(is_linux) # TODO: is_win, of course, maybe is_mac? + assert(is_linux || is_win) # TODO: is_mac? if (is_linux) { defines += [ - "ANGLE_ENABLE_OPENGL", "ANGLE_USE_X11", "GL_APICALL=__attribute__((visibility(\"default\")))", "EGLAPI=__attribute__((visibility(\"default\")))", ] + } else if (is_win) { + defines += [ + "ANGLE_ENABLE_D3D11", + "ANGLE_ENABLE_D3D9", + "GL_APICALL=", + "EGLAPI=", + ] } } @@ -65,25 +73,27 @@ copy("commit_id") { shared_library("libGLESv2") { configs += [ ":common" ] + configs -= [ "//gn:warnings" ] defines = [ "LIBGLESV2_IMPLEMENTATION" ] deps = [ ":commit_id", ] libs = [] - sources = rebase_path(compiler_gypi.angle_preprocessor_sources + - compiler_gypi.angle_translator_lib_sources + - compiler_gypi.angle_translator_lib_essl_sources + - compiler_gypi.angle_translator_lib_glsl_sources + - gles_gypi.libangle_sources + - gles_gypi.libangle_common_sources + - gles_gypi.libangle_image_util_sources + - gles_gypi.libglesv2_sources, - ".", - "$angle_root/src") + - [ - "$angle_root/src/compiler/translator/ShaderLang.cpp", - "$angle_root/src/compiler/translator/ShaderVars.cpp", - ] + sources = + rebase_path( + compiler_gypi.angle_preprocessor_sources + + compiler_gypi.angle_translator_lib_sources + + compiler_gypi.angle_translator_lib_essl_sources + + compiler_gypi.angle_translator_lib_glsl_sources + + gles_gypi.libangle_sources + gles_gypi.libangle_common_sources + + gles_gypi.libangle_image_util_sources + + gles_gypi.libglesv2_sources + gles_gypi.libangle_gl_sources, + ".", + "$angle_root/src") + + [ + "$angle_root/src/compiler/translator/ShaderLang.cpp", + "$angle_root/src/compiler/translator/ShaderVars.cpp", + ] if (!is_win) { sources -= [ "$angle_root/src/libGLESv2/libGLESv2.def" ] } @@ -94,16 +104,33 @@ shared_library("libGLESv2") { "Xi", "Xext", ] - sources += rebase_path(gles_gypi.libangle_gl_sources + - gles_gypi.libangle_gl_glx_sources, + sources += + rebase_path(gles_gypi.libangle_gl_glx_sources, ".", "$angle_root/src") + + [ "$angle_root/src/third_party/libXNVCtrl/NVCtrl.c" ] + } else if (is_win) { + defines += [ + # TODO: ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES + ] + sources += rebase_path(gles_gypi.libangle_gl_wgl_sources + + gles_gypi.libangle_d3d_shared_sources + + gles_gypi.libangle_d3d9_sources + + gles_gypi.libangle_d3d11_sources + + gles_gypi.libangle_d3d11_win32_sources, ".", - "$angle_root/src") + - [ "$angle_root/src/third_party/libXNVCtrl/NVCtrl.c" ] + "$angle_root/src") + libs += [ + "d3d9.lib", + "dxguid.lib", + ] + deps += [ + # TODO: copy_compiler_dll? + ] } } shared_library("libEGL") { configs += [ ":common" ] + configs -= [ "//gn:warnings" ] defines = [ "LIBEGL_IMPLEMENTATION" ] deps = [ ":libGLESv2", |