Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(950)

Unified Diff: build/config/compiler/BUILD.gn

Issue 81153003: GN: Add support for 32- and 64-bit cross-compiles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/config/BUILDCONFIG.gn ('k') | build/toolchain/linux/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/compiler/BUILD.gn
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 6f69e05d38994cdc144c2a61de2f6686609ec2c6..2ded34ed00ec0fb571e7c3005d624b7acc180473 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -39,14 +39,12 @@ config("compiler") {
cflags += [ "-fstack-protector", "--param=ssp-buffer-size=4" ]
}
- # Mac-specific compiler flags setup.
- # ----------------------------------
if (is_mac) {
+ # Mac-specific compiler flags setup.
+ # ----------------------------------
+
# These flags are shared between the C compiler and linker.
common_mac_flags = [
- # TODO(brettw) obviously this arch flag needs to be parameterized.
- "-arch i386",
-
# Set which SDK to use.
# TODO(brettw) this needs to be configurable somehow.
"-isysroot", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk",
@@ -54,6 +52,13 @@ config("compiler") {
"-mmacosx-version-min=10.6",
]
+ # CPU architecture.
+ if (cpu_arch == "x64") {
+ common_mac_flags += "-arch x86_64"
+ } else if (cpu_arch == "x32") {
+ common_mac_flags += "-arch i386"
+ }
+
cflags += common_mac_flags + [
# Without this, the constructors and destructors of a C++ object inside
# an Objective C struct won't be called, which is very bad.
@@ -70,6 +75,19 @@ config("compiler") {
"-Wl,-rpath,@loader_path/.",
"-Wl,-rpath,@loader_path/../../..",
]
+ } else {
+ # Non-Mac Posix compiler flags setup.
+ # -----------------------------------
+
+ # CPU architecture. We may or may not be doing a cross compile now, so for
+ # simplicity we always explicitly set the architecture.
+ if (cpu_arch == "x64") {
+ cflags += "-m64"
+ ldflags += "-m64"
+ } else if (cpu_arch == "x32") {
+ cflags += "-m32"
+ ldflags += "-m32"
+ }
}
# Linux-specific compiler flags setup.
« no previous file with comments | « build/config/BUILDCONFIG.gn ('k') | build/toolchain/linux/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698