blob: e3d8cac9efd798412b5766f6c6de8c1e56ba2fa0 [file] [log] [blame]
Nicolas Catania1be2c9d2009-05-28 19:30:30 -07001# 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
Nicolas Catania97bd2262010-02-09 11:44:38 -080017# 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
Nicolas Cataniacda9ca52010-02-22 11:28:02 -080023# it is running linux and using ASTL.
Nicolas Catania97bd2262010-02-09 11:44:38 -080024#
Nicolas Cataniacda9ca52010-02-22 11:28:02 -080025
26# TODO: The targets below have some redundancy. Check if we cannot
27# condense them using function(s) for the common code.
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070028
29LOCAL_PATH := $(call my-dir)
30
Nicolas Cataniacda9ca52010-02-22 11:28:02 -080031ifeq ($(BUILD_WITH_ASTL),true)
Nicolas Catania97bd2262010-02-09 11:44:38 -080032libgtest_includes:= \
33 bionic/libstdc++/include \
34 external/astl/include \
35 $(LOCAL_PATH)/.. \
36 $(LOCAL_PATH)/../include
Nicolas Cataniacda9ca52010-02-22 11:28:02 -080037else
38# BUILD_WITH_ASTL could be undefined, force it to false.
39BUILD_WITH_ASTL := false
40libgtest_includes := \
Nicolas Cataniacda9ca52010-02-22 11:28:02 -080041 $(LOCAL_PATH)/.. \
42 $(LOCAL_PATH)/../include
43endif
Nicolas Catania97bd2262010-02-09 11:44:38 -080044
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070045#######################################################################
46# gtest lib host
47
48include $(CLEAR_VARS)
49
50LOCAL_CPP_EXTENSION := .cc
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070051
Nicolas Catania97bd2262010-02-09 11:44:38 -080052LOCAL_SRC_FILES := gtest-all.cc
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070053
Nicolas Catania97bd2262010-02-09 11:44:38 -080054LOCAL_C_INCLUDES := $(libgtest_includes)
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070055
Nicolas Cataniaf6071db2009-06-24 08:24:18 -070056LOCAL_CFLAGS += -O0
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070057
Nicolas Cataniacda9ca52010-02-22 11:28:02 -080058LOCAL_MODULE := libgtest_host
Nicolas Catania97bd2262010-02-09 11:44:38 -080059LOCAL_MODULE_TAGS := eng
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070060
61include $(BUILD_HOST_STATIC_LIBRARY)
62
63#######################################################################
64# gtest_main lib host
65
66include $(CLEAR_VARS)
67
68LOCAL_CPP_EXTENSION := .cc
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070069
Nicolas Catania97bd2262010-02-09 11:44:38 -080070LOCAL_SRC_FILES := gtest_main.cc
71
72LOCAL_C_INCLUDES := $(libgtest_includes)
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070073
Nicolas Cataniaf6071db2009-06-24 08:24:18 -070074LOCAL_CFLAGS += -O0
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070075
76LOCAL_STATIC_LIBRARIES := libgtest
77
Nicolas Cataniacda9ca52010-02-22 11:28:02 -080078LOCAL_MODULE := libgtest_main_host
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070079LOCAL_MODULE_TAGS := eng
80
81include $(BUILD_HOST_STATIC_LIBRARY)
82
Nicolas Catania97bd2262010-02-09 11:44:38 -080083#######################################################################
84# gtest lib target
85
86include $(CLEAR_VARS)
87
88LOCAL_CPP_EXTENSION := .cc
89
90LOCAL_SRC_FILES := gtest-all.cc
91
92LOCAL_C_INCLUDES := $(libgtest_includes)
93
Patrick Scott40b37182010-10-01 14:11:39 -040094ifneq ($(BUILD_WITH_ASTL),true)
95ifneq ($(TARGET_SIMULATOR),true)
96include external/stlport/libstlport.mk
97endif
98endif
99
Nicolas Catania97bd2262010-02-09 11:44:38 -0800100LOCAL_MODULE := libgtest
101LOCAL_MODULE_TAGS := eng
102
103include $(BUILD_STATIC_LIBRARY)
104
105#######################################################################
106# gtest_main lib target
107
108include $(CLEAR_VARS)
109
110LOCAL_CPP_EXTENSION := .cc
111
112LOCAL_SRC_FILES := gtest_main.cc
113
114LOCAL_C_INCLUDES := $(libgtest_includes)
115
Patrick Scott40b37182010-10-01 14:11:39 -0400116ifneq ($(BUILD_WITH_ASTL),true)
117ifneq ($(TARGET_SIMULATOR),true)
118include external/stlport/libstlport.mk
119endif
120endif
121
Nicolas Catania97bd2262010-02-09 11:44:38 -0800122LOCAL_STATIC_LIBRARIES := libgtest
123
124LOCAL_MODULE := libgtest_main
125LOCAL_MODULE_TAGS := eng
126
127include $(BUILD_STATIC_LIBRARY)