BUILD.gn 5.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# Copyright 2017 Google Inc.
#
# 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.

config("txt_config") {
16 17
  visibility = [ ":*" ]
  include_dirs = [ "src" ]
18 19 20 21 22 23 24 25 26 27 28
}

source_set("txt") {
  if (current_toolchain == host_toolchain && !is_mac) {
    defines = [ "DIRECTORY_FONT_MANAGER_AVAILABLE" ]
  }
  if (is_android) {
    defines = [ "ANDROID_FONT_MANAGER_AVAILABLE" ]
  }

  sources = [
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
    "src/log/log.cc",
    "src/log/log.h",
    "src/minikin/CmapCoverage.cpp",
    "src/minikin/CmapCoverage.h",
    "src/minikin/Emoji.cpp",
    "src/minikin/Emoji.h",
    "src/minikin/FontCollection.cpp",
    "src/minikin/FontCollection.h",
    "src/minikin/FontFamily.cpp",
    "src/minikin/FontFamily.h",
    "src/minikin/FontLanguage.cpp",
    "src/minikin/FontLanguage.h",
    "src/minikin/FontLanguageListCache.cpp",
    "src/minikin/FontLanguageListCache.h",
    "src/minikin/FontUtils.cpp",
    "src/minikin/FontUtils.h",
    "src/minikin/GraphemeBreak.cpp",
    "src/minikin/GraphemeBreak.h",
    "src/minikin/HbFontCache.cpp",
    "src/minikin/HbFontCache.h",
    "src/minikin/Hyphenator.cpp",
    "src/minikin/Hyphenator.h",
    "src/minikin/Layout.cpp",
    "src/minikin/Layout.h",
    "src/minikin/LayoutUtils.cpp",
    "src/minikin/LayoutUtils.h",
    "src/minikin/LineBreaker.cpp",
    "src/minikin/LineBreaker.h",
    "src/minikin/Measurement.cpp",
    "src/minikin/Measurement.h",
    "src/minikin/MinikinFont.cpp",
    "src/minikin/MinikinFont.h",
    "src/minikin/MinikinInternal.cpp",
    "src/minikin/MinikinInternal.h",
    "src/minikin/SparseBitSet.cpp",
    "src/minikin/SparseBitSet.h",
    "src/minikin/WordBreaker.cpp",
    "src/minikin/WordBreaker.h",
67 68
    "src/txt/asset_font_manager.cc",
    "src/txt/asset_font_manager.h",
69
    "src/txt/font_asset_provider.cc",
70
    "src/txt/font_asset_provider.h",
71 72 73 74 75 76 77 78 79 80 81 82 83 84
    "src/txt/font_collection.cc",
    "src/txt/font_collection.h",
    "src/txt/font_skia.cc",
    "src/txt/font_skia.h",
    "src/txt/font_style.h",
    "src/txt/font_weight.h",
    "src/txt/paint_record.cc",
    "src/txt/paint_record.h",
    "src/txt/paragraph.cc",
    "src/txt/paragraph.h",
    "src/txt/paragraph_builder.cc",
    "src/txt/paragraph_builder.h",
    "src/txt/paragraph_style.cc",
    "src/txt/paragraph_style.h",
85
    "src/txt/platform.h",
86 87
    "src/txt/styled_runs.cc",
    "src/txt/styled_runs.h",
88 89
    "src/txt/test_font_manager.cc",
    "src/txt/test_font_manager.h",
90 91 92
    "src/txt/text_baseline.h",
    "src/txt/text_decoration.cc",
    "src/txt/text_decoration.h",
G
Gary Qian 已提交
93 94
    "src/txt/text_shadow.cc",
    "src/txt/text_shadow.h",
95 96
    "src/txt/text_style.cc",
    "src/txt/text_style.h",
97 98
    "src/txt/typeface_font_asset_provider.cc",
    "src/txt/typeface_font_asset_provider.h",
99 100 101 102
    "src/utils/JenkinsHash.cpp",
    "src/utils/JenkinsHash.h",
    "src/utils/LruCache.h",
    "src/utils/TypeHelpers.h",
103
    "src/utils/WindowsUtils.h",
104 105 106 107
  ]

  public_configs = [ ":txt_config" ]

108
  public_deps = [
109
    "$flutter_root/fml",
110 111
    "//third_party/harfbuzz",
    "//third_party/icu",
112 113
    "//third_party/skia",
  ]
114 115

  deps = [
M
Mehmet Fidanboylu 已提交
116
    "//third_party/skia",
117
  ]
118 119 120 121 122 123 124 125 126 127 128

  if (is_mac || is_ios) {
    set_sources_assignment_filter([])
    sources += [ "src/txt/platform_mac.mm" ]
    set_sources_assignment_filter(sources_assignment_filter)
    deps += [ "$flutter_root/fml" ]
  } else if (is_android) {
    sources += [ "src/txt/platform_android.cc" ]
  } else {
    sources += [ "src/txt/platform.cc" ]
  }
129 130 131
}

txt_common_executable_deps = [
132
  "//third_party/dart/runtime:libdart_jit",  # For logging.
133
  "$flutter_root/fml",  # For ICU initialization.
134 135
]

136 137 138 139 140 141 142 143
source_set("txt_test_utils") {
  sources = [
    "tests/txt_test_utils.cc",
    "tests/txt_test_utils.h",
  ]

  deps = [
    ":txt",
144
    "$flutter_root/fml",
145 146 147 148
    "//third_party/skia",
  ]
}

149 150 151 152
executable("txt_unittests") {
  testonly = true

  sources = [
153 154 155 156 157 158 159 160 161 162 163 164 165
    "tests/CmapCoverageTest.cpp",
    "tests/EmojiTest.cpp",
    "tests/FileUtils.cpp",
    "tests/FileUtils.h",
    "tests/FontTestUtils.h",
    "tests/GraphemeBreakTests.cpp",
    "tests/ICUTestBase.h",
    "tests/LayoutUtilsTest.cpp",
    "tests/MeasurementTests.cpp",
    "tests/SparseBitSetTest.cpp",
    "tests/UnicodeUtils.cpp",
    "tests/UnicodeUtils.h",
    "tests/UnicodeUtilsTest.cpp",
166 167 168 169 170
    "tests/font_collection_unittests.cc",
    "tests/paragraph_unittests.cc",
    "tests/render_test.cc",
    "tests/render_test.h",
    "tests/txt_run_all_unittests.cc",
171 172 173 174 175 176 177 178 179 180

    # These tests require static fixtures.
    # "tests/FontCollectionItemizeTest.cpp",
    # "tests/FontCollectionTest.cpp",
    # "tests/FontFamilyTest.cpp",
    # "tests/FontLanguageListCacheTest.cpp",
    # "tests/FontTestUtils.cpp",
    # "tests/HbFontCacheTest.cpp",
    # "tests/HyphenatorTest.cpp",
    # "tests/LayoutTest.cpp",
181 182
  ]

183 184 185 186 187 188 189
  if (!is_win) {
    sources += [
      "tests/MinikinFontForTest.cpp",
      "tests/MinikinFontForTest.h",
    ]
  }

190 191
  deps = [
           ":txt",
192
           ":txt_test_utils",
193
           "//third_party/googletest:gtest",
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
         ] + txt_common_executable_deps
}

executable("txt_benchmarks") {
  testonly = true

  sources = [
    "benchmarks/paint_record_benchmarks.cc",
    "benchmarks/paragraph_benchmarks.cc",
    "benchmarks/paragraph_builder_benchmarks.cc",
    "benchmarks/styled_runs_benchmarks.cc",
    "benchmarks/txt_run_all_benchmarks.cc",
  ]

  deps = [
           ":txt",
210
           ":txt_test_utils",
211 212
           "//third_party/benchmark",
         ] + txt_common_executable_deps
213
}