summaryrefslogtreecommitdiffstats
path: root/tools/gn/secondary/build
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-29 23:43:57 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-29 23:43:57 +0000
commit42b80efc8d8588bf369f428129333c7447070ebd (patch)
tree7d36821c825c6305daef5e63570e3b9847c165fc /tools/gn/secondary/build
parent29033ea9ed6cc32c934d27ceebe77fdfb7735603 (diff)
downloadchromium_src-42b80efc8d8588bf369f428129333c7447070ebd.zip
chromium_src-42b80efc8d8588bf369f428129333c7447070ebd.tar.gz
chromium_src-42b80efc8d8588bf369f428129333c7447070ebd.tar.bz2
Work on GYP generation for GN. The hybrid build now works in xcode and ninja.
Write mac tool to output dir in toolchain setup. BUG= R=thakis@chromium.org Review URL: https://codereview.chromium.org/46683002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231669 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/gn/secondary/build')
-rw-r--r--tools/gn/secondary/build/config/BUILDCONFIG.gn1
-rw-r--r--tools/gn/secondary/build/config/compiler/BUILD.gn6
-rw-r--r--tools/gn/secondary/build/toolchain/mac/BUILD.gn9
-rw-r--r--tools/gn/secondary/build/toolchain/mac/setup_toolchain.py29
4 files changed, 41 insertions, 4 deletions
diff --git a/tools/gn/secondary/build/config/BUILDCONFIG.gn b/tools/gn/secondary/build/config/BUILDCONFIG.gn
index 78a3f27..99e1e91 100644
--- a/tools/gn/secondary/build/config/BUILDCONFIG.gn
+++ b/tools/gn/secondary/build/config/BUILDCONFIG.gn
@@ -79,6 +79,7 @@ if (os == "win") {
is_nacl = false
is_posix = true
is_win = false
+ is_clang = true # Always use clang on Mac.
} else if (os == "android") {
is_android = false
is_chromeos = false
diff --git a/tools/gn/secondary/build/config/compiler/BUILD.gn b/tools/gn/secondary/build/config/compiler/BUILD.gn
index 6174b2e..ef9d61f9 100644
--- a/tools/gn/secondary/build/config/compiler/BUILD.gn
+++ b/tools/gn/secondary/build/config/compiler/BUILD.gn
@@ -116,9 +116,7 @@ config("compiler") {
# Clang-specific compiler flags setup.
# ------------------------------------
- # TODO(brettw) these should be clang-only. For now, make it mac-only since
- # that's where we always use clang.
- if (is_mac) { # if (is_clang) {
+ if (is_clang) {
cflags += [
"-fcolor-diagnostics",
]
@@ -301,7 +299,7 @@ config("default_warnings") {
# TODO(brettw) Ones below here should be clang-only when we have a flag
# for it.
- if (is_mac) { #if (is_clang) {
+ if (is_clang) {
cflags += [
"-Wheader-hygiene",
diff --git a/tools/gn/secondary/build/toolchain/mac/BUILD.gn b/tools/gn/secondary/build/toolchain/mac/BUILD.gn
index 2752d5a..b8a3c5e 100644
--- a/tools/gn/secondary/build/toolchain/mac/BUILD.gn
+++ b/tools/gn/secondary/build/toolchain/mac/BUILD.gn
@@ -2,10 +2,19 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+# Should only be running on Mac.
+assert(is_mac)
+
cc = rebase_path("//third_party/llvm-build/Release+Asserts/bin/clang", ".", root_build_dir)
cxx = rebase_path("//third_party/llvm-build/Release+Asserts/bin/clang++", ".", root_build_dir)
ld = cxx
+# This will copy the gyp-mac-tool to the build directory. We pass in the source
+# file of the win tool.
+gyp_mac_tool_source =
+ rebase_path("//tools/gyp/pylib/gyp/mac_tool.py", ".", root_build_dir)
+exec_script("setup_toolchain.py", [ gyp_mac_tool_source ], "value")
+
toolchain("clang") {
# Make these apply to all tools below.
lib_prefix = "-l"
diff --git a/tools/gn/secondary/build/toolchain/mac/setup_toolchain.py b/tools/gn/secondary/build/toolchain/mac/setup_toolchain.py
new file mode 100644
index 0000000..431078f
--- /dev/null
+++ b/tools/gn/secondary/build/toolchain/mac/setup_toolchain.py
@@ -0,0 +1,29 @@
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import stat
+import sys
+
+def CopyTool(source_path):
+ """Copies the given tool to the current directory, including a warning not
+ to edit it."""
+ with open(source_path) as source_file:
+ tool_source = source_file.readlines()
+
+ # Add header and write it out to the current directory (which should be the
+ # root build dir).
+ out_path = 'gyp-mac-tool'
+ with open(out_path, 'w') as tool_file:
+ tool_file.write(''.join([tool_source[0],
+ '# Generated by setup_toolchain.py do not edit.\n']
+ + tool_source[1:]))
+ st = os.stat(out_path)
+ os.chmod(out_path, st.st_mode | stat.S_IEXEC)
+
+# Find the tool source, it's the first argument, and copy it.
+if len(sys.argv) != 2:
+ print "Need one argument (mac_tool source path)."
+ sys.exit(1)
+CopyTool(sys.argv[1])