1# Copyright (c) 2020-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# http://www.apache.org/licenses/LICENSE-2.0 6# Unless required by applicable law or agreed to in writing, software 7# distributed under the License is distributed on an "AS IS" BASIS, 8# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9# See the License for the specific language governing permissions and 10# limitations under the License. 11if (defined(ohos_lite)) { 12 import("//build/lite/config/component/lite_component.gni") 13} else { 14 import("//build/ohos.gni") 15} 16config("harfbuzz_config") { 17 include_dirs = [ "${target_gen_dir}/harfbuzz-11.0.0/src" ] 18} 19 20action("harfbuzz_action") { 21 script = "//third_party/harfbuzz/install.py" 22 outputs = [ 23 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-aat-layout.cc", 24 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-aat-map.cc", 25 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-blob.cc", 26 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-buffer-serialize.cc", 27 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-buffer.cc", 28 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-common.cc", 29 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-face.cc", 30 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-fallback-shape.cc", 31 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-font.cc", 32 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-map.cc", 33 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-number.cc", 34 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-cff1-table.cc", 35 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-cff2-table.cc", 36 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-face.cc", 37 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-font.cc", 38 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-layout.cc", 39 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-map.cc", 40 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-math.cc", 41 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-meta.cc", 42 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-metrics.cc", 43 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-name.cc", 44 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-shaper-arabic.cc", 45 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-shaper-default.cc", 46 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-shaper-hangul.cc", 47 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-shaper-hebrew.cc", 48 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-shaper-indic-table.cc", 49 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-shaper-indic.cc", 50 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-shaper-khmer.cc", 51 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-shaper-myanmar.cc", 52 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-shaper-syllabic.cc", 53 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-shaper-thai.cc", 54 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-shaper-use.cc", 55 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-shaper-vowel-constraints.cc", 56 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-shape-fallback.cc", 57 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-shape-normalize.cc", 58 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-shape.cc", 59 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-tag.cc", 60 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ot-var.cc", 61 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-set.cc", 62 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-shape-plan.cc", 63 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-shape.cc", 64 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-shaper.cc", 65 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-static.cc", 66 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-subset-cff2.cc", 67 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-subset-cff-common.cc", 68 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-ucd.cc", 69 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-unicode.cc", 70 "${target_gen_dir}/harfbuzz-11.0.0/src/hb-face-builder.cc", 71 ] 72 73 inputs = [ "//third_party/harfbuzz/harfbuzz-11.0.0.tar.xz" ] 74 harfbuzz_path = rebase_path("${target_gen_dir}", root_build_dir) 75 harfbuzz_source_path = rebase_path("//third_party/harfbuzz", root_build_dir) 76 args = [ 77 "--gen-dir", 78 "$harfbuzz_path", 79 "--source-dir", 80 "$harfbuzz_source_path", 81 ] 82} 83 84if (defined(ohos_lite)) { 85 lite_library("harfbuzz") { 86 output_name = "harfbuzz" 87 sources = get_target_outputs(":harfbuzz_action") 88 deps = [ ":harfbuzz_action" ] 89 public_configs = [ ":harfbuzz_config" ] 90 if (defined(board_toolchain_type) && board_toolchain_type == "iccarm") { 91 target_type = "static_library" 92 defines = [ 93 "HB_TINY", 94 "ENABLE_ICCARM=1", 95 "HB_CUSTOM_MALLOC", 96 ] 97 cflags = [ 98 "--diag_suppress", 99 "Pe068,Pa093,Pe111,Pa181,Pe128,Pe161,Pe177,Pe185,Pe186,Pe550,Pe554", 100 ] 101 cflags_cc = cflags 102 } else if (defined(board_toolchain_type) && 103 board_toolchain_type == "clang") { 104 target_type = "static_library" 105 defines = [ 106 "HB_TINY", 107 "HB_CUSTOM_MALLOC", 108 "HB_NO_PRAGMA_GCC_DIAGNOSTIC_WARNING", 109 "HB_NO_PRAGMA_GCC_DIAGNOSTIC_ERROR", 110 ] 111 cflags = [ 112 "-Wall", 113 "-Wno-error=unused-variable", 114 "-Wno-unused-variable", 115 "-Wno-error=extra-semi-stmt", 116 "-Wno-extra-semi-stmt", 117 ] 118 cflags_cc = cflags 119 } else { 120 target_type = "shared_library" 121 defines = [ "HAVE_PTHREAD = 1" ] 122 } 123 } 124} else { 125 ohos_static_library("harfbuzz_static") { 126 sources = get_target_outputs(":harfbuzz_action") 127 deps = [ ":harfbuzz_action" ] 128 include_dirs = [ "${target_gen_dir}/harfbuzz-11.0.0/src" ] 129 defines = [ "HAVE_PTHREAD = 1" ] 130 public_configs = [ ":harfbuzz_config" ] 131 part_name = "harfbuzz" 132 subsystem_name = "thirdparty" 133 } 134} 135