Android.mk revision 75949c699819af8941b4b1e7997a10c3ec5f72cf
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 host
44
45include $(CLEAR_VARS)
46
47LOCAL_CPP_EXTENSION := .cc
48LOCAL_SRC_FILES := gtest-all.cc
49LOCAL_C_INCLUDES := $(libgtest_host_includes)
50LOCAL_CFLAGS += $(libgtest_cflags)
51LOCAL_MODULE := libgtest_host
52
53include $(BUILD_HOST_STATIC_LIBRARY)
54
55#######################################################################
56# gtest_main lib host
57
58include $(CLEAR_VARS)
59
60LOCAL_CPP_EXTENSION := .cc
61LOCAL_SRC_FILES := gtest_main.cc
62LOCAL_C_INCLUDES := $(libgtest_host_includes)
63LOCAL_CFLAGS += $(libgtest_cflags)
64LOCAL_MODULE := libgtest_main_host
65
66include $(BUILD_HOST_STATIC_LIBRARY)
67
68#######################################################################
69# gtest lib target
70
71include $(CLEAR_VARS)
72
73LOCAL_SDK_VERSION := 9
74LOCAL_NDK_STL_VARIANT := stlport_static
75
76LOCAL_CPP_EXTENSION := .cc
77LOCAL_SRC_FILES := gtest-all.cc
78LOCAL_C_INCLUDES := $(libgtest_target_includes)
79LOCAL_CFLAGS += $(libgtest_cflags)
80LOCAL_MODULE := libgtest
81
82include $(BUILD_STATIC_LIBRARY)
83
84#######################################################################
85# gtest_main lib target
86
87include $(CLEAR_VARS)
88
89LOCAL_SDK_VERSION := 9
90LOCAL_NDK_STL_VARIANT := stlport_static
91
92LOCAL_CPP_EXTENSION := .cc
93LOCAL_SRC_FILES := gtest_main.cc
94LOCAL_C_INCLUDES := $(libgtest_target_includes)
95LOCAL_CFLAGS += $(libgtest_cflags)
96LOCAL_MODULE := libgtest_main
97
98include $(BUILD_STATIC_LIBRARY)
99
100# Don't build for unbundled branches
101ifeq (,$(TARGET_BUILD_APPS))
102#######################################################################
103# libc++
104
105#######################################################################
106# gtest lib host
107
108include $(CLEAR_VARS)
109
110LOCAL_CPP_EXTENSION := .cc
111LOCAL_SRC_FILES := gtest-all.cc
112LOCAL_C_INCLUDES := $(libgtest_host_includes)
113LOCAL_CFLAGS += $(libgtest_cflags)
114LOCAL_MODULE := libgtest_libc++_host
115
116include external/libcxx/libcxx.mk
117include $(BUILD_HOST_STATIC_LIBRARY)
118
119#######################################################################
120# gtest_main lib host
121
122include $(CLEAR_VARS)
123
124LOCAL_CPP_EXTENSION := .cc
125LOCAL_SRC_FILES := gtest_main.cc
126LOCAL_C_INCLUDES := $(libgtest_host_includes)
127LOCAL_CFLAGS += $(libgtest_cflags)
128LOCAL_MODULE := libgtest_main_libc++_host
129
130include external/libcxx/libcxx.mk
131include $(BUILD_HOST_STATIC_LIBRARY)
132
133#######################################################################
134# gtest lib target
135
136include $(CLEAR_VARS)
137
138LOCAL_CPP_EXTENSION := .cc
139LOCAL_SRC_FILES := gtest-all.cc
140LOCAL_C_INCLUDES := $(libgtest_target_includes)
141LOCAL_CFLAGS += $(libgtest_cflags)
142LOCAL_MODULE := libgtest_libc++
143
144include external/libcxx/libcxx.mk
145include $(BUILD_STATIC_LIBRARY)
146
147#######################################################################
148# gtest_main lib target
149
150include $(CLEAR_VARS)
151
152LOCAL_CPP_EXTENSION := .cc
153LOCAL_SRC_FILES := gtest_main.cc
154LOCAL_C_INCLUDES := $(libgtest_target_includes)
155LOCAL_CFLAGS += $(libgtest_cflags)
156LOCAL_MODULE := libgtest_main_libc++
157
158include external/libcxx/libcxx.mk
159include $(BUILD_STATIC_LIBRARY)
160endif
161