提交 d6e91a2e 编写于 作者: O openharmony_ci 提交者: Gitee

!167 #I3YIUO:增加ccache支持

Merge pull request !167 from yangming_ha/master
......@@ -50,13 +50,20 @@ if (host_os == "win") {
toolchain_cmd_suffix = ".exe"
}
# enable ccache if ccache installed.
if (ohos_build_enable_ccache) {
compile_prefix = "ccache "
} else {
compile_prefix = ""
}
# Set current toolchain with to board configuration.
if (board_toolchain != "" && use_board_toolchain) {
ohos_build_compiler = board_toolchain_type
if (board_toolchain_path != "") {
compile_prefix = "${board_toolchain_path}/${board_toolchain_prefix}"
compile_prefix += "${board_toolchain_path}/${board_toolchain_prefix}"
} else {
compile_prefix = "${board_toolchain_prefix}"
compile_prefix += "${board_toolchain_prefix}"
}
set_default_toolchain("//build/lite/toolchain:${board_toolchain}")
if (board_toolchain_type == "gcc") {
......@@ -82,7 +89,7 @@ if (board_toolchain != "" && use_board_toolchain) {
# OHOS default toolchain
ohos_build_compiler = "clang"
ohos_clang_toolchain_dir = rebase_path("${ohos_build_compiler_dir}/bin")
compile_prefix = rebase_path("${ohos_build_compiler_dir}/bin")
compile_prefix += rebase_path("${ohos_build_compiler_dir}/bin")
ohos_current_cc_command = "${compile_prefix}/clang$toolchain_cmd_suffix"
ohos_current_cxx_command = "${compile_prefix}/clang++$toolchain_cmd_suffix"
ohos_current_ar_command = "${compile_prefix}/llvm-ar$toolchain_cmd_suffix"
......
......@@ -32,7 +32,7 @@ from hb.common.device import Device
from hb.common.product import Product
from hb.build.fs_process import Packer
from hb.build.patch_process import Patch
from distutils.spawn import find_executable
class Build():
def __init__(self, component=None):
......@@ -117,6 +117,11 @@ class Build():
def build(self, full_compile, patch=False, ninja=True, cmd_args=None):
cmd_list = self.get_cmd(full_compile, patch, ninja)
# enable ccache if it installed.
ccache_path = find_executable('ccache')
if ccache_path is not None:
build.register_args('ohos_build_enable_ccache', 'true', quota=False)
if cmd_args is None:
cmd_args = defaultdict(list)
for exec_cmd in cmd_list:
......
......@@ -39,6 +39,9 @@ declare_args() {
ohos_kernel_type = ""
use_board_toolchain = true
# hb set it to true if ccache installed.
ohos_build_enable_ccache = false
# Current toolchain cc command. E.g. "/data/user1/riscv32/bin/riscv32-unknown-elf-gcc".
ohos_current_cc_command = ""
ohos_current_cxx_command = ""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册