Pull new GN, update toolchain definitions

This pulls buildtools to get GN 290714 and updates to the new style of toolchain definitions in that revision.

Unfortunately, this new version doesn't support getting the outputs of excutables, which made the android unit test template a bit less automatic. We can consider how to best fix this in the future.

R=jamesr@chromium.org

Review URL: https://codereview.chromium.org/485833003

git-svn-id: http://src.chromium.org/svn/trunk/src/build@290894 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
brettw@chromium.org 2014-08-20 19:39:43 +00:00
Родитель e9e0cc6312
Коммит 74d96b3268
5 изменённых файлов: 354 добавлений и 207 удалений

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

@ -595,6 +595,12 @@ template("android_apk") {
# resource dependencies of the apk. # resource dependencies of the apk.
# unittests_dep: This should be the label of the gtest native target. This # unittests_dep: This should be the label of the gtest native target. This
# target must be defined previously in the same file. # target must be defined previously in the same file.
# unittests_binary: The name of the binary produced by the unittests_dep
# target, relative to the root build directory. If unspecified, it assumes
# the name of the unittests_dep target (which will be correct unless that
# target specifies an "output_name".
# TODO(brettw) make this automatic by allowing get_target_outputs to
# support executables.
# #
# Example # Example
# unittest_apk("foo_unittests_apk") { # unittest_apk("foo_unittests_apk") {
@ -602,7 +608,16 @@ template("android_apk") {
# unittests_dep = ":foo_unittests" # unittests_dep = ":foo_unittests"
# } # }
template("unittest_apk") { template("unittest_apk") {
assert(defined(invoker.unittests_dep), "Need unittests_dep for $target_name")
test_suite_name = get_label_info(invoker.unittests_dep, "name") test_suite_name = get_label_info(invoker.unittests_dep, "name")
if (defined(invoker.unittests_binary)) {
unittests_binary = root_out_dir + "/" + invoker.unittests_binary
} else {
unittests_binary = root_out_dir + "/" + test_suite_name
}
android_apk(target_name) { android_apk(target_name) {
apk_name = test_suite_name apk_name = test_suite_name
final_apk_path = "$root_build_dir/${apk_name}_apk/${apk_name}-debug.apk" final_apk_path = "$root_build_dir/${apk_name}_apk/${apk_name}-debug.apk"
@ -610,7 +625,7 @@ template("unittest_apk") {
"//testing/android/java/src/org/chromium/native_test/ChromeNativeTestActivity.java" "//testing/android/java/src/org/chromium/native_test/ChromeNativeTestActivity.java"
] ]
android_manifest = "//testing/android/java/AndroidManifest.xml" android_manifest = "//testing/android/java/AndroidManifest.xml"
unittests_outputs = get_target_outputs(invoker.unittests_dep) unittests_outputs = [ unittests_binary ]
native_libs = [unittests_outputs[0]] native_libs = [unittests_outputs[0]]
if (defined(invoker.deps)) { if (defined(invoker.deps)) {
deps = invoker.deps deps = invoker.deps

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

@ -49,10 +49,17 @@ template("android_gcc_toolchain") {
toolchain_os = "android" toolchain_os = "android"
toolchain_cpu_arch = invoker.toolchain_cpu_arch toolchain_cpu_arch = invoker.toolchain_cpu_arch
# We make the assumption that the gcc_toolchain will produce a soname with
# the following definition.
soname = "{{target_output_name}}{{output_extension}}"
stripped_soname = "lib.stripped/${soname}.tmp"
temp_stripped_soname = "${stripped_soname}.tmp"
android_strip = "${tool_prefix}strip" android_strip = "${tool_prefix}strip"
mkdir_command = "mkdir -p lib.stripped" mkdir_command = "mkdir -p lib.stripped"
strip_command = "$android_strip --strip-unneeded -o lib.stripped/\$soname.tmp \$lib" strip_command = "$android_strip --strip-unneeded -o $temp_stripped_soname $soname"
replace_command = "if ! cmp -s lib.stripped/\${soname}.tmp lib.stripped/\${soname}; then mv lib.stripped/\${soname}.tmp lib.stripped/\${soname}; fi" replace_command = "if ! cmp -s $temp_stripped_soname $stripped_soname; then mv $temp_stripped_soname $stripped_soname; fi"
postsolink = "$mkdir_command && $strip_command && $replace_command" postsolink = "$mkdir_command && $strip_command && $replace_command"
} }
} }

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

@ -75,64 +75,114 @@ template("gcc_toolchain") {
solink_libs_section_postfix = "" solink_libs_section_postfix = ""
} }
# Make these apply to all tools below. # These library switches can apply to all tools below.
lib_prefix = "-l" lib_switch = "-l"
lib_dir_prefix="-L" lib_dir_switch = "-L"
tool("cc") { tool("cc") {
# cflags_pch_c depfile = "{{output}}.d"
command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c -c \$in -o \$out" command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
description = "CC \$out"
depfile = "\$out.d"
depsformat = "gcc" depsformat = "gcc"
description = "CC {{output}}"
outputs = [
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
]
} }
tool("cxx") { tool("cxx") {
# cflags_pch_cc depfile = "{{output}}.d"
command = "$cxx -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_cc -c \$in -o \$out" command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
description = "CXX \$out"
depfile = "\$out.d"
depsformat = "gcc" depsformat = "gcc"
description = "CXX {{output}}"
outputs = [
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
]
} }
tool("asm") {
# For GCC we can just use the C compiler to compile assembly.
depfile = "{{output}}.d"
command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
depsformat = "gcc"
description = "ASM {{output}}"
outputs = [
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
]
}
tool("alink") { tool("alink") {
command = "rm -f \$out && $ar rcs \$out @\$rspfile" rspfile = "{{output}}.rsp"
description = "AR \$out" command = "rm -f {{output}} && $ar rcs {{output}} @$rspfile"
rspfile = "\$out.rsp" description = "AR {{output}}"
rspfile_content = "\$in" rspfile_content = "{{inputs}}"
outputs = [
"{{target_out_dir}}/{{target_output_name}}{{output_extension}}"
]
default_output_extension = ".a"
output_prefix = "lib"
} }
tool("solink") { tool("solink") {
rspfile = "\$out.rsp" soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so".
rspfile_content = "-Wl,--whole-archive \$in \$solibs -Wl,--no-whole-archive $solink_libs_section_prefix \$libs $solink_libs_section_postfix" rspfile = soname + ".rsp"
# TODO(cjhopman): There needs to be a way for gn to correctly figure out # These variables are not built into GN but are helpers that implement
# the outputs of a solink command. # (1) linking to produce a .so, (2) extracting the symbols from that file
# to a temporary file, (3) if the temporary file has differences from the
# existing .TOC file, overwrite it, otherwise, don't change it.
tocname = soname + ".TOC"
temporary_tocname = soname + ".tmp"
link_command = "$ld -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$rspfile"
toc_command = "{ readelf -d $soname | grep SONAME ; nm -gD -f p $soname | cut -f1-2 -d' '; } > $temporary_tocname"
replace_command = "if ! cmp -s $temporary_tocname $tocname; then mv $temporary_tocname $tocname; fi"
link_command = "$ld -shared \$ldflags -o \$lib -Wl,-soname=\$soname @\$rspfile"
toc_command = "{ readelf -d \${lib} | grep SONAME ; nm -gD -f p \${lib} | cut -f1-2 -d' '; } > \${lib}.tmp"
replace_command = "if ! cmp -s \${lib}.tmp \${lib}.TOC; then mv \${lib}.tmp \${lib}.TOC; fi"
command = "$link_command && $toc_command && $replace_command" command = "$link_command && $toc_command && $replace_command"
if (defined(invoker.postsolink)) { if (defined(invoker.postsolink)) {
command += " && " + invoker.postsolink command += " && " + invoker.postsolink
} }
rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive $solink_libs_section_prefix {{libs}} $solink_libs_section_postfix"
description = "SOLINK \$lib" description = "SOLINK $soname"
#pool = "link_pool"
restat = "1" # Use this for {{output_extension}} expansions unless a target manually
# overrides it (in which case {{output_extension}} will be what the target
# specifies).
default_output_extension = ".so"
output_prefix = "lib"
# Since the above commands only updates the .TOC file when it changes, ask
# Ninja to check if the timestamp actually changed to know if downstream
# dependencies should be recompiled.
restat = true
# Tell GN about the output files. It will link to the soname but use the
# tocname for dependency management.
outputs = [
soname,
tocname,
]
link_output = soname
depend_output = tocname
} }
tool("link") { tool("link") {
command = "$ld \$ldflags -o \$out -Wl,--start-group @\$rspfile \$solibs -Wl,--end-group $libs_section_prefix \$libs $libs_section_postfix" outfile = "{{target_output_name}}{{output_extension}}"
description = "LINK \$out" rspfile = "$outfile.rsp"
rspfile = "\$out.rsp" command = "$ld {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group $libs_section_prefix {{libs}} $libs_section_postfix"
rspfile_content = "\$in" description = "LINK $outfile"
#pool = "link_pool" rspfile_content = "{{inputs}}"
outputs = [ outfile ]
} }
tool("stamp") { tool("stamp") {
command = "\${postbuilds}touch \$out" command = "touch {{output}}"
description = "STAMP \$out" description = "STAMP {{output}}"
} }
tool("copy") { tool("copy") {
command = "ln -f \$in \$out 2>/dev/null || (rm -rf \$out && cp -af \$in \$out)" command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})"
description = "COPY \$in \$out" description = "COPY {{source}} {{output}}"
} }
# When invoking this toolchain not as the default one, these args will be # When invoking this toolchain not as the default one, these args will be

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

@ -52,71 +52,135 @@ template("mac_clang_toolchain") {
ld = invoker.ld ld = invoker.ld
# Make these apply to all tools below. # Make these apply to all tools below.
lib_prefix = "-l" lib_switch = "-l"
lib_dir_prefix="-L" lib_dir_switch = "-L"
tool("cc") { tool("cc") {
command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c \$cflags_pch_c -c \$in -o \$out" depfile = "{{output}}.d"
description = "CC \$out" command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
depfile = "\$out.d"
depsformat = "gcc" depsformat = "gcc"
description = "CC {{output}}"
outputs = [
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
]
} }
tool("cxx") { tool("cxx") {
command = "$cxx -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_cc \$cflags_pch_cc -c \$in -o \$out" depfile = "{{output}}.d"
description = "CXX \$out" command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
depfile = "\$out.d"
depsformat = "gcc" depsformat = "gcc"
description = "CXX {{output}}"
outputs = [
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
]
} }
tool("asm") {
# For GCC we can just use the C compiler to compile assembly.
depfile = "{{output}}.d"
command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
depsformat = "gcc"
description = "ASM {{output}}"
outputs = [
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
]
}
tool("objc") { tool("objc") {
command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c \$cflags_objc \$cflags_pch_objc -c \$in -o \$out" depfile = "{{output}}.d"
description = "OBJC \$out" command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} {{cflags_objc}} -c {{source}} -o {{output}}"
depfile = "\$out.d"
depsformat = "gcc" depsformat = "gcc"
description = "OBJC {{output}}"
outputs = [
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
]
} }
tool("objcxx") { tool("objcxx") {
command = "$cxx -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_cc \$cflags_objcc \$cflags_pch_objcc -c \$in -o \$out" depfile = "{{output}}.d"
description = "OBJCXX \$out" command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} {{cflags_objcc}} -c {{source}} -o {{output}}"
depfile = "\$out.d"
depsformat = "gcc" depsformat = "gcc"
description = "OBJCXX {{output}}"
outputs = [
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
]
} }
tool("alink") { tool("alink") {
command = "rm -f \$out && ./gyp-mac-tool filter-libtool libtool \$libtool_flags -static -o \$out \$in \$postbuilds" command = "rm -f {{output}} && ./gyp-mac-tool filter-libtool libtool -static -o {{output}} {{inputs}}"
description = "LIBTOOL-STATIC \$out" description = "LIBTOOL-STATIC {{output}}"
outputs = [
"{{target_out_dir}}/{{target_output_name}}{{output_extension}}"
]
default_output_extension = ".a"
output_prefix = "lib"
} }
tool("solink") { tool("solink") {
command = "if [ ! -e \$lib -o ! -e \${lib}.TOC ] || otool -l \$lib | grep -q LC_REEXPORT_DYLIB ; then $ld -shared \$ldflags -o \$lib -Wl,-filelist,\$rspfile \$solibs \$libs \$postbuilds && { otool -l \$lib | grep LC_ID_DYLIB -A 5; nm -gP \$lib | cut -f1-2 -d' ' | grep -v U\$\$; true; } > \${lib}.TOC; else $ld -shared \$ldflags -o \$lib \$in \$solibs \$libs \$postbuilds && { otool -l \$lib | grep LC_ID_DYLIB -A 5; nm -gP \$lib | cut -f1-2 -d' ' | grep -v U\$\$; true; } > \${lib}.tmp && if ! cmp -s \${lib}.tmp \${lib}.TOC; then mv \${lib}.tmp \${lib}.TOC ; fi; fi" dylib = "{{target_output_name}}{{output_extension}}" # eg "libfoo.dylib"
description = "SOLINK \$lib" rspfile = dylib + ".rsp"
rspfile = "\$out.rsp"
rspfile_content = "\$in_newline" # These variables are not build into GN but are helpers that implement
#pool = "link_pool" # (1) linking to produce a .so, (2) extracting the symbols from that file
restat = "1" # to a temporary file, (3) if the temporary file has differences from the
# existing .TOC file, overwrite it, oterwise, don't change it.
#
# As a special case, if the library reexports symbols from other dynamic
# libraries, we always update the .TOC and skip the temporary file and
# diffing steps, since that library always needs to be re-linked.
tocname = dylib + ".TOC"
temporary_tocname = dylib + ".tmp"
does_reexport_command = "[ ! -e $dylib -o ! -e $tocname ] || otool -l $dylib | grep -q LC_REEXPORT_DYLIB"
link_command = "$ld -shared {{ldflags}} -o $dylib -Wl,-filelist,$rspfile {{solibs}} {{libs}}"
replace_command = "if ! cmp -s $temporary_tocname $tocname; then mv $temporary_tocname $tocname"
extract_toc_command = "{ otool -l $dylib | grep LC_ID_DYLIB -A 5; nm -gP $dylib | cut -f1-2 -d' ' | grep -v U\$\$; true; }"
command = "if $does_reexport_command ; then $link_command && $extract_toc_command > $tocname; else $link_command && $extract_toc_command > $temporary_tocname && $replace_command ; fi; fi"
rspfile_content = "{{inputs_newline}}"
description = "SOLINK {{output}}"
# Use this for {{output_extension}} expansions unless a target manually
# overrides it (in which case {{output_extension}} will be what the target
# specifies).
default_output_extension = ".dylib"
output_prefix = "lib"
# Since the above commands only updates the .TOC file when it changes, ask
# Ninja to check if the timestamp actually changed to know if downstream
# dependencies should be recompiled.
restat = true
# Tell GN about the output files. It will link to the dylib but use the
# tocname for dependency management.
outputs = [
dylib,
tocname,
]
link_output = dylib
depend_output = tocname
} }
tool("link") { tool("link") {
command = "$ld \$ldflags -o \$out -Wl,-filelist,\$rspfile \$solibs \$libs \$postbuilds" outfile = "{{target_output_name}}{{output_extension}}"
description = "LINK \$out" rspfile = "$outfile.rsp"
rspfile = "\$out.rsp" command = "$ld {{ldflags}} -o $outfile -Wl,-filelist,$rspfile {{solibs}} {{libs}}"
rspfile_content = "\$in_newline" description = "LINK $outfile"
#pool = "link_pool" rspfile_content = "{{inputs_newline}}"
outputs = [ outfile ]
} }
#tool("infoplist") {
# command = "$cc -E -P -Wno-trigraphs -x c \$defines \$in -o \$out && plutil -convert xml1 \$out \$out"
# description = "INFOPLIST \$out"
#}
#tool("mac_tool") {
# command = "\$env ./gyp-mac-tool \$mactool_cmd \$in \$out"
# description = "MACTOOL \$mactool_cmd \$in"
#}
#tool("package_framework") {
# command = "./gyp-mac-tool package-framework \$out \$version \$postbuilds && touch \$out"
# description = "PACKAGE FRAMEWORK \$out, POSTBUILDS"
#}
tool("stamp") { tool("stamp") {
command = "\${postbuilds}touch \$out" command = "touch {{output}}"
description = "STAMP \$out" description = "STAMP {{output}}"
} }
tool("copy") { tool("copy") {
command = "ln -f \$in \$out 2>/dev/null || (rm -rf \$out && cp -af \$in \$out)" command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})"
description = "COPY \$in \$out" description = "COPY {{source}} {{output}}"
} }
toolchain_args() { toolchain_args() {

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

@ -18,137 +18,148 @@ gyp_win_tool_path = rebase_path("//tools/gyp/pylib/gyp/win_tool.py",
exec_script("setup_toolchain.py", exec_script("setup_toolchain.py",
[ visual_studio_path, gyp_win_tool_path, windows_sdk_path ]) [ visual_studio_path, gyp_win_tool_path, windows_sdk_path ])
stamp_command = "$python_path gyp-win-tool stamp \$out" # Parameters:
copy_command = "$python_path gyp-win-tool recursive-mirror \$in \$out" # cpu_arch: cpu_arch to pass as a build arg
# environment: File name of environment file.
# force_win64 (optional): value for this build arg.
template("msvc_toolchain") {
env = invoker.environment
# MSVC can't share PDB files between compilers compiling C and C++ files, so toolchain(target_name) {
# we construct different names for each type. # Make these apply to all tools below.
c_pdb_suffix = " /Fd\${target_out_dir}/\${target_name}_c.pdb" lib_switch = ""
cc_pdb_suffix = " /Fd\${target_out_dir}/\${target_name}_cc.pdb" lib_dir_switch="/LIBPATH:"
# 32-bit toolchain ------------------------------------------------------------- tool("cc") {
rspfile = "{{output}}.rsp"
pdbname = "{{target_out_dir}}/{{target_output_name}}_c.pdb"
command = "ninja -t msvc -e $env -- cl.exe /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd$pdbname"
depsformat = "msvc"
description = "CC {{output}}"
outputs = [
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
]
rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}"
}
toolchain("32") { tool("cxx") {
# Make these apply to all tools below. rspfile = "{{output}}.rsp"
lib_prefix = "" # The PDB name needs to be different between C and C++ compiled files.
lib_dir_prefix="/LIBPATH:" pdbname = "{{target_out_dir}}/{{target_output_name}}_cc.pdb"
command = "ninja -t msvc -e $env -- cl.exe /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd$pdbname"
depsformat = "msvc"
description = "CXX {{output}}"
outputs = [
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
]
rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}"
}
cc_command = "ninja -t msvc -e environment.x86 -- cl.exe /nologo /showIncludes /FC @\$out.rsp /c \$in /Fo\$out" tool("rc") {
tool("cc") { command = "$python_path gyp-win-tool rc-wrapper $env rc.exe {{defines}} {{include_dirs}} /fo{{output}} {{source}}"
command = cc_command + c_pdb_suffix outputs = [
description = "CC \$out" "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.res",
rspfile = "\$out.rsp" ]
rspfile_content = "\$defines \$includes \$cflags \$cflags_c" description = "RC {{output}}"
depsformat = "msvc" }
}
tool("cxx") { tool("asm") {
command = cc_command + cc_pdb_suffix command = "$python_path gyp-win-tool asm-wrapper $env ml.exe {{defines}} {{include_dirs}} /c /Fo {{output}} {{source}}"
description = "CXX \$out" description = "ASM {{output}}"
rspfile = "\$out.rsp" outputs = [
rspfile_content = "\$defines \$includes \$cflags \$cflags_cc" "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
depsformat = "msvc" ]
} }
tool("rc") {
command = "$python_path gyp-win-tool rc-wrapper environment.x86 rc.exe \$defines \$includes \$rcflags /fo\$out \$in" tool("alink") {
description = "RC \$in" rspfile = "{{output}}.rsp"
} command = "$python_path gyp-win-tool link-wrapper $env False lib.exe /nologo /ignore:4221 /OUT:{{output}} @$rspfile"
tool("asm") { description = "LIB {{output}}"
command = "$python_path gyp-win-tool asm-wrapper environment.x86 ml.exe \$defines \$includes /c /Fo \$out \$in" outputs = [
description = "ASM \$in" # Ignore {{output_extension}} and always use .lib, there's no reason to
} # allow targets to override this extension on Windows.
tool("alink") { "{{target_out_dir}}/{{target_output_name}}.lib",
command = "$python_path gyp-win-tool link-wrapper environment.x86 False lib.exe /nologo /ignore:4221 /OUT:\$out @\$out.rsp" ]
description = "LIB \$out" default_output_extension = ".lib"
rspfile = "\$out.rsp" # The use of inputs_newline is to work around a fixed per-line buffer
rspfile_content = "\$in_newline \$libflags" # size in the linker.
} rspfile_content = "{{inputs_newline}}"
tool("solink") { }
command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x86 False link.exe /nologo \$implibflag /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $python_path gyp-win-tool manifest-wrapper environment.x86 mt.exe -nologo -manifest \$manifests -out:\$dll.manifest"
description = "LINK(DLL) \$dll" tool("solink") {
restat = "1" dllname = "{{target_output_name}}{{output_extension}}" # e.g. foo.dll
rspfile = "\$dll.rsp" libname = "{{target_output_name}}{{output_extension}}.lib" # e.g. foo.dll.lib
rspfile_content = "\$libs \$in_newline \$ldflags" rspfile = "${dllname}.rsp"
}
tool("link") { link_command = "$python_path gyp-win-tool link-wrapper $env False link.exe /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile"
command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x86 False link.exe /nologo /OUT:\$out /PDB:\$out.pdb @\$out.rsp && $python_path gyp-win-tool manifest-wrapper environment.x86 mt.exe -nologo -manifest \$manifests -out:\$out.manifest"
description = "LINK \$out" # TODO(brettw) support manifests
rspfile = "\$out.rsp" #manifest_command = "$python_path gyp-win-tool manifest-wrapper $env mt.exe -nologo -manifest $manifests -out:${dllname}.manifest"
rspfile_content = "\$in_newline \$libs \$ldflags" #command = "cmd /c $link_command && $manifest_command"
} command = link_command
tool("stamp") {
command = stamp_command default_output_extension = ".dll"
description = "STAMP \$out" description = "LINK(DLL) {{output}}"
} outputs = [
tool("copy") { dllname,
command = copy_command libname,
description = "COPY \$in \$out" ]
# The use of inputs_newline is to work around a fixed per-line buffer
# size in the linker.
rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}"
}
tool("link") {
rspfile = "{{output}}.rsp"
link_command = "$python_path gyp-win-tool link-wrapper $env False link.exe /nologo /OUT:{{output}} /PDB:{{output}}.pdb @$rspfile"
# TODO(brettw) support manifests
#manifest_command = "$python_path gyp-win-tool manifest-wrapper $env mt.exe -nologo -manifest $manifests -out:{{output}}.manifest"
#command = "cmd /c $link_command && $manifest_command"
command = link_command
default_output_extension = ".exe"
description = "LINK {{output}}"
outputs = [
"{{target_output_name}}{{output_extension}}",
]
# The use of inputs_newline is to work around a fixed per-line buffer
# size in the linker.
rspfile_content = "{{inputs_newline}} {{libs}} {{solibs}} {{ldflags}}"
}
tool("stamp") {
command = "$python_path gyp-win-tool stamp {{output}}"
description = "STAMP {{output}}"
}
tool("copy") {
command = "$python_path gyp-win-tool recursive-mirror {{source}} {{output}}"
description = "COPY {{source}} {{output}}"
}
# When invoking this toolchain not as the default one, these args will be
# passed to the build. They are ignored when this is the default toolchain.
toolchain_args() {
cpu_arch = invoker.cpu_arch
# Normally the build config resets the CPU architecture to 32-bits. Setting
# this flag overrides that behavior.
if (defined(invoker.force_win64)) {
force_win64 = invoker.force_win64
}
}
} }
} }
# 64-bit toolchain ------------------------------------------------------------- msvc_toolchain("32") {
environment = "environment.x86"
toolchain("64") { cpu_arch = "x64"
# Make these apply to all tools below. }
lib_prefix = ""
lib_dir_prefix="/LIBPATH:" msvc_toolchain("64") {
environment = "environment.x64"
cc_command = "ninja -t msvc -e environment.x64 -- cl.exe /nologo /showIncludes /FC @\$out.rsp /c \$in /Fo\$out" cpu_arch = "x64"
tool("cc") { force_win64 = true
command = cc_command + c_pdb_suffix
description = "CC \$out"
rspfile = "\$out.rsp"
rspfile_content = "\$defines \$includes \$cflags \$cflags_c"
depsformat = "msvc"
}
tool("cxx") {
command = cc_command + cc_pdb_suffix
description = "CXX \$out"
rspfile = "\$out.rsp"
rspfile_content = "\$defines \$includes \$cflags \$cflags_cc"
depsformat = "msvc"
}
tool("rc") {
command = "$python_path gyp-win-tool rc-wrapper environment.x64 rc.exe \$defines \$includes \$rcflags /fo\$out \$in"
description = "RC \$in"
}
tool("asm") {
command = "$python_path gyp-win-tool asm-wrapper environment.x64 ml.exe \$defines \$includes /c /Fo \$out \$in"
description = "ASM \$in"
}
tool("alink") {
command = "$python_path gyp-win-tool link-wrapper environment.x64 False lib.exe /nologo /ignore:4221 /OUT:\$out @\$out.rsp"
description = "LIB \$out"
rspfile = "\$out.rsp"
rspfile_content = "\$in_newline \$libflags"
}
tool("solink") {
command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x64 False link.exe /nologo \$implibflag /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $python_path gyp-win-tool manifest-wrapper environment.x64 mt.exe -nologo -manifest \$manifests -out:\$dll.manifest"
description = "LINK(DLL) \$dll"
restat = "1"
rspfile = "\$dll.rsp"
rspfile_content = "\$libs \$in_newline \$ldflags"
}
tool("link") {
command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x64 False link.exe /nologo /OUT:\$out /PDB:\$out.pdb @\$out.rsp && $python_path gyp-win-tool manifest-wrapper environment.x64 mt.exe -nologo -manifest \$manifests -out:\$out.manifest"
description = "LINK \$out"
rspfile = "\$out.rsp"
rspfile_content = "\$in_newline \$libs \$ldflags"
}
tool("stamp") {
command = stamp_command
description = "STAMP \$out"
}
tool("copy") {
command = copy_command
description = "COPY \$in \$out"
}
# When invoking this toolchain not as the default one, these args will be
# passed to the build. They are ignored when this is the default toolchain.
toolchain_args() {
cpu_arch = "x64"
# Normally the build config resets the CPU architecture to 32-bits. Setting
# this flag overrides that behavior.
force_win64 = true
}
} }