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