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-Original-Commit-Position: refs/heads/master@{#340893} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 56f81e32556d513af513eac0710f2e85877ffa3b
This commit is contained in:
Родитель
f9f614482e
Коммит
b6d9f8cb3f
|
@ -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"
|
||||
}
|
||||
|
||||
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.
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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",
|
||||
]
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче