blob: 52c8a0a80b93db573dd7fa3988b73544e4ea25df [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 $(LOCAL_PATH)/.. \
33 $(LOCAL_PATH)/../include
Jesse Wilson1d24c642011-06-22 14:15:46 -070034
35libgtest_host_includes := \
36 $(LOCAL_PATH)/.. \
37 $(LOCAL_PATH)/../include
Nicolas Catania97bd2262010-02-09 11:44:38 -080038
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070039#######################################################################
40# gtest lib host
41
42include $(CLEAR_VARS)
43
44LOCAL_CPP_EXTENSION := .cc
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070045
Nicolas Catania97bd2262010-02-09 11:44:38 -080046LOCAL_SRC_FILES := gtest-all.cc
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070047
Jesse Wilson1d24c642011-06-22 14:15:46 -070048LOCAL_C_INCLUDES := $(libgtest_host_includes)
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070049
Nicolas Cataniaf6071db2009-06-24 08:24:18 -070050LOCAL_CFLAGS += -O0
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070051
Nicolas Cataniacda9ca52010-02-22 11:28:02 -080052LOCAL_MODULE := libgtest_host
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070053
54include $(BUILD_HOST_STATIC_LIBRARY)
55
56#######################################################################
57# gtest_main lib host
58
59include $(CLEAR_VARS)
60
61LOCAL_CPP_EXTENSION := .cc
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070062
Nicolas Catania97bd2262010-02-09 11:44:38 -080063LOCAL_SRC_FILES := gtest_main.cc
64
Jesse Wilson1d24c642011-06-22 14:15:46 -070065LOCAL_C_INCLUDES := $(libgtest_host_includes)
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070066
Nicolas Cataniaf6071db2009-06-24 08:24:18 -070067LOCAL_CFLAGS += -O0
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070068
Nicolas Cataniacda9ca52010-02-22 11:28:02 -080069LOCAL_MODULE := libgtest_main_host
Nicolas Catania1be2c9d2009-05-28 19:30:30 -070070
71include $(BUILD_HOST_STATIC_LIBRARY)
72
Nicolas Catania97bd2262010-02-09 11:44:38 -080073#######################################################################
74# gtest lib target
75
76include $(CLEAR_VARS)
77
Ulas Kirazcidac60302012-09-26 16:58:37 -070078ifeq ($(TARGET_ARCH), arm)
79 LOCAL_SDK_VERSION := 8
80else
81# NDK support of other archs (ie. x86 and mips) are only available after android-9
82 LOCAL_SDK_VERSION := 9
83endif
84
85LOCAL_NDK_STL_VARIANT := stlport_static
86
Nicolas Catania97bd2262010-02-09 11:44:38 -080087LOCAL_CPP_EXTENSION := .cc
88
89LOCAL_SRC_FILES := gtest-all.cc
90
Jesse Wilson1d24c642011-06-22 14:15:46 -070091LOCAL_C_INCLUDES := $(libgtest_target_includes)
Nicolas Catania97bd2262010-02-09 11:44:38 -080092
93LOCAL_MODULE := libgtest
Nicolas Catania97bd2262010-02-09 11:44:38 -080094
95include $(BUILD_STATIC_LIBRARY)
96
97#######################################################################
98# gtest_main lib target
99
100include $(CLEAR_VARS)
101
Ulas Kirazcidac60302012-09-26 16:58:37 -0700102ifeq ($(TARGET_ARCH), arm)
103 LOCAL_SDK_VERSION := 8
104else
105# NDK support of other archs (ie. x86 and mips) are only available after android-9
106 LOCAL_SDK_VERSION := 9
107endif
108
109LOCAL_NDK_STL_VARIANT := stlport_static
110
Nicolas Catania97bd2262010-02-09 11:44:38 -0800111LOCAL_CPP_EXTENSION := .cc
112
113LOCAL_SRC_FILES := gtest_main.cc
114
Jesse Wilson1d24c642011-06-22 14:15:46 -0700115LOCAL_C_INCLUDES := $(libgtest_target_includes)
Nicolas Catania97bd2262010-02-09 11:44:38 -0800116
Nicolas Catania97bd2262010-02-09 11:44:38 -0800117LOCAL_MODULE := libgtest_main
Nicolas Catania97bd2262010-02-09 11:44:38 -0800118
119include $(BUILD_STATIC_LIBRARY)