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

105 106 107 108
  if (is_mac || is_ios) {
    set_sources_assignment_filter([])
    sources += [ "src/txt/platform_mac.mm" ]
    set_sources_assignment_filter(sources_assignment_filter)
109 110
  } else if (is_android) {
    sources += [ "src/txt/platform_android.cc" ]
111 112 113 114
  } else {
    sources += [ "src/txt/platform.cc" ]
  }

115 116
  public_configs = [ ":txt_config" ]

117
  public_deps = [
118
    "//garnet/public/lib/fxl",
119 120
    "//third_party/harfbuzz",
    "//third_party/icu",
121 122
    "//third_party/skia",
  ]
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137

  deps = [
    "//third_party/skia:effects",
  ]
}

txt_common_executable_deps = [
  "//dart/runtime:libdart_jit",  # For logging.
  "//flutter/fml",  # For ICU initialization.
]

executable("txt_unittests") {
  testonly = true

  sources = [
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
    "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/MinikinFontForTest.cpp",
    "tests/MinikinFontForTest.h",
    "tests/SparseBitSetTest.cpp",
    "tests/UnicodeUtils.cpp",
    "tests/UnicodeUtils.h",
    "tests/UnicodeUtilsTest.cpp",
153 154 155 156 157 158 159
    "tests/font_collection_unittests.cc",
    "tests/paragraph_unittests.cc",
    "tests/render_test.cc",
    "tests/render_test.h",
    "tests/txt_run_all_unittests.cc",
    "tests/utils.cc",
    "tests/utils.h",
160 161 162 163 164 165 166 167 168 169

    # 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",
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
  ]

  deps = [
           ":txt",
           "//third_party/gtest",
         ] + 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",
    "benchmarks/utils.cc",
    "benchmarks/utils.h",
  ]

  deps = [
           ":txt",
           "//third_party/benchmark",
         ] + txt_common_executable_deps
195
}