mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
build: override host_toolchain on windows to use sccache with v8
This commit is contained in:
parent
3deaf99a92
commit
30b268dd7d
2 changed files with 19 additions and 14 deletions
|
@ -2,14 +2,18 @@
|
||||||
|
|
||||||
import("//build/toolchain/cc_wrapper.gni")
|
import("//build/toolchain/cc_wrapper.gni")
|
||||||
|
|
||||||
# Verify that cc_wrapper is correctly set up on Windows.
|
# Verify that the cc_wrapper/toolchain combo correctly set up on Windows.
|
||||||
if (is_win && cc_wrapper != "" && custom_toolchain == "") {
|
if (is_win && cc_wrapper != "") {
|
||||||
suggested_toolchain = "//build_extra/toolchain/win:win_clang_$target_cpu"
|
cc_wrapper_toolchain = "//build_extra/toolchain/win:win_clang_$target_cpu"
|
||||||
|
toolchain_supports_cc_wrapper = cc_wrapper_toolchain == default_toolchain &&
|
||||||
|
cc_wrapper_toolchain == host_toolchain
|
||||||
|
|
||||||
# Use print instead of assert with message for readability.
|
if (!toolchain_supports_cc_wrapper) {
|
||||||
print(
|
# Using print instead of assert-with-message for readability of the output.
|
||||||
"The 'cc_wrapper' option isn't supported by the default Windows toolchain.")
|
print("The 'cc_wrapper' option isn't supported by the default Windows" +
|
||||||
print("To make it work, add the option:")
|
" toolchain. To make it work, add these gn arguments:")
|
||||||
print(" custom_toolchain=\"$suggested_toolchain\"")
|
print(" custom_toolchain=\"$cc_wrapper_toolchain\"")
|
||||||
assert(custom_toolchain != "")
|
print(" host_toolchain=\"$cc_wrapper_toolchain\"")
|
||||||
|
assert(toolchain_supports_cc_wrapper)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,12 +59,13 @@ def get_gn_args():
|
||||||
# Check if ccache or sccache are in the path, and if so we set cc_wrapper.
|
# Check if ccache or sccache are in the path, and if so we set cc_wrapper.
|
||||||
cc_wrapper = find_executable("ccache") or find_executable("sccache")
|
cc_wrapper = find_executable("ccache") or find_executable("sccache")
|
||||||
if cc_wrapper:
|
if cc_wrapper:
|
||||||
out += [r'cc_wrapper="%s"' % cc_wrapper]
|
out += ['cc_wrapper="%s"' % cc_wrapper]
|
||||||
# Windows needs a custom toolchain for cc_wrapper to work.
|
# For cc_wrapper to work on Windows, we need to select our own toolchain
|
||||||
|
# by overriding 'custom_toolchain' and 'host_toolchain'.
|
||||||
|
# TODO: Is there a way to use it without the involvement of args.gn?
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
out += [
|
tc = "//build_extra/toolchain/win:win_clang_x64"
|
||||||
'custom_toolchain="//build_extra/toolchain/win:win_clang_x64"'
|
out += ['custom_toolchain="%s"' % tc, 'host_toolchain="%s"' % tc]
|
||||||
]
|
|
||||||
|
|
||||||
print "DENO_BUILD_ARGS:", out
|
print "DENO_BUILD_ARGS:", out
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue