1# Copyright (c) 2021 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("$build_root/toolchain/gcc_toolchain.gni") 15 16declare_args() { 17 # Whether unstripped binaries, i.e. compiled with debug symbols, should be 18 # considered runtime_deps rather than stripped ones. 19 mingw_unstripped_runtime_outputs = true 20} 21 22template("mingw_toolchain") { 23 gcc_toolchain(target_name) { 24 assert(defined(invoker.toolchain_root), 25 "toolchain_root must be defined for mingw_toolchain.") 26 assert(defined(invoker.toolchain_args), 27 "toolchain_args must be defined for mingw_toolchain.") 28 toolchain_args = invoker.toolchain_args 29 30 _mingw_tool_prefix = 31 rebase_path("${invoker.toolchain_root}/bin", root_build_dir) 32 33 cc = "${_mingw_tool_prefix}/clang" 34 cxx = "${_mingw_tool_prefix}/clang++" 35 ar = "${_mingw_tool_prefix}/llvm-ar" 36 ld = cxx 37 strip = "${_mingw_tool_prefix}/llvm-strip" 38 use_unstripped_as_runtime_outputs = mingw_unstripped_runtime_outputs 39 40 executable_extension = ".exe" 41 shlib_extension = ".dll" 42 } 43} 44 45mingw_toolchain("mingw_x86_64") { 46 toolchain_root = "//prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw" 47 toolchain_args = { 48 current_cpu = "x86_64" 49 current_os = "mingw" 50 51 # use_custom_libcxx = false 52 is_clang = true 53 } 54} 55