blob: dbbf779e3fc53b74f92c78757c2f010a7d9a370b [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
Jesse Wilson1d24c642011-06-22 14:15:46 -070031libgtest_target_includes := \
Nicolas Catania97bd2262010-02-09 11:44:38 -080032 bionic/libstdc++/include \
Jesse Wilson1d24c642011-06-22 14:15:46 -070033 external/stlport/stlport \
Nicolas Catania97bd2262010-02-09 11:44:38 -080034 $(LOCAL_PATH)/.. \
35 $(LOCAL_PATH)/../include
Jesse Wilson1d24c642011-06-22 14:15:46 -070036
37libgtest_host_includes := \
38 $(LOCAL_PATH)/.. \
39 $(LOCAL_PATH)/../include
Nicolas Catania97bd2262010-02-09 11:44:38 -080040
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070041#######################################################################
42# gtest lib host
43
44include $(CLEAR_VARS)
45
46LOCAL_CPP_EXTENSION := .cc
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070047
Nicolas Catania97bd2262010-02-09 11:44:38 -080048LOCAL_SRC_FILES := gtest-all.cc
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070049
Jesse Wilson1d24c642011-06-22 14:15:46 -070050LOCAL_C_INCLUDES := $(libgtest_host_includes)
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070051
Nicolas Cataniaf6071db2009-06-24 08:24:18 -070052LOCAL_CFLAGS += -O0
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070053
Nicolas Cataniacda9ca52010-02-22 11:28:02 -080054LOCAL_MODULE := libgtest_host
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070055
56include $(BUILD_HOST_STATIC_LIBRARY)
57
58#######################################################################
59# gtest_main lib host
60
61include $(CLEAR_VARS)
62
63LOCAL_CPP_EXTENSION := .cc
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070064
Nicolas Catania97bd2262010-02-09 11:44:38 -080065LOCAL_SRC_FILES := gtest_main.cc
66
Jesse Wilson1d24c642011-06-22 14:15:46 -070067LOCAL_C_INCLUDES := $(libgtest_host_includes)
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070068
Nicolas Cataniaf6071db2009-06-24 08:24:18 -070069LOCAL_CFLAGS += -O0
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070070
Nicolas Cataniacda9ca52010-02-22 11:28:02 -080071LOCAL_MODULE := libgtest_main_host
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070072
73include $(BUILD_HOST_STATIC_LIBRARY)
74
Nicolas Catania97bd2262010-02-09 11:44:38 -080075#######################################################################
76# gtest lib target
77
78include $(CLEAR_VARS)
79
80LOCAL_CPP_EXTENSION := .cc
81
82LOCAL_SRC_FILES := gtest-all.cc
83
Jesse Wilson1d24c642011-06-22 14:15:46 -070084LOCAL_C_INCLUDES := $(libgtest_target_includes)
Nicolas Catania97bd2262010-02-09 11:44:38 -080085
Patrick Scott40b37182010-10-01 14:11:39 -040086ifneq ($(BUILD_WITH_ASTL),true)
Patrick Scott40b37182010-10-01 14:11:39 -040087include external/stlport/libstlport.mk
88endif
Patrick Scott40b37182010-10-01 14:11:39 -040089
Nicolas Catania97bd2262010-02-09 11:44:38 -080090LOCAL_MODULE := libgtest
Nicolas Catania97bd2262010-02-09 11:44:38 -080091
92include $(BUILD_STATIC_LIBRARY)
93
94#######################################################################
95# gtest_main lib target
96
97include $(CLEAR_VARS)
98
99LOCAL_CPP_EXTENSION := .cc
100
101LOCAL_SRC_FILES := gtest_main.cc
102
Jesse Wilson1d24c642011-06-22 14:15:46 -0700103LOCAL_C_INCLUDES := $(libgtest_target_includes)
Nicolas Catania97bd2262010-02-09 11:44:38 -0800104
Patrick Scott40b37182010-10-01 14:11:39 -0400105ifneq ($(BUILD_WITH_ASTL),true)
Patrick Scott40b37182010-10-01 14:11:39 -0400106include external/stlport/libstlport.mk
107endif
Patrick Scott40b37182010-10-01 14:11:39 -0400108
Nicolas Catania97bd2262010-02-09 11:44:38 -0800109LOCAL_MODULE := libgtest_main
Nicolas Catania97bd2262010-02-09 11:44:38 -0800110
111include $(BUILD_STATIC_LIBRARY)