BUILD.gn 5.7 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.h",
70 71 72 73 74 75 76 77 78 79 80 81 82 83
    "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",
84
    "src/txt/platform.h",
85 86
    "src/txt/styled_runs.cc",
    "src/txt/styled_runs.h",
87 88
    "src/txt/test_font_manager.cc",
    "src/txt/test_font_manager.h",
89 90 91 92 93
    "src/txt/text_baseline.h",
    "src/txt/text_decoration.cc",
    "src/txt/text_decoration.h",
    "src/txt/text_style.cc",
    "src/txt/text_style.h",
94 95
    "src/txt/typeface_font_asset_provider.cc",
    "src/txt/typeface_font_asset_provider.h",
96 97 98 99
    "src/utils/JenkinsHash.cpp",
    "src/utils/JenkinsHash.h",
    "src/utils/LruCache.h",
    "src/utils/TypeHelpers.h",
100
    "src/utils/WindowsUtils.h",
101 102 103 104
  ]

  public_configs = [ ":txt_config" ]

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

  deps = [
    "//third_party/skia:effects",
  ]
115 116 117 118 119 120 121 122 123 124 125

  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" ]
  }
126 127 128
}

txt_common_executable_deps = [
129
  "//third_party/dart/runtime:libdart_jit",  # For logging.
130
  "$flutter_root/fml",  # For ICU initialization.
131 132
]

133 134 135 136 137 138 139 140
source_set("txt_test_utils") {
  sources = [
    "tests/txt_test_utils.cc",
    "tests/txt_test_utils.h",
  ]

  deps = [
    ":txt",
141
    "$flutter_root/fml",
142 143 144 145
    "//third_party/skia",
  ]
}

146 147 148 149
executable("txt_unittests") {
  testonly = true

  sources = [
150 151 152 153 154 155 156 157 158 159 160 161 162
    "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",
163 164 165 166 167
    "tests/font_collection_unittests.cc",
    "tests/paragraph_unittests.cc",
    "tests/render_test.cc",
    "tests/render_test.h",
    "tests/txt_run_all_unittests.cc",
168 169 170 171 172 173 174 175 176 177

    # 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",
178 179
  ]

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

187 188
  deps = [
           ":txt",
189
           ":txt_test_utils",
190
           "//third_party/googletest:gtest",
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
         ] + 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",
207
           ":txt_test_utils",
208 209
           "//third_party/benchmark",
         ] + txt_common_executable_deps
210
}