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:
Родитель
e9e0cc6312
Коммит
74d96b3268
|
@ -595,6 +595,12 @@ template("android_apk") {
|
|||
# resource dependencies of the apk.
|
||||
# unittests_dep: This should be the label of the gtest native target. This
|
||||
# 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
|
||||
# unittest_apk("foo_unittests_apk") {
|
||||
|
@ -602,7 +608,16 @@ template("android_apk") {
|
|||
# unittests_dep = ":foo_unittests"
|
||||
# }
|
||||
template("unittest_apk") {
|
||||
assert(defined(invoker.unittests_dep), "Need unittests_dep for $target_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) {
|
||||
apk_name = test_suite_name
|
||||
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"
|
||||
]
|
||||
android_manifest = "//testing/android/java/AndroidManifest.xml"
|
||||
unittests_outputs = get_target_outputs(invoker.unittests_dep)
|
||||
unittests_outputs = [ unittests_binary ]
|
||||
native_libs = [unittests_outputs[0]]
|
||||
if (defined(invoker.deps)) {
|
||||
deps = invoker.deps
|
||||
|
|
|
@ -49,10 +49,17 @@ template("android_gcc_toolchain") {
|
|||
toolchain_os = "android"
|
||||
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"
|
||||
mkdir_command = "mkdir -p lib.stripped"
|
||||
strip_command = "$android_strip --strip-unneeded -o lib.stripped/\$soname.tmp \$lib"
|
||||
replace_command = "if ! cmp -s lib.stripped/\${soname}.tmp lib.stripped/\${soname}; then mv lib.stripped/\${soname}.tmp lib.stripped/\${soname}; fi"
|
||||
strip_command = "$android_strip --strip-unneeded -o $temp_stripped_soname $soname"
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,64 +75,114 @@ template("gcc_toolchain") {
|
|||
solink_libs_section_postfix = ""
|
||||
}
|
||||
|
||||
# Make these apply to all tools below.
|
||||
lib_prefix = "-l"
|
||||
lib_dir_prefix="-L"
|
||||
# These library switches can apply to all tools below.
|
||||
lib_switch = "-l"
|
||||
lib_dir_switch = "-L"
|
||||
|
||||
tool("cc") {
|
||||
# cflags_pch_c
|
||||
command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c -c \$in -o \$out"
|
||||
description = "CC \$out"
|
||||
depfile = "\$out.d"
|
||||
depfile = "{{output}}.d"
|
||||
command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
|
||||
depsformat = "gcc"
|
||||
description = "CC {{output}}"
|
||||
outputs = [
|
||||
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
|
||||
]
|
||||
}
|
||||
|
||||
tool("cxx") {
|
||||
# cflags_pch_cc
|
||||
command = "$cxx -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_cc -c \$in -o \$out"
|
||||
description = "CXX \$out"
|
||||
depfile = "\$out.d"
|
||||
depfile = "{{output}}.d"
|
||||
command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
|
||||
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") {
|
||||
command = "rm -f \$out && $ar rcs \$out @\$rspfile"
|
||||
description = "AR \$out"
|
||||
rspfile = "\$out.rsp"
|
||||
rspfile_content = "\$in"
|
||||
rspfile = "{{output}}.rsp"
|
||||
command = "rm -f {{output}} && $ar rcs {{output}} @$rspfile"
|
||||
description = "AR {{output}}"
|
||||
rspfile_content = "{{inputs}}"
|
||||
outputs = [
|
||||
"{{target_out_dir}}/{{target_output_name}}{{output_extension}}"
|
||||
]
|
||||
default_output_extension = ".a"
|
||||
output_prefix = "lib"
|
||||
}
|
||||
|
||||
tool("solink") {
|
||||
rspfile = "\$out.rsp"
|
||||
rspfile_content = "-Wl,--whole-archive \$in \$solibs -Wl,--no-whole-archive $solink_libs_section_prefix \$libs $solink_libs_section_postfix"
|
||||
soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so".
|
||||
rspfile = soname + ".rsp"
|
||||
|
||||
# TODO(cjhopman): There needs to be a way for gn to correctly figure out
|
||||
# the outputs of a solink command.
|
||||
# These variables are not built into GN but are helpers that implement
|
||||
# (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"
|
||||
|
||||
if (defined(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"
|
||||
#pool = "link_pool"
|
||||
restat = "1"
|
||||
description = "SOLINK $soname"
|
||||
|
||||
# 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") {
|
||||
command = "$ld \$ldflags -o \$out -Wl,--start-group @\$rspfile \$solibs -Wl,--end-group $libs_section_prefix \$libs $libs_section_postfix"
|
||||
description = "LINK \$out"
|
||||
rspfile = "\$out.rsp"
|
||||
rspfile_content = "\$in"
|
||||
#pool = "link_pool"
|
||||
outfile = "{{target_output_name}}{{output_extension}}"
|
||||
rspfile = "$outfile.rsp"
|
||||
command = "$ld {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group $libs_section_prefix {{libs}} $libs_section_postfix"
|
||||
description = "LINK $outfile"
|
||||
rspfile_content = "{{inputs}}"
|
||||
outputs = [ outfile ]
|
||||
}
|
||||
|
||||
tool("stamp") {
|
||||
command = "\${postbuilds}touch \$out"
|
||||
description = "STAMP \$out"
|
||||
command = "touch {{output}}"
|
||||
description = "STAMP {{output}}"
|
||||
}
|
||||
|
||||
tool("copy") {
|
||||
command = "ln -f \$in \$out 2>/dev/null || (rm -rf \$out && cp -af \$in \$out)"
|
||||
description = "COPY \$in \$out"
|
||||
command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})"
|
||||
description = "COPY {{source}} {{output}}"
|
||||
}
|
||||
|
||||
# When invoking this toolchain not as the default one, these args will be
|
||||
|
|
|
@ -52,71 +52,135 @@ template("mac_clang_toolchain") {
|
|||
ld = invoker.ld
|
||||
|
||||
# Make these apply to all tools below.
|
||||
lib_prefix = "-l"
|
||||
lib_dir_prefix="-L"
|
||||
lib_switch = "-l"
|
||||
lib_dir_switch = "-L"
|
||||
|
||||
tool("cc") {
|
||||
command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c \$cflags_pch_c -c \$in -o \$out"
|
||||
description = "CC \$out"
|
||||
depfile = "\$out.d"
|
||||
depfile = "{{output}}.d"
|
||||
command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
|
||||
depsformat = "gcc"
|
||||
description = "CC {{output}}"
|
||||
outputs = [
|
||||
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
|
||||
]
|
||||
}
|
||||
|
||||
tool("cxx") {
|
||||
command = "$cxx -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_cc \$cflags_pch_cc -c \$in -o \$out"
|
||||
description = "CXX \$out"
|
||||
depfile = "\$out.d"
|
||||
depfile = "{{output}}.d"
|
||||
command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
|
||||
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") {
|
||||
command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c \$cflags_objc \$cflags_pch_objc -c \$in -o \$out"
|
||||
description = "OBJC \$out"
|
||||
depfile = "\$out.d"
|
||||
depfile = "{{output}}.d"
|
||||
command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} {{cflags_objc}} -c {{source}} -o {{output}}"
|
||||
depsformat = "gcc"
|
||||
description = "OBJC {{output}}"
|
||||
outputs = [
|
||||
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
|
||||
]
|
||||
}
|
||||
|
||||
tool("objcxx") {
|
||||
command = "$cxx -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_cc \$cflags_objcc \$cflags_pch_objcc -c \$in -o \$out"
|
||||
description = "OBJCXX \$out"
|
||||
depfile = "\$out.d"
|
||||
depfile = "{{output}}.d"
|
||||
command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} {{cflags_objcc}} -c {{source}} -o {{output}}"
|
||||
depsformat = "gcc"
|
||||
description = "OBJCXX {{output}}"
|
||||
outputs = [
|
||||
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
|
||||
]
|
||||
}
|
||||
|
||||
tool("alink") {
|
||||
command = "rm -f \$out && ./gyp-mac-tool filter-libtool libtool \$libtool_flags -static -o \$out \$in \$postbuilds"
|
||||
description = "LIBTOOL-STATIC \$out"
|
||||
command = "rm -f {{output}} && ./gyp-mac-tool filter-libtool libtool -static -o {{output}} {{inputs}}"
|
||||
description = "LIBTOOL-STATIC {{output}}"
|
||||
outputs = [
|
||||
"{{target_out_dir}}/{{target_output_name}}{{output_extension}}"
|
||||
]
|
||||
default_output_extension = ".a"
|
||||
output_prefix = "lib"
|
||||
}
|
||||
|
||||
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"
|
||||
description = "SOLINK \$lib"
|
||||
rspfile = "\$out.rsp"
|
||||
rspfile_content = "\$in_newline"
|
||||
#pool = "link_pool"
|
||||
restat = "1"
|
||||
dylib = "{{target_output_name}}{{output_extension}}" # eg "libfoo.dylib"
|
||||
rspfile = dylib + ".rsp"
|
||||
|
||||
# These variables are not build into GN but are helpers that implement
|
||||
# (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, 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") {
|
||||
command = "$ld \$ldflags -o \$out -Wl,-filelist,\$rspfile \$solibs \$libs \$postbuilds"
|
||||
description = "LINK \$out"
|
||||
rspfile = "\$out.rsp"
|
||||
rspfile_content = "\$in_newline"
|
||||
#pool = "link_pool"
|
||||
outfile = "{{target_output_name}}{{output_extension}}"
|
||||
rspfile = "$outfile.rsp"
|
||||
command = "$ld {{ldflags}} -o $outfile -Wl,-filelist,$rspfile {{solibs}} {{libs}}"
|
||||
description = "LINK $outfile"
|
||||
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") {
|
||||
command = "\${postbuilds}touch \$out"
|
||||
description = "STAMP \$out"
|
||||
command = "touch {{output}}"
|
||||
description = "STAMP {{output}}"
|
||||
}
|
||||
|
||||
tool("copy") {
|
||||
command = "ln -f \$in \$out 2>/dev/null || (rm -rf \$out && cp -af \$in \$out)"
|
||||
description = "COPY \$in \$out"
|
||||
command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})"
|
||||
description = "COPY {{source}} {{output}}"
|
||||
}
|
||||
|
||||
toolchain_args() {
|
||||
|
|
|
@ -18,137 +18,148 @@ gyp_win_tool_path = rebase_path("//tools/gyp/pylib/gyp/win_tool.py",
|
|||
exec_script("setup_toolchain.py",
|
||||
[ visual_studio_path, gyp_win_tool_path, windows_sdk_path ])
|
||||
|
||||
stamp_command = "$python_path gyp-win-tool stamp \$out"
|
||||
copy_command = "$python_path gyp-win-tool recursive-mirror \$in \$out"
|
||||
# Parameters:
|
||||
# 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
|
||||
# we construct different names for each type.
|
||||
c_pdb_suffix = " /Fd\${target_out_dir}/\${target_name}_c.pdb"
|
||||
cc_pdb_suffix = " /Fd\${target_out_dir}/\${target_name}_cc.pdb"
|
||||
|
||||
# 32-bit toolchain -------------------------------------------------------------
|
||||
|
||||
toolchain("32") {
|
||||
toolchain(target_name) {
|
||||
# Make these apply to all tools below.
|
||||
lib_prefix = ""
|
||||
lib_dir_prefix="/LIBPATH:"
|
||||
lib_switch = ""
|
||||
lib_dir_switch="/LIBPATH:"
|
||||
|
||||
cc_command = "ninja -t msvc -e environment.x86 -- cl.exe /nologo /showIncludes /FC @\$out.rsp /c \$in /Fo\$out"
|
||||
tool("cc") {
|
||||
command = cc_command + c_pdb_suffix
|
||||
description = "CC \$out"
|
||||
rspfile = "\$out.rsp"
|
||||
rspfile_content = "\$defines \$includes \$cflags \$cflags_c"
|
||||
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}}"
|
||||
}
|
||||
|
||||
tool("cxx") {
|
||||
command = cc_command + cc_pdb_suffix
|
||||
description = "CXX \$out"
|
||||
rspfile = "\$out.rsp"
|
||||
rspfile_content = "\$defines \$includes \$cflags \$cflags_cc"
|
||||
rspfile = "{{output}}.rsp"
|
||||
# The PDB name needs to be different between C and C++ compiled files.
|
||||
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}}"
|
||||
}
|
||||
|
||||
tool("rc") {
|
||||
command = "$python_path gyp-win-tool rc-wrapper environment.x86 rc.exe \$defines \$includes \$rcflags /fo\$out \$in"
|
||||
description = "RC \$in"
|
||||
command = "$python_path gyp-win-tool rc-wrapper $env rc.exe {{defines}} {{include_dirs}} /fo{{output}} {{source}}"
|
||||
outputs = [
|
||||
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.res",
|
||||
]
|
||||
description = "RC {{output}}"
|
||||
}
|
||||
|
||||
tool("asm") {
|
||||
command = "$python_path gyp-win-tool asm-wrapper environment.x86 ml.exe \$defines \$includes /c /Fo \$out \$in"
|
||||
description = "ASM \$in"
|
||||
command = "$python_path gyp-win-tool asm-wrapper $env ml.exe {{defines}} {{include_dirs}} /c /Fo {{output}} {{source}}"
|
||||
description = "ASM {{output}}"
|
||||
outputs = [
|
||||
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
|
||||
]
|
||||
}
|
||||
|
||||
tool("alink") {
|
||||
command = "$python_path gyp-win-tool link-wrapper environment.x86 False lib.exe /nologo /ignore:4221 /OUT:\$out @\$out.rsp"
|
||||
description = "LIB \$out"
|
||||
rspfile = "\$out.rsp"
|
||||
rspfile_content = "\$in_newline \$libflags"
|
||||
rspfile = "{{output}}.rsp"
|
||||
command = "$python_path gyp-win-tool link-wrapper $env False lib.exe /nologo /ignore:4221 /OUT:{{output}} @$rspfile"
|
||||
description = "LIB {{output}}"
|
||||
outputs = [
|
||||
# Ignore {{output_extension}} and always use .lib, there's no reason to
|
||||
# allow targets to override this extension on Windows.
|
||||
"{{target_out_dir}}/{{target_output_name}}.lib",
|
||||
]
|
||||
default_output_extension = ".lib"
|
||||
# The use of inputs_newline is to work around a fixed per-line buffer
|
||||
# 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"
|
||||
restat = "1"
|
||||
rspfile = "\$dll.rsp"
|
||||
rspfile_content = "\$libs \$in_newline \$ldflags"
|
||||
dllname = "{{target_output_name}}{{output_extension}}" # e.g. foo.dll
|
||||
libname = "{{target_output_name}}{{output_extension}}.lib" # e.g. foo.dll.lib
|
||||
rspfile = "${dllname}.rsp"
|
||||
|
||||
link_command = "$python_path gyp-win-tool link-wrapper $env False link.exe /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile"
|
||||
|
||||
# TODO(brettw) support manifests
|
||||
#manifest_command = "$python_path gyp-win-tool manifest-wrapper $env mt.exe -nologo -manifest $manifests -out:${dllname}.manifest"
|
||||
#command = "cmd /c $link_command && $manifest_command"
|
||||
command = link_command
|
||||
|
||||
default_output_extension = ".dll"
|
||||
description = "LINK(DLL) {{output}}"
|
||||
outputs = [
|
||||
dllname,
|
||||
libname,
|
||||
]
|
||||
# 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") {
|
||||
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"
|
||||
rspfile = "\$out.rsp"
|
||||
rspfile_content = "\$in_newline \$libs \$ldflags"
|
||||
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 = stamp_command
|
||||
description = "STAMP \$out"
|
||||
command = "$python_path gyp-win-tool stamp {{output}}"
|
||||
description = "STAMP {{output}}"
|
||||
}
|
||||
|
||||
tool("copy") {
|
||||
command = copy_command
|
||||
description = "COPY \$in \$out"
|
||||
}
|
||||
}
|
||||
|
||||
# 64-bit toolchain -------------------------------------------------------------
|
||||
|
||||
toolchain("64") {
|
||||
# Make these apply to all tools below.
|
||||
lib_prefix = ""
|
||||
lib_dir_prefix="/LIBPATH:"
|
||||
|
||||
cc_command = "ninja -t msvc -e environment.x64 -- cl.exe /nologo /showIncludes /FC @\$out.rsp /c \$in /Fo\$out"
|
||||
tool("cc") {
|
||||
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"
|
||||
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 = "x64"
|
||||
cpu_arch = invoker.cpu_arch
|
||||
|
||||
# Normally the build config resets the CPU architecture to 32-bits. Setting
|
||||
# this flag overrides that behavior.
|
||||
force_win64 = true
|
||||
if (defined(invoker.force_win64)) {
|
||||
force_win64 = invoker.force_win64
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
msvc_toolchain("32") {
|
||||
environment = "environment.x86"
|
||||
cpu_arch = "x64"
|
||||
}
|
||||
|
||||
msvc_toolchain("64") {
|
||||
environment = "environment.x64"
|
||||
cpu_arch = "x64"
|
||||
force_win64 = true
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче