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/toolchain/gcc_toolchain.gni") 15declare_args() { 16 # Whether unstripped binaries, i.e. compiled with debug symbols, should be 17 # considered runtime_deps rather than stripped ones. 18 mingw_unstripped_runtime_outputs = true 19} 20 21template("mingw_toolchain") { 22 gcc_toolchain(target_name) { 23 assert(defined(invoker.toolchain_root), 24 "toolchain_root must be defined for mingw_toolchain.") 25 assert(defined(invoker.toolchain_args), 26 "toolchain_args must be defined for mingw_toolchain.") 27 toolchain_args = invoker.toolchain_args 28 29 # Output linker map files for binary size analysis. 30 enable_linker_map = true 31 32 _mingw_tool_prefix = 33 rebase_path("${invoker.toolchain_root}/bin", root_build_dir) 34 35 cc = "${_mingw_tool_prefix}/clang" 36 cxx = "${_mingw_tool_prefix}/clang++" 37 ar = "${_mingw_tool_prefix}/llvm-ar" 38 ld = cxx 39 readelf = "${_mingw_tool_prefix}/llvm-readelf" 40 nm = "${_mingw_tool_prefix}/llvm-nm" 41 strip = "${_mingw_tool_prefix}/llvm-strip" 42 use_unstripped_as_runtime_outputs = mingw_unstripped_runtime_outputs 43 44 executable_extension = ".exe" 45 shlib_extension = ".dll" 46 } 47} 48 49mingw_toolchain("mingw_x86_64") { 50 toolchain_root = "//prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw" 51 toolchain_args = { 52 current_cpu = "x86_64" 53 current_os = "mingw" 54 use_custom_libcxx = false 55 is_clang = true 56 } 57} 58