blob: e7f8ff7ba1297bf47c4b6b5c0cae2581fbb8b828 [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 := \
Dan Albertd72b5dc2014-04-28 10:05:00 -070032 $(LOCAL_PATH)/.. \
33 $(LOCAL_PATH)/../include \
Jesse Wilson1d24c642011-06-22 14:15:46 -070034
35libgtest_host_includes := \
36 $(LOCAL_PATH)/.. \
Dan Albertd72b5dc2014-04-28 10:05:00 -070037 $(LOCAL_PATH)/../include \
Nicolas Catania97bd2262010-02-09 11:44:38 -080038
Elliott Hughesfc2de662014-01-28 16:58:35 -080039libgtest_cflags := \
40 -Wno-missing-field-initializers \
41
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070042#######################################################################
43# gtest lib host
44
45include $(CLEAR_VARS)
46
47LOCAL_CPP_EXTENSION := .cc
Nicolas Catania97bd2262010-02-09 11:44:38 -080048LOCAL_SRC_FILES := gtest-all.cc
Jesse Wilson1d24c642011-06-22 14:15:46 -070049LOCAL_C_INCLUDES := $(libgtest_host_includes)
Elliott Hughesfc2de662014-01-28 16:58:35 -080050LOCAL_CFLAGS += $(libgtest_cflags)
Nicolas Cataniacda9ca52010-02-22 11:28:02 -080051LOCAL_MODULE := libgtest_host
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070052
53include $(BUILD_HOST_STATIC_LIBRARY)
54
55#######################################################################
56# gtest_main lib host
57
58include $(CLEAR_VARS)
59
60LOCAL_CPP_EXTENSION := .cc
Nicolas Catania97bd2262010-02-09 11:44:38 -080061LOCAL_SRC_FILES := gtest_main.cc
Jesse Wilson1d24c642011-06-22 14:15:46 -070062LOCAL_C_INCLUDES := $(libgtest_host_includes)
Elliott Hughesfc2de662014-01-28 16:58:35 -080063LOCAL_CFLAGS += $(libgtest_cflags)
Nicolas Cataniacda9ca52010-02-22 11:28:02 -080064LOCAL_MODULE := libgtest_main_host
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070065
66include $(BUILD_HOST_STATIC_LIBRARY)
67
Nicolas Catania97bd2262010-02-09 11:44:38 -080068#######################################################################
69# gtest lib target
70
71include $(CLEAR_VARS)
72
Elliott Hughes142396e2014-01-28 22:53:45 -080073LOCAL_SDK_VERSION := 9
Ulas Kirazcidac60302012-09-26 16:58:37 -070074LOCAL_NDK_STL_VARIANT := stlport_static
75
Nicolas Catania97bd2262010-02-09 11:44:38 -080076LOCAL_CPP_EXTENSION := .cc
Nicolas Catania97bd2262010-02-09 11:44:38 -080077LOCAL_SRC_FILES := gtest-all.cc
Jesse Wilson1d24c642011-06-22 14:15:46 -070078LOCAL_C_INCLUDES := $(libgtest_target_includes)
Elliott Hughesfc2de662014-01-28 16:58:35 -080079LOCAL_CFLAGS += $(libgtest_cflags)
Nicolas Catania97bd2262010-02-09 11:44:38 -080080LOCAL_MODULE := libgtest
Nicolas Catania97bd2262010-02-09 11:44:38 -080081
82include $(BUILD_STATIC_LIBRARY)
83
84#######################################################################
85# gtest_main lib target
86
87include $(CLEAR_VARS)
88
Elliott Hughes142396e2014-01-28 22:53:45 -080089LOCAL_SDK_VERSION := 9
Ulas Kirazcidac60302012-09-26 16:58:37 -070090LOCAL_NDK_STL_VARIANT := stlport_static
91
Nicolas Catania97bd2262010-02-09 11:44:38 -080092LOCAL_CPP_EXTENSION := .cc
Nicolas Catania97bd2262010-02-09 11:44:38 -080093LOCAL_SRC_FILES := gtest_main.cc
Jesse Wilson1d24c642011-06-22 14:15:46 -070094LOCAL_C_INCLUDES := $(libgtest_target_includes)
Elliott Hughesfc2de662014-01-28 16:58:35 -080095LOCAL_CFLAGS += $(libgtest_cflags)
Nicolas Catania97bd2262010-02-09 11:44:38 -080096LOCAL_MODULE := libgtest_main
Nicolas Catania97bd2262010-02-09 11:44:38 -080097
98include $(BUILD_STATIC_LIBRARY)
Dan Albertd72b5dc2014-04-28 10:05:00 -070099
100#######################################################################
101# libc++
102
103#######################################################################
104# gtest lib host
105
106include $(CLEAR_VARS)
107
108LOCAL_CPP_EXTENSION := .cc
109LOCAL_SRC_FILES := gtest-all.cc
110LOCAL_C_INCLUDES := $(libgtest_host_includes)
111LOCAL_CFLAGS += $(libgtest_cflags)
112LOCAL_MODULE := libgtest_libc++_host
113
114include external/libcxx/libcxx.mk
115include $(BUILD_HOST_STATIC_LIBRARY)
116
117#######################################################################
118# gtest_main lib host
119
120include $(CLEAR_VARS)
121
122LOCAL_CPP_EXTENSION := .cc
123LOCAL_SRC_FILES := gtest_main.cc
124LOCAL_C_INCLUDES := $(libgtest_host_includes)
125LOCAL_CFLAGS += $(libgtest_cflags)
126LOCAL_MODULE := libgtest_main_libc++_host
127
128include external/libcxx/libcxx.mk
129include $(BUILD_HOST_STATIC_LIBRARY)
130
131#######################################################################
132# gtest lib target
133
134include $(CLEAR_VARS)
135
136LOCAL_CPP_EXTENSION := .cc
137LOCAL_SRC_FILES := gtest-all.cc
138LOCAL_C_INCLUDES := $(libgtest_target_includes)
139LOCAL_CFLAGS += $(libgtest_cflags)
140LOCAL_MODULE := libgtest_libc++
141
142include external/libcxx/libcxx.mk
143include $(BUILD_STATIC_LIBRARY)
144
145#######################################################################
146# gtest_main lib target
147
148include $(CLEAR_VARS)
149
150LOCAL_CPP_EXTENSION := .cc
151LOCAL_SRC_FILES := gtest_main.cc
152LOCAL_C_INCLUDES := $(libgtest_target_includes)
153LOCAL_CFLAGS += $(libgtest_cflags)
154LOCAL_MODULE := libgtest_main_libc++
155
156include external/libcxx/libcxx.mk
157include $(BUILD_STATIC_LIBRARY)