# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//flutter/common/config.gni")
import("//flutter/impeller/tools/impeller.gni")
import("//flutter/testing/testing.gni")

source_set("gpu") {
  cflags = [
    # Dart gives us doubles. Skia and Impeller work in floats.
    # If Dart gives us a double > FLT_MAX or < -FLT_MAX, implicit conversion
    # will convert it to either inf/-inf or FLT_MAX/-FLT_MAX (undefined
    # behavior). This can result in surprising and difficult to debug behavior
    # for Flutter application developers, so it should be explicitly handled
    # via SafeNarrow.
    "-Wimplicit-float-conversion",
  ]

  if (is_win) {
    # This causes build failures in third_party dependencies on Windows.
    cflags += [ "-Wno-implicit-int-float-conversion" ]
  }

  public_configs = [ "//flutter:config" ]

  public_deps = []

  if (!defined(defines)) {
    defines = []
  }

  if (!is_fuchsia) {
    sources = [
      "context.cc",
      "context.h",
      "export.cc",
      "export.h",
      "smoketest.cc",
      "smoketest.h",
    ]
  }
  deps = [
    "//flutter/impeller",
    "//flutter/impeller/display_list:skia_conversions",
    "//flutter/lib/ui",
    "//flutter/third_party/tonic",
  ]

  if (is_win) {
    # Required for M_PI and others.
    defines += [ "_USE_MATH_DEFINES" ]
  }
}

if (enable_unittests) {
}
