blob: c86ef30214a9574d00ddbac0fe02eb65b0a3cba0 [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)
Dan Albertfde6da72014-10-21 11:17:18 -070046LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070047
48LOCAL_CPP_EXTENSION := .cc
Nicolas Catania97bd2262010-02-09 11:44:38 -080049LOCAL_SRC_FILES := gtest-all.cc
Jesse Wilson1d24c642011-06-22 14:15:46 -070050LOCAL_C_INCLUDES := $(libgtest_host_includes)
Elliott Hughesfc2de662014-01-28 16:58:35 -080051LOCAL_CFLAGS += $(libgtest_cflags)
Nicolas Cataniacda9ca52010-02-22 11:28:02 -080052LOCAL_MODULE := libgtest_host
Christopher Ferrise8981d12014-06-10 19:27:36 -070053LOCAL_MULTILIB := both
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070054
55include $(BUILD_HOST_STATIC_LIBRARY)
56
57#######################################################################
58# gtest_main lib host
59
60include $(CLEAR_VARS)
Dan Albertfde6da72014-10-21 11:17:18 -070061LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070062
63LOCAL_CPP_EXTENSION := .cc
Nicolas Catania97bd2262010-02-09 11:44:38 -080064LOCAL_SRC_FILES := gtest_main.cc
Jesse Wilson1d24c642011-06-22 14:15:46 -070065LOCAL_C_INCLUDES := $(libgtest_host_includes)
Elliott Hughesfc2de662014-01-28 16:58:35 -080066LOCAL_CFLAGS += $(libgtest_cflags)
Nicolas Cataniacda9ca52010-02-22 11:28:02 -080067LOCAL_MODULE := libgtest_main_host
Christopher Ferrise8981d12014-06-10 19:27:36 -070068LOCAL_MULTILIB := both
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070069
70include $(BUILD_HOST_STATIC_LIBRARY)
71
Nicolas Catania97bd2262010-02-09 11:44:38 -080072#######################################################################
73# gtest lib target
74
75include $(CLEAR_VARS)
Dan Albertfde6da72014-10-21 11:17:18 -070076LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Nicolas Catania97bd2262010-02-09 11:44:38 -080077
Elliott Hughes142396e2014-01-28 22:53:45 -080078LOCAL_SDK_VERSION := 9
Ulas Kirazcidac60302012-09-26 16:58:37 -070079LOCAL_NDK_STL_VARIANT := stlport_static
80
Nicolas Catania97bd2262010-02-09 11:44:38 -080081LOCAL_CPP_EXTENSION := .cc
Nicolas Catania97bd2262010-02-09 11:44:38 -080082LOCAL_SRC_FILES := gtest-all.cc
Jesse Wilson1d24c642011-06-22 14:15:46 -070083LOCAL_C_INCLUDES := $(libgtest_target_includes)
Elliott Hughesfc2de662014-01-28 16:58:35 -080084LOCAL_CFLAGS += $(libgtest_cflags)
Nicolas Catania97bd2262010-02-09 11:44:38 -080085LOCAL_MODULE := libgtest
Nicolas Catania97bd2262010-02-09 11:44:38 -080086
87include $(BUILD_STATIC_LIBRARY)
88
89#######################################################################
90# gtest_main lib target
91
92include $(CLEAR_VARS)
Dan Albertfde6da72014-10-21 11:17:18 -070093LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Nicolas Catania97bd2262010-02-09 11:44:38 -080094
Elliott Hughes142396e2014-01-28 22:53:45 -080095LOCAL_SDK_VERSION := 9
Ulas Kirazcidac60302012-09-26 16:58:37 -070096LOCAL_NDK_STL_VARIANT := stlport_static
97
Nicolas Catania97bd2262010-02-09 11:44:38 -080098LOCAL_CPP_EXTENSION := .cc
Nicolas Catania97bd2262010-02-09 11:44:38 -080099LOCAL_SRC_FILES := gtest_main.cc
Jesse Wilson1d24c642011-06-22 14:15:46 -0700100LOCAL_C_INCLUDES := $(libgtest_target_includes)
Elliott Hughesfc2de662014-01-28 16:58:35 -0800101LOCAL_CFLAGS += $(libgtest_cflags)
Nicolas Catania97bd2262010-02-09 11:44:38 -0800102LOCAL_MODULE := libgtest_main
Nicolas Catania97bd2262010-02-09 11:44:38 -0800103
104include $(BUILD_STATIC_LIBRARY)
Dan Albertd72b5dc2014-04-28 10:05:00 -0700105
Dan Albert75949c62014-05-16 16:40:16 -0700106# Don't build for unbundled branches
107ifeq (,$(TARGET_BUILD_APPS))
Dan Albertd72b5dc2014-04-28 10:05:00 -0700108#######################################################################
109# libc++
110
111#######################################################################
112# gtest lib host
113
114include $(CLEAR_VARS)
Dan Albertfde6da72014-10-21 11:17:18 -0700115LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dan Albertd72b5dc2014-04-28 10:05:00 -0700116
Dan Albertbe7f2ef2014-05-21 10:09:59 -0700117LOCAL_CLANG := true
Dan Albertd72b5dc2014-04-28 10:05:00 -0700118LOCAL_CPP_EXTENSION := .cc
119LOCAL_SRC_FILES := gtest-all.cc
120LOCAL_C_INCLUDES := $(libgtest_host_includes)
121LOCAL_CFLAGS += $(libgtest_cflags)
122LOCAL_MODULE := libgtest_libc++_host
Christopher Ferrise8981d12014-06-10 19:27:36 -0700123LOCAL_MULTILIB := both
Dan Albertfde6da72014-10-21 11:17:18 -0700124LOCAL_ADDRESS_SANITIZER := false
Dan Albertd72b5dc2014-04-28 10:05:00 -0700125
126include external/libcxx/libcxx.mk
127include $(BUILD_HOST_STATIC_LIBRARY)
128
129#######################################################################
130# gtest_main lib host
131
132include $(CLEAR_VARS)
Dan Albertfde6da72014-10-21 11:17:18 -0700133LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dan Albertd72b5dc2014-04-28 10:05:00 -0700134
Dan Albertbe7f2ef2014-05-21 10:09:59 -0700135LOCAL_CLANG := true
Dan Albertd72b5dc2014-04-28 10:05:00 -0700136LOCAL_CPP_EXTENSION := .cc
137LOCAL_SRC_FILES := gtest_main.cc
138LOCAL_C_INCLUDES := $(libgtest_host_includes)
139LOCAL_CFLAGS += $(libgtest_cflags)
140LOCAL_MODULE := libgtest_main_libc++_host
Christopher Ferrise8981d12014-06-10 19:27:36 -0700141LOCAL_MULTILIB := both
Dan Albertfde6da72014-10-21 11:17:18 -0700142LOCAL_ADDRESS_SANITIZER := false
Dan Albertd72b5dc2014-04-28 10:05:00 -0700143
144include external/libcxx/libcxx.mk
145include $(BUILD_HOST_STATIC_LIBRARY)
146
147#######################################################################
148# gtest lib target
149
150include $(CLEAR_VARS)
Dan Albertfde6da72014-10-21 11:17:18 -0700151LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dan Albertd72b5dc2014-04-28 10:05:00 -0700152
Dan Albertbe7f2ef2014-05-21 10:09:59 -0700153LOCAL_CLANG := true
Dan Albertd72b5dc2014-04-28 10:05:00 -0700154LOCAL_CPP_EXTENSION := .cc
155LOCAL_SRC_FILES := gtest-all.cc
156LOCAL_C_INCLUDES := $(libgtest_target_includes)
157LOCAL_CFLAGS += $(libgtest_cflags)
158LOCAL_MODULE := libgtest_libc++
Dan Albertfde6da72014-10-21 11:17:18 -0700159LOCAL_ADDRESS_SANITIZER := false
Dan Albertd72b5dc2014-04-28 10:05:00 -0700160
161include external/libcxx/libcxx.mk
162include $(BUILD_STATIC_LIBRARY)
163
164#######################################################################
165# gtest_main lib target
166
167include $(CLEAR_VARS)
Dan Albertfde6da72014-10-21 11:17:18 -0700168LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dan Albertd72b5dc2014-04-28 10:05:00 -0700169
Dan Albertbe7f2ef2014-05-21 10:09:59 -0700170LOCAL_CLANG := true
Dan Albertd72b5dc2014-04-28 10:05:00 -0700171LOCAL_CPP_EXTENSION := .cc
172LOCAL_SRC_FILES := gtest_main.cc
173LOCAL_C_INCLUDES := $(libgtest_target_includes)
174LOCAL_CFLAGS += $(libgtest_cflags)
175LOCAL_MODULE := libgtest_main_libc++
Dan Albertfde6da72014-10-21 11:17:18 -0700176LOCAL_ADDRESS_SANITIZER := false
Dan Albertd72b5dc2014-04-28 10:05:00 -0700177
178include external/libcxx/libcxx.mk
179include $(BUILD_STATIC_LIBRARY)
Dan Albert75949c62014-05-16 16:40:16 -0700180endif