1# Copyright 2014 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import("//build_overrides/gtest.gni") 6if (is_ios) { 7 import("//build/buildflag_header.gni") 8 import("//build/config/coverage/coverage.gni") 9 import("//build/config/ios/ios_sdk.gni") 10} 11 12config("gtest_direct_config") { 13 visibility = [ ":*" ] 14 defines = [ "UNIT_TEST" ] 15} 16 17# The file/directory layout of Google Test is not yet considered stable. Until 18# it stabilizes, Chromium code MUST use this target instead of reaching directly 19# into //third_party/googletest. 20static_library("gtest") { 21 testonly = true 22 23 sources = [ 24 "include/gtest/gtest-death-test.h", 25 "include/gtest/gtest-message.h", 26 "include/gtest/gtest-param-test.h", 27 "include/gtest/gtest-spi.h", 28 "include/gtest/gtest.h", 29 "include/gtest/gtest_prod.h", 30 31 # This is a workaround for the issues below. 32 # 33 # 1) This target needs to be a static_library (not a source set) on Mac to 34 # avoid the build errors in 35 # https://codereview.chromium.org/2779193002#msg82. 36 # 2) A static_library must have at least one source file, to avoid build 37 # errors on Mac and Windows. https://crbug.com/710334 38 # 3) A static_library with complete_static_lib = true, which would not 39 # require adding the empty file, will result in duplicate symbols on 40 # Android. https://codereview.chromium.org/2852613002/#ps20001 41 "empty.cc", 42 ] 43 public_deps = [ "//third_party/googletest:gtest" ] 44 45 public_configs = [ ":gtest_direct_config" ] 46 47 if (gtest_include_multiprocess) { 48 sources += [ 49 "../multiprocess_func_list.cc", 50 "../multiprocess_func_list.h", 51 ] 52 } 53 54 if (gtest_include_platform_test) { 55 sources += [ "../platform_test.h" ] 56 } 57 58 if ((is_mac || is_ios) && gtest_include_objc_support) { 59 sources += [ 60 "../gtest_mac.h", 61 "../gtest_mac.mm", 62 ] 63 if (gtest_include_platform_test) { 64 sources += [ "../platform_test_mac.mm" ] 65 } 66 } 67 68 if (is_ios && gtest_include_ios_coverage) { 69 sources += [ 70 "../coverage_util_ios.h", 71 "../coverage_util_ios.mm", 72 ] 73 deps = [ ":ios_enable_coverage" ] 74 } 75} 76 77# The file/directory layout of Google Test is not yet considered stable. Until 78# it stabilizes, Chromium code MUST use this target instead of reaching directly 79# into //third_party/googletest. 80source_set("gtest_main") { 81 testonly = true 82 deps = [ "//third_party/googletest:gtest_main" ] 83} 84 85if (is_ios) { 86 buildflag_header("ios_enable_coverage") { 87 header = "ios_enable_coverage.h" 88 flags = [ "IOS_ENABLE_COVERAGE=$use_clang_coverage" ] 89 } 90} 91