chromium/chrome/installer/gcapi_mac/BUILD.gn

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

import("//build/config/sysroot.gni")

assert(is_mac)

config("gcapi_config") {
  # gcapi can be bundled with installers of other software, which might run
  # on older macOS versions than chrome itself. To not making a dependency on
  # gcapi a problem for these installers, make it target a very old version
  # of macOS.
  min_version = "10.12"
  cflags = [
    "-isysroot",
    rebase_path(sysroot, root_build_dir),
    "-mmacos-version-min=$min_version",
  ]
  ldflags = [
    "-isysroot",
    rebase_path(sysroot, root_build_dir),
    "-mmacos-version-min=$min_version",
  ]
}

static_library("gcapi_lib") {
  complete_static_lib = true
  configs -= [ "//build/config/compiler:thin_archive" ]
  sources = [
    "gcapi.h",
    "gcapi.mm",
  ]

  frameworks = [ "Cocoa.framework" ]

  # Don't use runtime_library, to be able to pick a custom mmacos-version-min.
  configs -= [ "//build/config/compiler:runtime_library" ]
  configs += [ ":gcapi_config" ]

  # no_default_deps has no effect in static_libraries, so set it only below.
}

executable("gcapi_example") {
  sources = [ "gcapi_example_client.mm" ]

  deps = [ ":gcapi_lib" ]

  # Don't use runtime_library, to be able to pick a custom mmacos-version-min.
  configs -= [ "//build/config/compiler:runtime_library" ]
  configs += [ ":gcapi_config" ]

  # Every executable by default links to a hermetic libc++, so that we can
  # guarantee the capability of the standard library. Neither gcapi_lib
  # nor gcapi_example contain any significant use of the standard library
  # and gcapi_lib is supposed to be redistributable to partners who don't
  # want to link our hermetic libc++, so set no_default_deps to not link to
  # our hermetic libc++.
  no_default_deps = true
}