Introduces aprecompiled_header_type flag on a tool to say whether it supports precompiled headers, and flags on configs/targets that allow one to specify which header is precompiled.
This does not implement GCC precompiled headers, but the type flag will allow future expansion (the implementation will be mostly separate).
Renames SOURCE_CC to SOURCE_CPP to avoid confusion with Toolchain::TYPE_CC (which is actually the C compiler).
BUG=297678
Review URL: https://codereview.chromium.org/1207903002
Cr-Original-Commit-Position: refs/heads/master@{#336674}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 3dab5fe87ddb0efe646f6ab393ab07533d75237d
This is enough to get base building with clang on Windows.
On Windows, we use clang-cl.exe which is command-line compatible
with cl.exe.
BUG=491209,404525
CQ_EXTRA_TRYBOTS=tryserver.chromium.linux:android_chromium_gn_compile_dbg,android_chromium_gn_compile_rel;tryserver.chromium.win:win8_chromium_gn_rel,win8_chromium_gn_dbg;tryserver.chromium.mac:mac_chromium_gn_rel,mac_chromium_gn_dbg
Review URL: https://codereview.chromium.org/1158763006
Cr-Original-Commit-Position: refs/heads/master@{#332563}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 22c76db4a60e2e23c3f8f22f8e08b9b0cb49e002
An upcoming version of GN will check that inputs to scripts are generated by public dependencies of the script. The MIDL rule is the only failing part of the Windows build.
Review URL: https://codereview.chromium.org/1152743004
Cr-Original-Commit-Position: refs/heads/master@{#332450}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: bf622f689a0f60eb57f0d634afbb3dce8b523c80
Most importantly, this passes cflags_cc to the C++ compiler.
This fixes some flag differences with the GYP build, especially when running on 64 bit.
It disables a TLS test on static debug x64 builds which also fails in GYP. This configuration is not run on the bots but is the standard GN Windows build.
BUG=251251
CQ_EXTRA_TRYBOTS=tryserver.chromium.linux:android_chromium_gn_compile_dbg,android_chromium_gn_compile_rel;tryserver.chromium.win:win8_chromium_gn_rel,win8_chromium_gn_dbg;tryserver.chromium.mac:mac_chromium_gn_rel,mac_chromium_gn_dbg
Review URL: https://codereview.chromium.org/1062743005
Cr-Original-Commit-Position: refs/heads/master@{#326856}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 9a19ddbe04e2be759a15c6a70f6585152611af23
When you run `gn gen out-gn/Debug` on Mac you get the following:
ERROR at //build/toolchain/mac/BUILD.gn:200:12: Build argument has no effect.
os = current_os
^---------
The variable "os" was set as a build argument
but never appeared in a declare_args() block in any buildfile.
BUG=None
TEST=`gn gen out-gn/Debug` passes without the above error
R=dpranke@chromium.org
Review URL: https://codereview.chromium.org/1064063002
Cr-Original-Commit-Position: refs/heads/master@{#324109}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 53ec706bbc5debe052dd51e4d93e2de4c2802ab2
Now that os and cpu_arch are no longer needed or used anywhere.
R=brettw@chromium.org, rockot@chromium.org
BUG=344767
CQ_EXTRA_TRYBOTS=tryserver.chromium.linux:android_chromium_gn_compile_dbg,android_chromium_gn_compile_rel;tryserver.chromium.win:win8_chromium_gn_rel,win8_chromium_gn_dbg;tryserver.chromium.mac:mac_chromium_gn_rel,mac_chromium_gn_dbg
Review URL: https://codereview.chromium.org/1017273002
Cr-Original-Commit-Position: refs/heads/master@{#322499}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: c329085593402937717484c073086cb1c904f37b
The latest GN binaries rename cpu_arch to current_cpu and/or target_cpu
as appropriate, build_cpu_arch to host_cpu, and os to current_os and target_os as appropriate.
R=brettw@chromium.orgTBR=ddorwin@chromium.org
EXTRA_TRYBOTS=tryserver.chromium.linux:android_chromium_gn_compile_dbg,android_chromium_gn_compile_rel;tryserver.chromium.win:win8_chromium_gn_rel,win8_chromium_gn_dbg;tryserver.chromium.mac:mac_chromium_gn_rel,mac_chromium_gn_dbg
BUG=344767
Review URL: https://codereview.chromium.org/913373002
Cr-Original-Commit-Position: refs/heads/master@{#317223}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 4327621a322c964a8bc6d1ef5a4534f0f877d63e
The newest version of GN replaces the 'cpu_arch' and 'os' variables with 'current_cpu', 'target_cpu', 'current_os', and 'target_os', and also replaces 'build_cpu' with 'host_cpu', and 'build_os' with 'host_os'.
The roll also picks up the change to add a new 'gn clean'
command, some absolute path handling fixes, a check_includes fix for action_foreach(), and some minor
internal fixes.
This patch also updates the build config files to accommodate the GN changes in a backwards-compatible manner, i.e., the configs now will set cpu_arch and os correctly in the right contexts. They will also allow the users to continue to set os= and cpu_arch= in an args file, so no user builds (or bots) will break.
Once all of the bots and all of the build files have been updated to refer to the new variables instead of the old ones, we can drop the backwards-compatible versions.
TBR=brettw@chromium.org
BUG=344767
CQ_EXTRA_TRYBOTS=tryserver.chromium.linux:android_chromium_gn_compile_dbg,android_chromium_gn_compile_rel;tryserver.chromium.win:win8_chromium_gn_rel,win8_chromium_gn_dbg;tryserver.chromium.mac:mac_chromium_gn_rel,mac_chromium_gn_dbg
Review URL: https://codereview.chromium.org/936103003
Cr-Original-Commit-Position: refs/heads/master@{#317186}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 7ee02bed35766535521c8e1f072b98cbf9eef53d
Since toolchain/mac/BUILD.gn did not have anything to support
use_goma, even if use_goma=true set, the flags was just ignored.
BUG=459435
Review URL: https://codereview.chromium.org/932013004
Cr-Original-Commit-Position: refs/heads/master@{#316758}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 874b8fe5991b4f57088f3ff4218cc8e8acd2b18d
Linker report incompatible target errors on crtbegin_so.o and
crtend_so.o because /usr/lib is set incorrectly on x64 target.
mips64el is also changed and arm64 keep use /usr/lib after checking
each platform ndk toolchains but not verified because no environment.
BUG=none
Review URL: https://codereview.chromium.org/912273002
Cr-Original-Commit-Position: refs/heads/master@{#316128}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 964602788cc2d0a2b0cb89fcbe1691852d25f251
gn now run with arg target_arch = "x64", arm64 and mips64el
releated changes are added as well but not verified.
BUG=none
Review URL: https://codereview.chromium.org/864173006
Cr-Original-Commit-Position: refs/heads/master@{#315680}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 98de73d11797b1b0ac7ac0b2f4234cb8f57bd2fc
I had to set:
DEPOT_TOOLS_WIN_TOOLCHAIN=0
GYP_MSVS_OVERRIDE_PATH=C:/Program Files (x86)/Microsoft Visual Studio 12.0
GYP_MSVS_VERSION=2013
WindowsSdkDir=C:/Program Files (x86)/Windows Kits/8.1
then
gn gen out\gn --args="is_debug=true cpu_arch=\"x86\""
ninja -C out/gn base
worked OK.
Further patches welcome to make this less ugly.
R=dpranke@chromium.org
Review URL: https://codereview.chromium.org/789303002
Cr-Original-Commit-Position: refs/heads/master@{#307791}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: fa5da3e4e515967d593c3822b1d82f5e844080c5
A starting point for doing all of src, and adding a PRESUBMIT.
Includes https://codereview.chromium.org/772663002/ and https://codereview.chromium.org/770053002/.
I haven't pushed new binaries yet.
Generated via:
> cd build
> git ls-files *.gn *.gni | sed -e "s/^/@..\\\\out\\\\Debug\\\\gn format --in-place /" >x.bat && x.bat
The only things that I don't love in the current output are:
1. Turning
args = [
"--depfile", rebase_path(depfile, root_build_dir),
"--android-sdk-tools", rebased_android_sdk_build_tools,
"--dex-path", rebased_output,
]
into:
args = [
"--depfile",
rebase_path(depfile, root_build_dir),
"--android-sdk-tools",
rebased_android_sdk_build_tools,
"--dex-path",
rebased_output,
]
The heuristic for this isn't trivial though, and it also affects e.g. '-Xclang' in cflags, as well
as assignments to temporaries that are later assigned to args.
2. Turning single line
if (defined(invoker.inputs)) { inputs = invoker.inputs }
into
if (defined(invoker.inputs)) {
inputs = invoker.inputs
}
This could be argued to be an improvement, but as it's very boilerplate-y perhaps an exception to
allow single line in this case is worthwhile. I think there was discussion of new syntax for this
case too, something like "inputs ?= invoker.inputs" maybe.
In both cases, I think it's worthwhile to get formatting turned on, and then go back and special
case these if we decide it's worthwhile.
R=brettw@chromium.org
BUG=348474
Review URL: https://codereview.chromium.org/766573003
Cr-Original-Commit-Position: refs/heads/master@{#306305}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b199254f481c5db36d56e83fce40594b06d2b81f
This fixes
"fatal error C1902: Program database manager mismatch; please check your installation"
and
"cannot find msvcr120.dll"
during gn compilation.
There were many things wrong. The primary ones were that:
1) the compiler's setup script wasn't called so we didn't get
PATH/LIB/INCLUDE for the correct cl.
2) the VS runtime dirs were not getting added to environment block.
I also removed the Express handling, as that's been removed from the
gyp path now.
This does not yet support a system-installed Visual Studio. Code
needs to be added to query the registry to find the install location.
(see _SetupScript).
R=dpranke@chromium.orgTBR=brettw@chromium.org
BUG=432375
Review URL: https://codereview.chromium.org/736073002
Cr-Original-Commit-Position: refs/heads/master@{#304864}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 9bf8fb3b74de68a85122cb45bb477d604b8c3898
In order to run both the visual studio tools and the binaries built
by them (and ninja), we need to ensure that the VS runtime DLLs
are available in the path.
In the GYP build, we accomplish this by copying them into the
Debug and Debug_x64 dirs as appropriate inside the gyp_chromium
script.
In the pure-GN build, then, things would be broken, so we need to
modify the GN build to do the copy as well, or we need to inject
a step somewhere that happens after GN runs but before Ninja tries
to run (since none of the toolchain binaries will work).
This patch accomplishes this by calling out to vs_toolchain.py to
copy the DLLs as neede when the toolchain is defined. This is somewhat
less than ideal (makes 'gn gen' slower) but seems better than forcing
devs to have to run an additional command.
In addition, the GYP build writes targets into Debug and Debug_x64
concurrently. This doesn't really carry over into GN correctly, and
we probably only ever want to write targets into Debug and Debug/64
(or some such).
However, the way the toolchains are currently implemented, it's not
clear if this really works and the interplay between 32-bit and 64-bit
is weird (we apparently normally "force" 32-bit even if we set cpu_arch
to 64-bit, and require you to specify force_win64). To work around this
and make sure that we copy the right DLLs for the right arch into the
outer Debug/ directory, this patch temporarily disables the cross-arch
part of the build, forcing the host_toolchain to match the target_toolchain.
This likely means that 'cpu_arch="x86"' works (the default), but the 'host'
binaries like image_diff and mksnapshot will be compiled in 32-bit mode,
not 64-bit mode. 'cpu_arch="x64" force_win64=true' should also work, and
produce all-64-bit binaries. 'cpu_arch="x64"' does not work at all and
won't until we can clean up the above stuff.
R=scottmg@chromium.org, brettw@chromium.org
BUG=430661
Review URL: https://codereview.chromium.org/722723004
Cr-Original-Commit-Position: refs/heads/master@{#304310}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 0b95195e49489b7a4d87048d2ce4b747173a5b8a
The big changes here are:
1) Allow injecting of a target toolchain via args for os==chromeos.
2) For ARM builds, allow injecting -mtune and -mfloat-abi settings.
3) Allow injecting a pkg-config wrapper that correctly handles the
CrOS build environment. This is how pkg-config is handled for
all other packages in the build.
4) Create libmojo_sdk target, a static library of public Mojo code
suitable for distribution.
5) Added testonly = true to a few targets under mojo/ that are not
meant to be used in production.
BUG=388412
TEST=Create a target that builds //mojo/public, build with os==chromeos
Review URL: https://codereview.chromium.org/549453004
Cr-Original-Commit-Position: refs/heads/master@{#296849}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 2c8e745d9c4de27b44f4d866a2bf0f0a880d9b8c
This changes the "test" template to create a shared_library (instead of
an executable) on Android. After this, we can actually run
base_unittests with
`build/android/test_runner.py gtest -s base_unnittests`
as normal (though may need to CHROMIUM_OUT_DIR and BUILDTYPE as
appropriate).
This requires adding the following targets:
//testing/android:native_test_native_code
//testing/android:native_test_util
//testing/android:native_test_jni_headers
//tools/android/md5sum:md5sum
//tools/android/md5sum:md5sum_bin
//tools/android/md5sum:md5sum_prepare_dist
//tools/android/md5sum:md5sum_copy_host
Also, makes it so that native executables are stripped (just like shared
libraries). Adds a simple create_native_execuatable_dist template that
sets up a dist directory for the executable (see
build/android/gyp/native_app_dependencies.gyp).
BUG=359249
TBR=rlarocque
Review URL: https://codereview.chromium.org/557463002
Cr-Original-Commit-Position: refs/heads/master@{#294032}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: e65ead8fb1a1976682356cf824445476584e70f0
This uses the code from GYP to compute the maximum number of concurrent links
to use in the link pool, and sets this value in the toolchains.
Review URL: https://codereview.chromium.org/548633004
Cr-Original-Commit-Position: refs/heads/master@{#294007}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 937a6d51df85cd7e338b952aeacb03bf7e5726c2
This adds support for android_apk targets without any java included
directly in the target (only included through deps).
This adds the following targets:
//base:base_javatests
//content/public/android:content_javatests
//content/shell/android:content_shell_test_apk
//media/android:media_android_imageformat_list (moved)
//media/android:media_java (moved+fixed)
BUG=359249
Review URL: https://codereview.chromium.org/525533003
Cr-Original-Commit-Position: refs/heads/master@{#293897}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 394dfd1052e53e64083daef7cc66055557256dcb
Currently this is either a list or a string. However, this is causing some problems because templates can't add to the invoker's visibility list without knowing if the original is a string or a list.
In an effort to make this consistent, I'm converting all visibiltiy to be lists, and will remove support for strings in a future build.
This exempts cld from header checking since it was confusing GN's header checker. It adds a ppapi header target as well that will be used by libyuv (that requires a roll).
TBR=scottmg
Review URL: https://codereview.chromium.org/544423002
Cr-Original-Commit-Position: refs/heads/master@{#293638}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 9af4262ad8020658ee04c07d13a2617af64147b1
Previously it put all toolchains' main link output into the root build directory, which doesn't work when there are multiple toolchains generating the same targets.
BUG=405686
R=jamesr@chromium.org
Review URL: https://codereview.chromium.org/502163002
Cr-Original-Commit-Position: refs/heads/master@{#291927}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: d40ebfebd18d8fc41a0f5af61d28b6c252b66bea
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
Passing $rspfile_content passes the content of the rsp file verbatim
to the command line, which kind of defeats the purpose of using rsp files.
@\$rspfile tells the linker to open up the file itself.
BUG=398255
Review URL: https://codereview.chromium.org/428013002
git-svn-id: http://src.chromium.org/svn/trunk/src/build@286675 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
The solink command included the "real" link command twice and only used
the libs_section_prefix/postfix in one of the two. This splits the
construction of the link command up a bit to make it clearer.
This adds a simple post_solink arg to gcc_toolchain that allows the
caller to add more stuff to the solink command. This is used to
automatically strip all shared libraries in Android builds (in gyp, we
do this for a library once for each apk that it is in :/ ).
BUG=359249
Review URL: https://codereview.chromium.org/372813002
git-svn-id: http://src.chromium.org/svn/trunk/src/build@286282 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
On android we have to specify crtbegin_dynamic.o / crtend_android.o when
linking executables and crtbegin_so.o / crtend_so.o when linking shared
libraries. This splits the variables up in gcc_toolchain so the android
template can differentiate between the two.
Review URL: https://codereview.chromium.org/420353002
git-svn-id: http://src.chromium.org/svn/trunk/src/build@285991 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
Previously the GN Windows build specified the symbol file $pdbfile but this variable was never defined, so the command like would just say "/Fd" and the default one would be used.
This patch defines some per-target variables in the ninja file for the toolchain to use. The Windows toolchain uses these to construct C- and C++-specific pdb files (the MS tools can't share between these two) for the current target.
BUG=
R=scottmg@chromium.org
Review URL: https://codereview.chromium.org/406453002
git-svn-id: http://src.chromium.org/svn/trunk/src/build@284137 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
The problem was that the toolchain definitions had an is_clang block in them, but this is only evaluated in the context of the default toolchain (so false for and Android build). But then when we were re-evaluating the build config for the host compile, it was forcing clang to true which was causing the clang flags to be set.
This changes the way we default the is_clang value. Forcing it to true prevents it from being overridden manually. In some cases, like mac, this is pointless. In other cases like Linux, we may want to turn it on and off. Changing this definition allows us to toggle it on and off for different toolchains as we desire.
Ideally I think the way of defining toolchains would be different to make this a bit more flexible, I'll think about this. But this will work for now.
R=thakis@chromium.org
Review URL: https://codereview.chromium.org/385823002
git-svn-id: http://src.chromium.org/svn/trunk/src/build@282685 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
The mac GN build exceeds the command line limit when linking large
targets like webkit_unit_tests. The fix is to pass a response file to
the linker instead of passing a list of object files. Passing this by
@rspfile ends up expanding the list before calling clang, so this instead
passes it via the filelist parameter.
BUG=386046
Review URL: https://codereview.chromium.org/340233002
git-svn-id: http://src.chromium.org/svn/trunk/src/build@278424 4ff67af0-8c30-449e-8e8b-ad334ec8d88c