• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2009 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#
15#
16
17# Gtest builds 2 libraries: libgtest and libgtest_main. libgtest
18# contains most of the code (assertions...) and libgtest_main just
19# provide a common main to run the test (ie if you link against
20# libgtest_main you won't/should not provide a main() entry point.
21#
22# We build these 2 libraries for the target device and for the host if
23# it is running linux and using ASTL.
24#
25
26# TODO: The targets below have some redundancy. Check if we cannot
27# condense them using function(s) for the common code.
28
29LOCAL_PATH := $(call my-dir)
30
31libgtest_target_includes := \
32  $(LOCAL_PATH)/.. \
33  $(LOCAL_PATH)/../include \
34
35libgtest_host_includes := \
36  $(LOCAL_PATH)/.. \
37  $(LOCAL_PATH)/../include \
38
39libgtest_cflags := \
40  -Wno-missing-field-initializers \
41
42#######################################################################
43# gtest lib for the NDK
44
45include $(CLEAR_VARS)
46LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
47
48LOCAL_SDK_VERSION := 9
49LOCAL_NDK_STL_VARIANT := stlport_static
50
51LOCAL_CPP_EXTENSION := .cc
52LOCAL_SRC_FILES := gtest-all.cc
53LOCAL_C_INCLUDES := $(libgtest_target_includes)
54LOCAL_CPPFLAGS := -std=gnu++98
55LOCAL_CFLAGS += $(libgtest_cflags)
56LOCAL_MODULE := libgtest_ndk
57
58include $(BUILD_STATIC_LIBRARY)
59
60#######################################################################
61# gtest_main for the NDK
62
63include $(CLEAR_VARS)
64LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
65
66LOCAL_SDK_VERSION := 9
67LOCAL_NDK_STL_VARIANT := stlport_static
68
69LOCAL_CPP_EXTENSION := .cc
70LOCAL_SRC_FILES := gtest_main.cc
71LOCAL_C_INCLUDES := $(libgtest_target_includes)
72LOCAL_CPPFLAGS := -std=gnu++98
73LOCAL_CFLAGS += $(libgtest_cflags)
74LOCAL_MODULE := libgtest_main_ndk
75
76include $(BUILD_STATIC_LIBRARY)
77
78#######################################################################
79# libc++
80
81#######################################################################
82# gtest lib host
83
84include $(CLEAR_VARS)
85LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
86
87LOCAL_CLANG := true
88LOCAL_CPP_EXTENSION := .cc
89LOCAL_SRC_FILES := gtest-all.cc
90LOCAL_C_INCLUDES := $(libgtest_host_includes)
91LOCAL_CFLAGS += $(libgtest_cflags)
92LOCAL_MODULE := libgtest_host
93LOCAL_MULTILIB := both
94LOCAL_ADDRESS_SANITIZER := false
95
96include $(BUILD_HOST_STATIC_LIBRARY)
97
98#######################################################################
99# gtest_main lib host
100
101include $(CLEAR_VARS)
102LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
103
104LOCAL_CLANG := true
105LOCAL_CPP_EXTENSION := .cc
106LOCAL_SRC_FILES := gtest_main.cc
107LOCAL_C_INCLUDES := $(libgtest_host_includes)
108LOCAL_CFLAGS += $(libgtest_cflags)
109LOCAL_MODULE := libgtest_main_host
110LOCAL_MULTILIB := both
111LOCAL_ADDRESS_SANITIZER := false
112
113include $(BUILD_HOST_STATIC_LIBRARY)
114
115#######################################################################
116# Don't build for unbundled branches
117ifeq (,$(TARGET_BUILD_APPS))
118# gtest lib target
119
120include $(CLEAR_VARS)
121LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
122
123LOCAL_CLANG := true
124LOCAL_CPP_EXTENSION := .cc
125LOCAL_SRC_FILES := gtest-all.cc
126LOCAL_C_INCLUDES := $(libgtest_target_includes)
127LOCAL_CFLAGS += $(libgtest_cflags)
128LOCAL_MODULE := libgtest
129LOCAL_ADDRESS_SANITIZER := false
130
131include $(BUILD_STATIC_LIBRARY)
132
133#######################################################################
134# gtest_main lib target
135
136include $(CLEAR_VARS)
137LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
138
139LOCAL_CLANG := true
140LOCAL_CPP_EXTENSION := .cc
141LOCAL_SRC_FILES := gtest_main.cc
142LOCAL_C_INCLUDES := $(libgtest_target_includes)
143LOCAL_CFLAGS += $(libgtest_cflags)
144LOCAL_MODULE := libgtest_main
145LOCAL_ADDRESS_SANITIZER := false
146
147include $(BUILD_STATIC_LIBRARY)
148endif
149