# Copyright (c) 2020 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/lite/toolchain/clang.gni")
import("//build/lite/toolchain/gcc.gni")
import("//build/lite/toolchain/iccarm.gni")

# Set toolchain configured by board.
if (board_toolchain != "" && use_board_toolchain) {
  if (board_toolchain_type == "gcc") {
    gcc_toolchain(board_toolchain) {
      cc = ohos_current_cc_command
      cxx = ohos_current_cxx_command
      ar = ohos_current_ar_command
      ld = ohos_current_ld_command
      strip = ohos_current_strip_command
    }
  } else if (board_toolchain_type == "clang") {
    clang_toolchain(board_toolchain) {
      cc = ohos_current_cc_command
      cxx = ohos_current_cxx_command
      ar = ohos_current_ar_command
      ld = ohos_current_ld_command
      strip = ohos_current_strip_command
    }
  } else if (board_toolchain_type == "iccarm") {
    iccarm_toolchain(board_toolchain) {
      cc = ohos_current_cc_command
      cxx = ohos_current_cxx_command
      as = ohos_current_as_command
      ar = ohos_current_ar_command
      ld = ohos_current_ld_command
      strip = ohos_current_strip_command
    }
  }
} else {
  clang_toolchain("linux_x86_64_ohos_clang") {
    cc = ohos_current_cc_command
    cxx = ohos_current_cxx_command
    ar = ohos_current_ar_command
    ld = ohos_current_ld_command
    strip = ohos_current_strip_command
  }
}