Skip to content

Commit

Permalink
Add support for 32-bit and 64-bit Windows compiles in GN.
Browse files Browse the repository at this point in the history
Rename ia32 and ia64 to x86 and x64

BUG=297677, 322109
R=scottmg@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236851 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
brettw@chromium.org committed Nov 22, 2013
1 parent 06e924a commit 777ad7f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ if (is_win) {
# Always use 32-bit on Windows, even when compiling on a 64-bit host OS,
# unless the override flag is specified.
if (force_win64) {
cpu_arch = "ia64"
cpu_arch = "x64"
} else {
cpu_arch = "ia32"
cpu_arch = "x86"
}
}

Expand Down Expand Up @@ -383,9 +383,9 @@ set_defaults("source_set") {
# default toolchain.

if (is_win) {
if (cpu_arch == "ia64") {
if (cpu_arch == "x64") {
host_toolchain = "//build/toolchain/win:64"
} else if (cpu_arch == "ia32") {
} else if (cpu_arch == "x86") {
host_toolchain = "//build/toolchain/win:32"
}
set_default_toolchain(host_toolchain)
Expand Down
2 changes: 1 addition & 1 deletion build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ config("compiler") {

# Use gold for linking on 64-bit Linux only (on 32-bit it runs out of
# address space, and it doesn't support cross-compiling).
if (cpu_arch == "ia64") {
if (cpu_arch == "x64") {
gold_path = rebase_path("//third_party/gold", ".", root_build_dir)
ldflags += [
"-B$gold_path",
Expand Down
2 changes: 1 addition & 1 deletion build/config/win/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ config("sdk") {

# Linker flags for Windows SDK setup, this is applied only to EXEs and DLLs.
config("sdk_link") {
if (cpu_arch == "ia64") {
if (cpu_arch == "x64") {
ldflags = [ "/MACHINE:X64" ]
lib_dirs = [
"$windows_sdk_path\Lib\win8\um\x64",
Expand Down
2 changes: 1 addition & 1 deletion build/toolchain/win/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ toolchain("64") {
# 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 = "ia64"
cpu_arch = "x64"
# Normally the build config resets the CPU architecture to 32-bits. Setting
# this flag overrides that behavior.
force_win64 = true
Expand Down
16 changes: 8 additions & 8 deletions tools/gn/args.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,19 +179,19 @@ void Args::SetSystemVars(Scope* dest) const {
dest->SetValue(variables::kOs, os_val, NULL);

// Host architecture.
static const char kIa32[] = "ia32";
static const char kIa64[] = "ia64";
static const char kX86[] = "x86";
static const char kX64[] = "x64";
const char* arch = NULL;
#if defined(OS_WIN)
// ...on Windows, set the CPU architecture based on the underlying OS, not
// whatever the current bit-tedness of the GN binary is.
const base::win::OSInfo* os_info = base::win::OSInfo::GetInstance();
switch (os_info->architecture()) {
case base::win::OSInfo::X86_ARCHITECTURE:
arch = kIa32;
arch = kX86;
break;
case base::win::OSInfo::X64_ARCHITECTURE:
arch = kIa64;
arch = kX64;
break;
default:
CHECK(false) << "Windows architecture not handled.";
Expand All @@ -201,9 +201,9 @@ void Args::SetSystemVars(Scope* dest) const {
// ...on all other platforms, just use the bit-tedness of the current
// process.
#if defined(ARCH_CPU_X86_64)
arch = kIa64;
arch = kX64;
#elif defined(ARCH_CPU_X86)
arch = kIa32;
arch = kX86;
#elif defined(ARCH_CPU_ARMEL)
static const char kArm[] = "arm";
arch = kArm;
Expand All @@ -212,8 +212,8 @@ void Args::SetSystemVars(Scope* dest) const {
#endif
#endif
// Avoid unused var warning.
(void)kIa32;
(void)kIa64;
(void)kX86;
(void)kX64;

Value arch_val(NULL, std::string(arch));
dest->SetValue(variables::kBuildCpuArch, arch_val, NULL);
Expand Down
4 changes: 2 additions & 2 deletions tools/gn/variables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ const char kCpuArch_Help[] =
" set it to whatever value is relevant to your build.\n"
"\n"
"Possible initial values set by GN:\n"
" - \"ia32\"\n"
" - \"ia64\"\n"
" - \"x86\"\n"
" - \"x64\"\n"
" - \"arm\"\n";

const char kCurrentToolchain[] = "current_toolchain";
Expand Down

0 comments on commit 777ad7f

Please sign in to comment.