Android.mk revision 97bd226fd5b5ea1600c00b04fd281c71cdbaa0aa
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. The linux build and tests are run under
24# valgrind by 'runtest'.
25#
26# Includes:
27# * For a host build we need to specify bionic/libstdc++/include
28#   otherwise gcc will pick the system's STL. For targets build this
29#   is automatically done by the toolchain but we add it for the
30#   simulator builds..
31# * libjingle's include directives start at the 'talk' level which is
32#   2 directories up. We use $(LOCAL_PATH) to get an absolute include
33#   path just in case talk has been symlinked.
34
35LOCAL_PATH := $(call my-dir)
36
37libgtest_includes:= \
38    bionic/libstdc++/include \
39    external/astl/include \
40    $(LOCAL_PATH)/.. \
41    $(LOCAL_PATH)/../include
42
43ifeq ($(HOST_OS),linux)
44
45#######################################################################
46# gtest lib host
47
48include $(CLEAR_VARS)
49
50LOCAL_CPP_EXTENSION := .cc
51
52LOCAL_SRC_FILES := gtest-all.cc
53
54LOCAL_C_INCLUDES := $(libgtest_includes)
55
56LOCAL_CFLAGS += -O0
57
58LOCAL_MODULE := libgtest
59LOCAL_MODULE_TAGS := eng
60
61include $(BUILD_HOST_STATIC_LIBRARY)
62
63#######################################################################
64# gtest_main lib host
65
66include $(CLEAR_VARS)
67
68LOCAL_CPP_EXTENSION := .cc
69
70LOCAL_SRC_FILES := gtest_main.cc
71
72LOCAL_C_INCLUDES := $(libgtest_includes)
73
74LOCAL_CFLAGS += -O0
75
76LOCAL_STATIC_LIBRARIES := libgtest
77
78LOCAL_MODULE := libgtest_main
79LOCAL_MODULE_TAGS := eng
80
81include $(BUILD_HOST_STATIC_LIBRARY)
82
83endif # HOST_OS == linux
84
85#######################################################################
86# gtest lib target
87
88include $(CLEAR_VARS)
89
90LOCAL_CPP_EXTENSION := .cc
91
92LOCAL_SRC_FILES := gtest-all.cc
93
94LOCAL_C_INCLUDES := $(libgtest_includes)
95
96LOCAL_MODULE := libgtest
97LOCAL_MODULE_TAGS := eng
98
99include $(BUILD_STATIC_LIBRARY)
100
101#######################################################################
102# gtest_main lib target
103
104include $(CLEAR_VARS)
105
106LOCAL_CPP_EXTENSION := .cc
107
108LOCAL_SRC_FILES := gtest_main.cc
109
110LOCAL_C_INCLUDES := $(libgtest_includes)
111
112LOCAL_STATIC_LIBRARIES := libgtest
113
114LOCAL_MODULE := libgtest_main
115LOCAL_MODULE_TAGS := eng
116
117include $(BUILD_STATIC_LIBRARY)
118