BUILD.gn 7.2 KB
Newer Older
M
Michael Goderbauer 已提交
1
# Copyright 2013 The Flutter Authors. All rights reserved.
2 3 4
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

5
if (is_fuchsia) {
6
  import("//build/fuchsia/sdk.gni")
7
  import("//flutter/tools/fuchsia/fuchsia_archive.gni")
8
}
9
import("//flutter/testing/testing.gni")
10

11
source_set("fml") {
12
  sources = [
13 14
    "base32.cc",
    "base32.h",
15
    "build_config.h",
16
    "closure.h",
17 18
    "command_line.cc",
    "command_line.h",
19
    "compiler_specific.h",
20 21
    "concurrent_message_loop.cc",
    "concurrent_message_loop.h",
22 23
    "delayed_task.cc",
    "delayed_task.h",
24
    "eintr_wrapper.h",
25
    "file.cc",
26
    "file.h",
27 28
    "gpu_thread_merger.cc",
    "gpu_thread_merger.h",
29 30
    "icu_util.cc",
    "icu_util.h",
31 32 33 34 35 36
    "log_level.h",
    "log_settings.cc",
    "log_settings.h",
    "log_settings_state.cc",
    "logging.cc",
    "logging.h",
37
    "make_copyable.h",
38
    "mapping.cc",
39
    "mapping.h",
40 41 42 43
    "memory/ref_counted.h",
    "memory/ref_counted_internal.h",
    "memory/ref_ptr.h",
    "memory/ref_ptr_internal.h",
44 45 46 47
    "memory/thread_checker.h",
    "memory/weak_ptr.h",
    "memory/weak_ptr_internal.cc",
    "memory/weak_ptr_internal.h",
48 49
    "message.cc",
    "message.h",
50 51 52 53
    "message_loop.cc",
    "message_loop.h",
    "message_loop_impl.cc",
    "message_loop_impl.h",
54 55
    "message_loop_task_queues.cc",
    "message_loop_task_queues.h",
56 57
    "native_library.h",
    "paths.cc",
58
    "paths.h",
59
    "posix_wrappers.h",
60
    "size.h",
61
    "synchronization/atomic_object.h",
62 63
    "synchronization/count_down_latch.cc",
    "synchronization/count_down_latch.h",
64 65
    "synchronization/semaphore.cc",
    "synchronization/semaphore.h",
66
    "synchronization/shared_mutex.h",
67 68
    "synchronization/sync_switch.cc",
    "synchronization/sync_switch.h",
69 70
    "synchronization/waitable_event.cc",
    "synchronization/waitable_event.h",
71 72 73 74
    "task_runner.cc",
    "task_runner.h",
    "thread.cc",
    "thread.h",
75
    "thread_local.cc",
76
    "thread_local.h",
77 78 79
    "time/time_delta.h",
    "time/time_point.cc",
    "time/time_point.h",
80 81
    "trace_event.cc",
    "trace_event.h",
82 83 84
    "unique_fd.cc",
    "unique_fd.h",
    "unique_object.h",
85
    "wakeable.h",
86 87
  ]

88 89
  public_deps = []

90
  deps = [
91
    "//third_party/dart/runtime:dart_api",
92 93 94 95 96 97 98

    # These need to be in sync with the Fuchsia buildroot.
    "//third_party/icu",
  ]

  configs += [ "//third_party/icu:icu_config" ]

99
  public_configs = [
100 101
    "//flutter:config",
    "//flutter/common:flutter_config",
102
  ]
103

104
  libs = []
105

106 107 108 109 110 111
  if (is_ios || is_mac) {
    sources += [ "platform/posix/shared_mutex_posix.cc" ]
  } else {
    sources += [ "synchronization/shared_mutex_std.cc" ]
  }

112
  if (is_ios || is_mac) {
113 114 115 116 117
    sources += [
      "platform/darwin/cf_utils.cc",
      "platform/darwin/cf_utils.h",
      "platform/darwin/message_loop_darwin.h",
      "platform/darwin/message_loop_darwin.mm",
118
      "platform/darwin/paths_darwin.mm",
119 120
      "platform/darwin/platform_version.h",
      "platform/darwin/platform_version.mm",
121 122 123 124
      "platform/darwin/scoped_block.h",
      "platform/darwin/scoped_block.mm",
      "platform/darwin/scoped_nsobject.h",
      "platform/darwin/scoped_nsobject.mm",
125 126
      "platform/darwin/string_range_sanitization.h",
      "platform/darwin/string_range_sanitization.mm",
127 128 129 130 131 132 133 134 135 136 137 138 139
    ]

    libs += [ "Foundation.framework" ]
  }

  if (is_android) {
    sources += [
      "platform/android/jni_util.cc",
      "platform/android/jni_util.h",
      "platform/android/jni_weak_ref.cc",
      "platform/android/jni_weak_ref.h",
      "platform/android/message_loop_android.cc",
      "platform/android/message_loop_android.h",
140
      "platform/android/paths_android.cc",
141
      "platform/android/paths_android.h",
142 143 144 145 146
      "platform/android/scoped_java_ref.cc",
      "platform/android/scoped_java_ref.h",
    ]

    libs += [ "android" ]
147
  }
148 149 150 151 152 153 154 155 156 157 158 159

  if (is_android) {
    sources += [
      "platform/linux/timerfd.cc",
      "platform/linux/timerfd.h",
    ]
  }

  if (is_linux) {
    sources += [
      "platform/linux/message_loop_linux.cc",
      "platform/linux/message_loop_linux.h",
160
      "platform/linux/paths_linux.cc",
161 162 163 164
      "platform/linux/timerfd.cc",
      "platform/linux/timerfd.h",
    ]
  }
165

166
  if (is_fuchsia) {
167 168 169 170 171
    sources += [
      "platform/fuchsia/message_loop_fuchsia.cc",
      "platform/fuchsia/message_loop_fuchsia.h",
      "platform/fuchsia/paths_fuchsia.cc",
    ]
172

173
    if (using_fuchsia_sdk) {
174 175 176 177 178
      public_deps += [
        "$fuchsia_sdk_root/pkg:async-cpp",
        "$fuchsia_sdk_root/pkg:async-loop-cpp",
        "$fuchsia_sdk_root/pkg:async-loop-default",
        "$fuchsia_sdk_root/pkg:trace",
179
        "$fuchsia_sdk_root/pkg:trace-engine",
180 181
        "$fuchsia_sdk_root/pkg:zx",
      ]
182
    } else {
183 184 185 186 187
      public_deps += [
        "//zircon/public/lib/async-cpp",
        "//zircon/public/lib/async-loop-cpp",
        "//zircon/public/lib/async-loop-default",
        "//zircon/public/lib/trace",
188
        "//zircon/public/lib/trace-engine",
189 190
        "//zircon/public/lib/zx",
      ]
191
    }
192 193
  }

194 195
  if (is_win) {
    sources += [
196 197
      "platform/win/errors_win.cc",
      "platform/win/errors_win.h",
198
      "platform/win/file_win.cc",
199
      "platform/win/mapping_win.cc",
200 201
      "platform/win/message_loop_win.cc",
      "platform/win/message_loop_win.h",
202
      "platform/win/native_library_win.cc",
203
      "platform/win/paths_win.cc",
204
      "platform/win/posix_wrappers_win.cc",
205
      "platform/win/wstring_conversion.h",
206
    ]
207 208 209 210 211

    if (is_win) {
      # For wstring_conversion. See issue #50053.
      defines = [ "_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING" ]
    }
212 213
  } else {
    sources += [
214
      "platform/posix/file_posix.cc",
215
      "platform/posix/mapping_posix.cc",
216
      "platform/posix/native_library_posix.cc",
217
      "platform/posix/paths_posix.cc",
218
      "platform/posix/posix_wrappers_posix.cc",
219
    ]
220
  }
221 222
}

223 224 225 226
test_fixtures("fml_fixtures") {
  fixtures = []
}

227 228 229 230
executable("fml_unittests") {
  testonly = true

  sources = [
231
    "base32_unittest.cc",
232
    "command_line_unittest.cc",
233
    "file_unittest.cc",
234
    "gpu_thread_merger_unittests.cc",
235
    "memory/ref_counted_unittest.cc",
236
    "memory/weak_ptr_unittest.cc",
237 238 239 240
    "message_loop_task_queues_merge_unmerge_unittests.cc",
    "message_loop_task_queues_unittests.cc",
    "message_loop_unittests.cc",
    "message_unittests.cc",
241
    "paths_unittests.cc",
242
    "platform/darwin/string_range_sanitization_unittests.mm",
243
    "synchronization/count_down_latch_unittests.cc",
244
    "synchronization/semaphore_unittest.cc",
245
    "synchronization/sync_switch_unittest.cc",
246
    "synchronization/waitable_event_unittest.cc",
247
    "thread_local_unittests.cc",
248
    "thread_unittests.cc",
249 250 251
    "time/time_delta_unittest.cc",
    "time/time_point_unittest.cc",
    "time/time_unittest.cc",
252 253 254
  ]

  deps = [
255
    ":fml_fixtures",
256 257 258 259
    "//flutter/fml",
    "//flutter/fml/dart",
    "//flutter/runtime:libdart",
    "//flutter/testing",
260
  ]
261 262 263 264

  if (is_fuchsia && using_fuchsia_sdk) {
    libs = [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
  }
265
}
266

267 268 269 270 271 272 273 274 275 276
if (is_fuchsia) {
  fuchsia_test_archive("fml_tests") {
    deps = [
      ":fml_unittests",
    ]

    binary = "fml_unittests"
  }
}

277 278 279 280 281 282 283 284
executable("fml_benchmarks") {
  testonly = true

  sources = [
    "message_loop_task_queues_benchmark.cc",
  ]

  deps = [
285 286 287
    "//flutter/benchmarking",
    "//flutter/fml",
    "//flutter/runtime:libdart",
288 289
  ]
}