1# Copyright 2018 The PDFium 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 if (is_ios) { 60 set_sources_assignment_filter([]) 61 } 62 sources += [ 63 "../gtest_mac.h", 64 "../gtest_mac.mm", 65 ] 66 if (gtest_include_platform_test) { 67 sources += [ "../platform_test_mac.mm" ] 68 } 69 set_sources_assignment_filter(sources_assignment_filter) 70 } 71 72 if (is_ios && gtest_include_ios_coverage) { 73 sources += [ 74 "../coverage_util_ios.h", 75 "../coverage_util_ios.mm", 76 ] 77 deps = [ ":ios_enable_coverage" ] 78 } 79} 80 81# The file/directory layout of Google Test is not yet considered stable. Until 82# it stabilizes, Chromium code MUST use this target instead of reaching directly 83# into //third_party/googletest. 84source_set("gtest_main") { 85 testonly = true 86 deps = [ "//third_party/googletest:gtest_main" ] 87} 88 89if (is_ios) { 90 buildflag_header("ios_enable_coverage") { 91 header = "ios_enable_coverage.h" 92 flags = [ "IOS_ENABLE_COVERAGE=$use_clang_coverage" ] 93 } 94} 95