chromium/third_party/snappy/BUILD.gn

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

import("//testing/test.gni")

config("snappy_config") {
  include_dirs = [ "src" ]

  # These OS-specific generated headers were made by running the configure
  # script offline.
  if (is_win) {
    include_dirs += [ "win32" ]
  } else if (is_mac) {
    include_dirs += [ "mac" ]
  } else {
    include_dirs += [ "linux" ]
  }
}

config("snappy_warnings") {
  cflags = []

  if (is_win) {
    cflags += [ "/wd4018" ]  # Signed/unsigned mismatch in comparison.
  }
}

static_library("snappy") {
  sources = [
    "src/snappy-internal.h",
    "src/snappy-sinksource.cc",
    "src/snappy-sinksource.h",
    "src/snappy-stubs-internal.cc",
    "src/snappy-stubs-internal.h",
    "src/snappy.cc",
    "src/snappy.h",
  ]

  if (is_win) {
    sources += [ "win32/snappy-stubs-public.h" ]
  } else if (is_mac) {
    sources += [ "mac/snappy-stubs-public.h" ]
  } else {
    sources += [ "linux/snappy-stubs-public.h" ]
  }

  configs -= [ "//build/config/compiler:chromium_code" ]
  configs += [
    "//build/config/compiler:no_chromium_code",

    # Must be after no_chromium_code for warning flags to be ordered correctly.
    ":snappy_warnings",
  ]
  public_configs = [ ":snappy_config" ]

  # Chromium doesn't use automake, but we generated config.h offline for all the
  # platforms that we build for.
  defines = [ "HAVE_CONFIG_H" ]
}