summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfredlebel <fredlebel@macadamian.com>2015-07-29 08:50:00 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-29 15:50:36 +0000
commit56f81e32556d513af513eac0710f2e85877ffa3b (patch)
tree8dd0344210c1aae395439f8b625af941018e824b
parent064ce26eb8845dc728260e8f9bcf8bb822d6b5b1 (diff)
downloadchromium_src-56f81e32556d513af513eac0710f2e85877ffa3b.zip
chromium_src-56f81e32556d513af513eac0710f2e85877ffa3b.tar.gz
chromium_src-56f81e32556d513af513eac0710f2e85877ffa3b.tar.bz2
Laying the groundwork for targeting WinRT for WebRTC.
Now supporting various flavors of WinRT in the target_os argument. Setting compiler and linker flags so cc files are compiled to support C++/CX syntax. This is part of a larger effort to port WebRTC to WinRT. Review URL: https://codereview.chromium.org/1150183009 Cr-Commit-Position: refs/heads/master@{#340893}
-rw-r--r--AUTHORS1
-rw-r--r--build/config/BUILDCONFIG.gn16
-rw-r--r--build/config/compiler/BUILD.gn11
-rw-r--r--build/config/win/BUILD.gn15
-rw-r--r--build/toolchain/win/BUILD.gn23
-rw-r--r--build/toolchain/win/setup_toolchain.py9
6 files changed, 71 insertions, 4 deletions
diff --git a/AUTHORS b/AUTHORS
index 4961e012..dbf638b 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -637,3 +637,4 @@ Torchmobile Inc.
Venture 3 Systems LLC <*@venture3systems.com>
Yandex LLC <*@yandex-team.ru>
ARM Holdings <*@arm.com>
+Macadamian <*@macadamian.com>
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index 4b82783..b88619d 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -173,7 +173,8 @@ declare_args() {
# aix or one of the BSDs. If you need to check these, just check the
# current_os value directly.
-if (current_os == "win") {
+if (current_os == "win" || current_os == "winrt_81" ||
+ current_os == "winrt_81_phone" || current_os == "winrt_10") {
is_android = false
is_chromeos = false
is_ios = false
@@ -393,6 +394,10 @@ if (is_win) {
"//build/config/win:winver",
]
}
+if (current_os == "winrt_81" || current_os == "winrt_81_phone" ||
+ current_os == "winrt_10") {
+ _native_compiler_configs += [ "//build/config/win:target_winrt" ]
+}
if (is_posix) {
_native_compiler_configs += [
"//build/config/gcc:no_exceptions",
@@ -548,7 +553,14 @@ if (is_win) {
} else {
host_toolchain = "//build/toolchain/win:$current_cpu"
}
- set_default_toolchain("$host_toolchain")
+
+ if (current_os == "win") {
+ set_default_toolchain("$host_toolchain")
+ } else if (current_cpu == "x64") { # WinRT x64
+ set_default_toolchain("//build/toolchain/win:winrt_x64")
+ } else if (current_cpu == "x86") { # WinRT x86
+ set_default_toolchain("//build/toolchain/win:winrt_x86")
+ }
} else if (is_android) {
if (host_os == "linux") {
# Use clang for the x86/64 Linux host builds.
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 7b88e64..9120e66e 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -622,8 +622,15 @@ config("runtime_library") {
}
}
} else {
- # Static CRT.
- if (is_win) {
+ if (is_win && current_os != "win") {
+ # WindowsRT: use the dynamic CRT.
+ if (is_debug) {
+ cflags += [ "/MDd" ]
+ } else {
+ cflags += [ "/MD" ]
+ }
+ } else if (is_win) {
+ # Desktop Windows: static CRT.
if (is_debug) {
cflags += [ "/MTd" ]
} else {
diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn
index 7d8688ba..b558695 100644
--- a/build/config/win/BUILD.gn
+++ b/build/config/win/BUILD.gn
@@ -180,3 +180,18 @@ config("lean_and_mean") {
config("nominmax") {
defines = [ "NOMINMAX" ]
}
+
+# Target WinRT ----------------------------------------------------------------
+
+# When targeting Windows Runtime, certain compiler/linker flags are necessary.
+
+config("target_winrt") {
+ defines = [
+ "WINRT",
+ "WINAPI_FAMILY=WINAPI_FAMILY_PC_APP",
+ ]
+ cflags_cc = [
+ "/ZW",
+ "/EHsc",
+ ]
+}
diff --git a/build/toolchain/win/BUILD.gn b/build/toolchain/win/BUILD.gn
index 1ac3623..34198e8 100644
--- a/build/toolchain/win/BUILD.gn
+++ b/build/toolchain/win/BUILD.gn
@@ -50,6 +50,7 @@ concurrent_links = exec_script("../get_concurrent_links.py", [], "value")
# Parameters:
# current_cpu: current_cpu to pass as a build arg
+# current_os: current_os to pass as a build arg
# environment: File name of environment file.
template("msvc_toolchain") {
if (defined(invoker.concurrent_links)) {
@@ -206,6 +207,7 @@ template("msvc_toolchain") {
if (defined(invoker.is_clang)) {
is_clang = invoker.is_clang
}
+ current_os = invoker.current_os
}
}
}
@@ -227,6 +229,7 @@ if (current_cpu == "x86") {
prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin",
root_build_dir)
cl = "${goma_prefix}$prefix/clang-cl.exe"
+ current_os = "win"
is_clang = true
}
}
@@ -244,6 +247,26 @@ if (current_cpu == "x64") {
prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin",
root_build_dir)
cl = "${goma_prefix}$prefix/clang-cl.exe"
+ current_os = "win"
is_clang = true
}
}
+
+# WinRT toolchains
+msvc_toolchain("winrt_x86") {
+ environment = "environment.winrt_x86"
+ cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\""
+ is_clang = false
+
+ current_cpu = "x86"
+ current_os = current_os
+}
+
+msvc_toolchain("winrt_x64") {
+ environment = "environment.winrt_x64"
+ cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\""
+ is_clang = false
+
+ current_cpu = "x64"
+ current_os = current_os
+}
diff --git a/build/toolchain/win/setup_toolchain.py b/build/toolchain/win/setup_toolchain.py
index bc9bd1e..f395044 100644
--- a/build/toolchain/win/setup_toolchain.py
+++ b/build/toolchain/win/setup_toolchain.py
@@ -146,6 +146,15 @@ def main():
with open('environment.' + cpu, 'wb') as f:
f.write(env_block)
+ # Create a store app version of the environment.
+ if 'LIB' in env:
+ env['LIB'] = env['LIB'] .replace(r'\VC\LIB', r'\VC\LIB\STORE')
+ if 'LIBPATH' in env:
+ env['LIBPATH'] = env['LIBPATH'].replace(r'\VC\LIB', r'\VC\LIB\STORE')
+ env_block = _FormatAsEnvironmentBlock(env)
+ with open('environment.winrt_' + cpu, 'wb') as f:
+ f.write(env_block)
+
assert vc_bin_dir
print 'vc_bin_dir = "%s"' % vc_bin_dir