1# 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 17# 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 23# it is running linux and using ASTL. 24# 25 26# TODO: The targets below have some redundancy. Check if we cannot 27# condense them using function(s) for the common code. 28 29LOCAL_PATH := $(call my-dir) 30 31libgtest_target_includes := \ 32 $(LOCAL_PATH)/.. \ 33 $(LOCAL_PATH)/../include \ 34 35libgtest_host_includes := \ 36 $(LOCAL_PATH)/.. \ 37 $(LOCAL_PATH)/../include \ 38 39libgtest_cflags := \ 40 -Wno-missing-field-initializers \ 41 42####################################################################### 43# gtest lib host 44 45include $(CLEAR_VARS) 46 47LOCAL_CPP_EXTENSION := .cc 48LOCAL_SRC_FILES := gtest-all.cc 49LOCAL_C_INCLUDES := $(libgtest_host_includes) 50LOCAL_CFLAGS += $(libgtest_cflags) 51LOCAL_MODULE := libgtest_host 52LOCAL_MULTILIB := both 53 54include $(BUILD_HOST_STATIC_LIBRARY) 55 56####################################################################### 57# gtest_main lib host 58 59include $(CLEAR_VARS) 60 61LOCAL_CPP_EXTENSION := .cc 62LOCAL_SRC_FILES := gtest_main.cc 63LOCAL_C_INCLUDES := $(libgtest_host_includes) 64LOCAL_CFLAGS += $(libgtest_cflags) 65LOCAL_MODULE := libgtest_main_host 66LOCAL_MULTILIB := both 67 68include $(BUILD_HOST_STATIC_LIBRARY) 69 70####################################################################### 71# gtest lib target 72 73include $(CLEAR_VARS) 74 75LOCAL_SDK_VERSION := 9 76LOCAL_NDK_STL_VARIANT := stlport_static 77 78LOCAL_CPP_EXTENSION := .cc 79LOCAL_SRC_FILES := gtest-all.cc 80LOCAL_C_INCLUDES := $(libgtest_target_includes) 81LOCAL_CFLAGS += $(libgtest_cflags) 82LOCAL_MODULE := libgtest 83 84include $(BUILD_STATIC_LIBRARY) 85 86####################################################################### 87# gtest_main lib target 88 89include $(CLEAR_VARS) 90 91LOCAL_SDK_VERSION := 9 92LOCAL_NDK_STL_VARIANT := stlport_static 93 94LOCAL_CPP_EXTENSION := .cc 95LOCAL_SRC_FILES := gtest_main.cc 96LOCAL_C_INCLUDES := $(libgtest_target_includes) 97LOCAL_CFLAGS += $(libgtest_cflags) 98LOCAL_MODULE := libgtest_main 99 100include $(BUILD_STATIC_LIBRARY) 101 102# Don't build for unbundled branches 103ifeq (,$(TARGET_BUILD_APPS)) 104####################################################################### 105# libc++ 106 107####################################################################### 108# gtest lib host 109 110include $(CLEAR_VARS) 111 112LOCAL_CLANG := true 113LOCAL_CPP_EXTENSION := .cc 114LOCAL_SRC_FILES := gtest-all.cc 115LOCAL_C_INCLUDES := $(libgtest_host_includes) 116LOCAL_CFLAGS += $(libgtest_cflags) 117LOCAL_MODULE := libgtest_libc++_host 118LOCAL_MULTILIB := both 119 120include external/libcxx/libcxx.mk 121include $(BUILD_HOST_STATIC_LIBRARY) 122 123####################################################################### 124# gtest_main lib host 125 126include $(CLEAR_VARS) 127 128LOCAL_CLANG := true 129LOCAL_CPP_EXTENSION := .cc 130LOCAL_SRC_FILES := gtest_main.cc 131LOCAL_C_INCLUDES := $(libgtest_host_includes) 132LOCAL_CFLAGS += $(libgtest_cflags) 133LOCAL_MODULE := libgtest_main_libc++_host 134LOCAL_MULTILIB := both 135 136include external/libcxx/libcxx.mk 137include $(BUILD_HOST_STATIC_LIBRARY) 138 139####################################################################### 140# gtest lib target 141 142include $(CLEAR_VARS) 143 144LOCAL_CLANG := true 145LOCAL_CPP_EXTENSION := .cc 146LOCAL_SRC_FILES := gtest-all.cc 147LOCAL_C_INCLUDES := $(libgtest_target_includes) 148LOCAL_CFLAGS += $(libgtest_cflags) 149LOCAL_MODULE := libgtest_libc++ 150 151include external/libcxx/libcxx.mk 152include $(BUILD_STATIC_LIBRARY) 153 154####################################################################### 155# gtest_main lib target 156 157include $(CLEAR_VARS) 158 159LOCAL_CLANG := true 160LOCAL_CPP_EXTENSION := .cc 161LOCAL_SRC_FILES := gtest_main.cc 162LOCAL_C_INCLUDES := $(libgtest_target_includes) 163LOCAL_CFLAGS += $(libgtest_cflags) 164LOCAL_MODULE := libgtest_main_libc++ 165 166include external/libcxx/libcxx.mk 167include $(BUILD_STATIC_LIBRARY) 168endif 169