chromium/third_party/google_toolbox_for_mac/BUILD.gn

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

config("google_toolbox_for_mac_public_config") {
  include_dirs = [
    ".",
    "src",
    "src/AppKit",
    "src/DebugUtils",
    "src/Foundation",
  ]
}

component("google_toolbox_for_mac") {
  sources = [ "src/GTMDefines.h" ]

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

  # Do not compile with ARC because GTM code is not compatible with being
  # compiled with ARC.
  configs -= [ "//build/config/compiler:enable_arc" ]
  public_configs = [ ":google_toolbox_for_mac_public_config" ]

  if (!is_ios) {
    sources += [
      "src/AppKit/GTMCarbonEvent.h",
      "src/AppKit/GTMCarbonEvent.m",
      "src/AppKit/GTMUILocalizer.h",
      "src/AppKit/GTMUILocalizer.m",
      "src/AppKit/GTMUILocalizerAndLayoutTweaker.h",
      "src/AppKit/GTMUILocalizerAndLayoutTweaker.m",
      "src/DebugUtils/GTMDebugSelectorValidation.h",
      "src/DebugUtils/GTMTypeCasting.h",
    ]

    frameworks = [
      "AppKit.framework",
      "Carbon.framework",
      "Cocoa.framework",
      "QuartzCore.framework",
    ]
  } else {  # is_ios
    sources += [
      "src/DebugUtils/GTMMethodCheck.h",
      "src/DebugUtils/GTMMethodCheck.m",
      "src/Foundation/GTMLightweightProxy.h",
      "src/Foundation/GTMLightweightProxy.m",

      # GTMLogger is used by breakpad, which is still used on iOS.
      # GTMLogger and GTMSQLite are used by Phenotype, a dependency of GrowthKit.
      "src/Foundation/GTMLogger.h",
      "src/Foundation/GTMLogger.m",
      "src/Foundation/GTMNSData+zlib.h",
      "src/Foundation/GTMNSData+zlib.m",
      "src/Foundation/GTMNSDictionary+URLArguments.h",
      "src/Foundation/GTMNSDictionary+URLArguments.m",
      "src/Foundation/GTMNSString+URLArguments.h",
      "src/Foundation/GTMNSString+URLArguments.m",
      "src/Foundation/GTMSQLite.h",
      "src/Foundation/GTMSQLite.m",
      "src/Foundation/GTMStringEncoding.h",
      "src/Foundation/GTMStringEncoding.m",
      "src/Foundation/GTMTimeUtils.h",
      "src/Foundation/GTMTimeUtils.m",
      "src/iPhone/GTMFadeTruncatingLabel.h",
      "src/iPhone/GTMFadeTruncatingLabel.m",
      "src/iPhone/GTMRoundedRectPath.h",
      "src/iPhone/GTMRoundedRectPath.m",
      "src/iPhone/GTMUIImage+Resize.h",
      "src/iPhone/GTMUIImage+Resize.m",
      "src/iPhone/GTMUILocalizer.h",
      "src/iPhone/GTMUILocalizer.m",
    ]

    # TODO(crbug.com/569158): Suppresses warnings that are treated as errors
    # when minimum iOS version support is increased to iOS 9 and up.
    # This should be removed once all deprecation violations have been fixed.
    cflags = [ "-Wno-deprecated-declarations" ]

    libs = [
      "sqlite3",
      "z",
    ]
  }

  if (is_component_build) {
    # GTM is third-party code, so we don't want to add _EXPORT
    # annotations to it, so build it without -fvisibility=hidden
    # (else the interface class symbols will be hidden in a 64bit
    # build). Only do this in a component build, so that the shipping
    # chrome binary doesn't end up with unnecessarily exported
    # symbols.
    configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
    configs += [ "//build/config/gcc:symbol_visibility_default" ]
  }
}