xref: /aosp_15_r20/external/googletest/googlemock/Android.bp (revision 481dde660366d6f317d242b6974ef1b20adb843c)
1// Copyright (C) 2016 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    // See: http://go/android-license-faq
17    // A large-scale-change added 'default_applicable_licenses' to import
18    // all of the 'license_kinds' from "external_googletest_license"
19    // to get the below license kinds:
20    //   SPDX-license-identifier-Apache-2.0
21    //   SPDX-license-identifier-BSD
22    default_applicable_licenses: ["external_googletest_license"],
23}
24
25cc_defaults {
26    name: "gmock_flags",
27
28    local_include_dirs: ["include"],
29    export_include_dirs: ["include"],
30
31    cflags: [
32        "-Wall",
33        "-Werror",
34        "-Wno-missing-field-initializers",
35        "-Wno-sign-compare",
36        "-Wno-unused-parameter",
37        // We need to generate exception tables, otherwise any users of this
38        // library that use testing::Throw will trigger undefined behaviour.
39        "-fexceptions",
40    ],
41}
42
43cc_defaults {
44    name: "gmock_ndk",
45    sdk_version: "9",
46    stl: "c++_static",
47    cpp_std: "c++14",
48}
49
50cc_defaults {
51    name: "gmock_defaults",
52    host_supported: true,
53    target: {
54        linux_bionic: {
55            enabled: true,
56        },
57        windows: {
58            enabled: true,
59        },
60    },
61}
62
63cc_library_static {
64    name: "libgmock_ndk",
65    defaults: [
66        "gmock_ndk",
67        "gmock_flags",
68    ],
69    srcs: ["src/gmock-all.cc"],
70    static_libs: ["libgtest_ndk_c++"],
71}
72
73cc_library_static {
74    name: "libgmock_main_ndk",
75    defaults: [
76        "gmock_ndk",
77        "gmock_flags",
78    ],
79    srcs: ["src/gmock_main.cc"],
80    static_libs: ["libgtest_ndk_c++"],
81}
82
83cc_library_static {
84    name: "libgmock",
85    defaults: [
86        "gmock_defaults",
87        "gmock_flags",
88    ],
89    srcs: ["src/gmock-all.cc"],
90    rtti: true,
91    static_libs: ["libgtest"],
92    vendor_available: true,
93    product_available: true,
94    native_bridge_supported: true,
95    cmake_snapshot_supported: true,
96}
97
98cc_library_static {
99    name: "libgmock_main",
100    defaults: [
101        "gmock_defaults",
102        "gmock_flags",
103    ],
104    srcs: ["src/gmock_main.cc"],
105    static_libs: ["libgtest"],
106    vendor_available: true,
107    product_available: true,
108    native_bridge_supported: true,
109    cmake_snapshot_supported: true,
110}
111
112// Deprecated: use libgmock instead
113cc_library_host_static {
114    name: "libgmock_host",
115    defaults: [
116        "gmock_defaults",
117        "gmock_flags",
118    ],
119    whole_static_libs: ["libgmock"],
120}
121
122cc_library_host_static {
123    name: "libgmock_main_host",
124    defaults: [
125        "gmock_defaults",
126        "gmock_flags",
127    ],
128    whole_static_libs: ["libgmock_main"],
129}
130