Android.mk revision dac6030289c87010b31bad60b769399b387ef15c
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
39#######################################################################
40# gtest lib host
41
42include $(CLEAR_VARS)
43
44LOCAL_CPP_EXTENSION := .cc
45
46LOCAL_SRC_FILES := gtest-all.cc
47
48LOCAL_C_INCLUDES := $(libgtest_host_includes)
49
50LOCAL_CFLAGS += -O0
51
52LOCAL_MODULE := libgtest_host
53
54include $(BUILD_HOST_STATIC_LIBRARY)
55
56#######################################################################
57# gtest_main lib host
58
59include $(CLEAR_VARS)
60
61LOCAL_CPP_EXTENSION := .cc
62
63LOCAL_SRC_FILES := gtest_main.cc
64
65LOCAL_C_INCLUDES := $(libgtest_host_includes)
66
67LOCAL_CFLAGS += -O0
68
69LOCAL_MODULE := libgtest_main_host
70
71include $(BUILD_HOST_STATIC_LIBRARY)
72
73#######################################################################
74# gtest lib target
75
76include $(CLEAR_VARS)
77
78ifeq ($(TARGET_ARCH), arm)
79   LOCAL_SDK_VERSION := 8
80else
81# NDK support of other archs (ie. x86 and mips) are only available after android-9
82   LOCAL_SDK_VERSION := 9
83endif
84
85LOCAL_NDK_STL_VARIANT := stlport_static
86
87LOCAL_CPP_EXTENSION := .cc
88
89LOCAL_SRC_FILES := gtest-all.cc
90
91LOCAL_C_INCLUDES := $(libgtest_target_includes)
92
93LOCAL_MODULE := libgtest
94
95include $(BUILD_STATIC_LIBRARY)
96
97#######################################################################
98# gtest_main lib target
99
100include $(CLEAR_VARS)
101
102ifeq ($(TARGET_ARCH), arm)
103   LOCAL_SDK_VERSION := 8
104else
105# NDK support of other archs (ie. x86 and mips) are only available after android-9
106   LOCAL_SDK_VERSION := 9
107endif
108
109LOCAL_NDK_STL_VARIANT := stlport_static
110
111LOCAL_CPP_EXTENSION := .cc
112
113LOCAL_SRC_FILES := gtest_main.cc
114
115LOCAL_C_INCLUDES := $(libgtest_target_includes)
116
117LOCAL_MODULE := libgtest_main
118
119include $(BUILD_STATIC_LIBRARY)
120