xref: /third_party/node/deps/v8/testing/gtest/BUILD.gn (revision 1cb0ef41)
11cb0ef41Sopenharmony_ci# Copyright 2014 The Chromium Authors. All rights reserved.
21cb0ef41Sopenharmony_ci# Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci# found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ciimport("//build_overrides/gtest.gni")
61cb0ef41Sopenharmony_ciif (is_ios) {
71cb0ef41Sopenharmony_ci  import("//build/buildflag_header.gni")
81cb0ef41Sopenharmony_ci  import("//build/config/coverage/coverage.gni")
91cb0ef41Sopenharmony_ci  import("//build/config/ios/ios_sdk.gni")
101cb0ef41Sopenharmony_ci}
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ciconfig("gtest_direct_config") {
131cb0ef41Sopenharmony_ci  visibility = [ ":*" ]
141cb0ef41Sopenharmony_ci  defines = [ "UNIT_TEST" ]
151cb0ef41Sopenharmony_ci}
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ci# The file/directory layout of Google Test is not yet considered stable. Until
181cb0ef41Sopenharmony_ci# it stabilizes, Chromium code MUST use this target instead of reaching directly
191cb0ef41Sopenharmony_ci# into //third_party/googletest.
201cb0ef41Sopenharmony_cistatic_library("gtest") {
211cb0ef41Sopenharmony_ci  testonly = true
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ci  sources = [
241cb0ef41Sopenharmony_ci    "include/gtest/gtest-death-test.h",
251cb0ef41Sopenharmony_ci    "include/gtest/gtest-message.h",
261cb0ef41Sopenharmony_ci    "include/gtest/gtest-param-test.h",
271cb0ef41Sopenharmony_ci    "include/gtest/gtest-spi.h",
281cb0ef41Sopenharmony_ci    "include/gtest/gtest.h",
291cb0ef41Sopenharmony_ci    "include/gtest/gtest_prod.h",
301cb0ef41Sopenharmony_ci
311cb0ef41Sopenharmony_ci    # This is a workaround for the issues below.
321cb0ef41Sopenharmony_ci    #
331cb0ef41Sopenharmony_ci    # 1) This target needs to be a static_library (not a source set) on Mac to
341cb0ef41Sopenharmony_ci    #    avoid the build errors in
351cb0ef41Sopenharmony_ci    #    https://codereview.chromium.org/2779193002#msg82.
361cb0ef41Sopenharmony_ci    # 2) A static_library must have at least one source file, to avoid build
371cb0ef41Sopenharmony_ci    #    errors on Mac and Windows. https://crbug.com/710334
381cb0ef41Sopenharmony_ci    # 3) A static_library with complete_static_lib = true, which would not
391cb0ef41Sopenharmony_ci    #    require adding the empty file, will result in duplicate symbols on
401cb0ef41Sopenharmony_ci    #    Android. https://codereview.chromium.org/2852613002/#ps20001
411cb0ef41Sopenharmony_ci    "empty.cc",
421cb0ef41Sopenharmony_ci  ]
431cb0ef41Sopenharmony_ci  public_deps = [ "//third_party/googletest:gtest" ]
441cb0ef41Sopenharmony_ci
451cb0ef41Sopenharmony_ci  public_configs = [ ":gtest_direct_config" ]
461cb0ef41Sopenharmony_ci
471cb0ef41Sopenharmony_ci  if (gtest_include_multiprocess) {
481cb0ef41Sopenharmony_ci    sources += [
491cb0ef41Sopenharmony_ci      "../multiprocess_func_list.cc",
501cb0ef41Sopenharmony_ci      "../multiprocess_func_list.h",
511cb0ef41Sopenharmony_ci    ]
521cb0ef41Sopenharmony_ci  }
531cb0ef41Sopenharmony_ci
541cb0ef41Sopenharmony_ci  if (gtest_include_platform_test) {
551cb0ef41Sopenharmony_ci    sources += [ "../platform_test.h" ]
561cb0ef41Sopenharmony_ci  }
571cb0ef41Sopenharmony_ci
581cb0ef41Sopenharmony_ci  if ((is_mac || is_ios) && gtest_include_objc_support) {
591cb0ef41Sopenharmony_ci    sources += [
601cb0ef41Sopenharmony_ci      "../gtest_mac.h",
611cb0ef41Sopenharmony_ci      "../gtest_mac.mm",
621cb0ef41Sopenharmony_ci    ]
631cb0ef41Sopenharmony_ci    if (gtest_include_platform_test) {
641cb0ef41Sopenharmony_ci      sources += [ "../platform_test_mac.mm" ]
651cb0ef41Sopenharmony_ci    }
661cb0ef41Sopenharmony_ci  }
671cb0ef41Sopenharmony_ci
681cb0ef41Sopenharmony_ci  if (is_ios && gtest_include_ios_coverage) {
691cb0ef41Sopenharmony_ci    sources += [
701cb0ef41Sopenharmony_ci      "../coverage_util_ios.h",
711cb0ef41Sopenharmony_ci      "../coverage_util_ios.mm",
721cb0ef41Sopenharmony_ci    ]
731cb0ef41Sopenharmony_ci    deps = [ ":ios_enable_coverage" ]
741cb0ef41Sopenharmony_ci  }
751cb0ef41Sopenharmony_ci}
761cb0ef41Sopenharmony_ci
771cb0ef41Sopenharmony_ci# The file/directory layout of Google Test is not yet considered stable. Until
781cb0ef41Sopenharmony_ci# it stabilizes, Chromium code MUST use this target instead of reaching directly
791cb0ef41Sopenharmony_ci# into //third_party/googletest.
801cb0ef41Sopenharmony_cisource_set("gtest_main") {
811cb0ef41Sopenharmony_ci  testonly = true
821cb0ef41Sopenharmony_ci  deps = [ "//third_party/googletest:gtest_main" ]
831cb0ef41Sopenharmony_ci}
841cb0ef41Sopenharmony_ci
851cb0ef41Sopenharmony_ciif (is_ios) {
861cb0ef41Sopenharmony_ci  buildflag_header("ios_enable_coverage") {
871cb0ef41Sopenharmony_ci    header = "ios_enable_coverage.h"
881cb0ef41Sopenharmony_ci    flags = [ "IOS_ENABLE_COVERAGE=$use_clang_coverage" ]
891cb0ef41Sopenharmony_ci  }
901cb0ef41Sopenharmony_ci}
91