blob: d9ba471b3532a95d870e0c7cab3dd1d6727cb224 [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#######################################################################
Dan Albert56cad542014-11-20 11:21:27 -080043# gtest lib for the NDK
Nicolas Catania97bd2262010-02-09 11:44:38 -080044
45include $(CLEAR_VARS)
Dan Albertfde6da72014-10-21 11:17:18 -070046LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Nicolas Catania97bd2262010-02-09 11:44:38 -080047
Elliott Hughes142396e2014-01-28 22:53:45 -080048LOCAL_SDK_VERSION := 9
Ulas Kirazcidac60302012-09-26 16:58:37 -070049LOCAL_NDK_STL_VARIANT := stlport_static
50
Nicolas Catania97bd2262010-02-09 11:44:38 -080051LOCAL_CPP_EXTENSION := .cc
Nicolas Catania97bd2262010-02-09 11:44:38 -080052LOCAL_SRC_FILES := gtest-all.cc
Jesse Wilson1d24c642011-06-22 14:15:46 -070053LOCAL_C_INCLUDES := $(libgtest_target_includes)
Dan Albert56cad542014-11-20 11:21:27 -080054LOCAL_CPPFLAGS := -std=gnu++98
Elliott Hughesfc2de662014-01-28 16:58:35 -080055LOCAL_CFLAGS += $(libgtest_cflags)
Dan Albertce2c5232014-11-10 14:43:19 -080056LOCAL_MODULE := libgtest_ndk
Nicolas Catania97bd2262010-02-09 11:44:38 -080057
58include $(BUILD_STATIC_LIBRARY)
59
60#######################################################################
Dan Albert56cad542014-11-20 11:21:27 -080061# gtest_main for the NDK
Nicolas Catania97bd2262010-02-09 11:44:38 -080062
63include $(CLEAR_VARS)
Dan Albertfde6da72014-10-21 11:17:18 -070064LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Nicolas Catania97bd2262010-02-09 11:44:38 -080065
Elliott Hughes142396e2014-01-28 22:53:45 -080066LOCAL_SDK_VERSION := 9
Ulas Kirazcidac60302012-09-26 16:58:37 -070067LOCAL_NDK_STL_VARIANT := stlport_static
68
Nicolas Catania97bd2262010-02-09 11:44:38 -080069LOCAL_CPP_EXTENSION := .cc
Nicolas Catania97bd2262010-02-09 11:44:38 -080070LOCAL_SRC_FILES := gtest_main.cc
Jesse Wilson1d24c642011-06-22 14:15:46 -070071LOCAL_C_INCLUDES := $(libgtest_target_includes)
Dan Albert56cad542014-11-20 11:21:27 -080072LOCAL_CPPFLAGS := -std=gnu++98
Elliott Hughesfc2de662014-01-28 16:58:35 -080073LOCAL_CFLAGS += $(libgtest_cflags)
Dan Albertce2c5232014-11-10 14:43:19 -080074LOCAL_MODULE := libgtest_main_ndk
Nicolas Catania97bd2262010-02-09 11:44:38 -080075
76include $(BUILD_STATIC_LIBRARY)
Dan Albertd72b5dc2014-04-28 10:05:00 -070077
78#######################################################################
79# libc++
80
81#######################################################################
82# gtest lib host
83
84include $(CLEAR_VARS)
Dan Albertfde6da72014-10-21 11:17:18 -070085LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dan Albertd72b5dc2014-04-28 10:05:00 -070086
Dan Albertbe7f2ef2014-05-21 10:09:59 -070087LOCAL_CLANG := true
Dan Albertd72b5dc2014-04-28 10:05:00 -070088LOCAL_CPP_EXTENSION := .cc
89LOCAL_SRC_FILES := gtest-all.cc
90LOCAL_C_INCLUDES := $(libgtest_host_includes)
91LOCAL_CFLAGS += $(libgtest_cflags)
Dan Albertf694f2b2014-11-09 00:16:39 -080092LOCAL_MODULE := libgtest_host
Christopher Ferrise8981d12014-06-10 19:27:36 -070093LOCAL_MULTILIB := both
Dan Albertfde6da72014-10-21 11:17:18 -070094LOCAL_ADDRESS_SANITIZER := false
Dan Albertd72b5dc2014-04-28 10:05:00 -070095
Dan Albertd72b5dc2014-04-28 10:05:00 -070096include $(BUILD_HOST_STATIC_LIBRARY)
97
98#######################################################################
99# gtest_main lib host
100
101include $(CLEAR_VARS)
Dan Albertfde6da72014-10-21 11:17:18 -0700102LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dan Albertd72b5dc2014-04-28 10:05:00 -0700103
Dan Albertbe7f2ef2014-05-21 10:09:59 -0700104LOCAL_CLANG := true
Dan Albertd72b5dc2014-04-28 10:05:00 -0700105LOCAL_CPP_EXTENSION := .cc
106LOCAL_SRC_FILES := gtest_main.cc
107LOCAL_C_INCLUDES := $(libgtest_host_includes)
108LOCAL_CFLAGS += $(libgtest_cflags)
Dan Albertf694f2b2014-11-09 00:16:39 -0800109LOCAL_MODULE := libgtest_main_host
Christopher Ferrise8981d12014-06-10 19:27:36 -0700110LOCAL_MULTILIB := both
Dan Albertfde6da72014-10-21 11:17:18 -0700111LOCAL_ADDRESS_SANITIZER := false
Dan Albertd72b5dc2014-04-28 10:05:00 -0700112
Dan Albertd72b5dc2014-04-28 10:05:00 -0700113include $(BUILD_HOST_STATIC_LIBRARY)
114
115#######################################################################
Ying Wange826aa42015-05-27 16:43:12 -0700116# Don't build for unbundled branches
117ifeq (,$(TARGET_BUILD_APPS))
Dan Albertd72b5dc2014-04-28 10:05:00 -0700118# gtest lib target
119
120include $(CLEAR_VARS)
Dan Albertfde6da72014-10-21 11:17:18 -0700121LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dan Albertd72b5dc2014-04-28 10:05:00 -0700122
Dan Albertbe7f2ef2014-05-21 10:09:59 -0700123LOCAL_CLANG := true
Dan Albertd72b5dc2014-04-28 10:05:00 -0700124LOCAL_CPP_EXTENSION := .cc
125LOCAL_SRC_FILES := gtest-all.cc
126LOCAL_C_INCLUDES := $(libgtest_target_includes)
127LOCAL_CFLAGS += $(libgtest_cflags)
Dan Albertce2c5232014-11-10 14:43:19 -0800128LOCAL_MODULE := libgtest
Dan Albertfde6da72014-10-21 11:17:18 -0700129LOCAL_ADDRESS_SANITIZER := false
Dan Albertd72b5dc2014-04-28 10:05:00 -0700130
Dan Albertd72b5dc2014-04-28 10:05:00 -0700131include $(BUILD_STATIC_LIBRARY)
132
133#######################################################################
134# gtest_main lib target
135
136include $(CLEAR_VARS)
Dan Albertfde6da72014-10-21 11:17:18 -0700137LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dan Albertd72b5dc2014-04-28 10:05:00 -0700138
Dan Albertbe7f2ef2014-05-21 10:09:59 -0700139LOCAL_CLANG := true
Dan Albertd72b5dc2014-04-28 10:05:00 -0700140LOCAL_CPP_EXTENSION := .cc
141LOCAL_SRC_FILES := gtest_main.cc
142LOCAL_C_INCLUDES := $(libgtest_target_includes)
143LOCAL_CFLAGS += $(libgtest_cflags)
Dan Albertce2c5232014-11-10 14:43:19 -0800144LOCAL_MODULE := libgtest_main
Dan Albertfde6da72014-10-21 11:17:18 -0700145LOCAL_ADDRESS_SANITIZER := false
Dan Albertd72b5dc2014-04-28 10:05:00 -0700146
Dan Albertd72b5dc2014-04-28 10:05:00 -0700147include $(BUILD_STATIC_LIBRARY)
Dan Albert75949c62014-05-16 16:40:16 -0700148endif