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 |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 52 | |
| 53 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 54 | |
| 55 | ####################################################################### |
| 56 | # gtest_main lib host |
| 57 | |
| 58 | include $(CLEAR_VARS) |
| 59 | |
| 60 | LOCAL_CPP_EXTENSION := .cc |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 61 | LOCAL_SRC_FILES := gtest_main.cc |
Jesse Wilson | 1d24c64 | 2011-06-22 14:15:46 -0700 | [diff] [blame] | 62 | LOCAL_C_INCLUDES := $(libgtest_host_includes) |
Elliott Hughes | fc2de66 | 2014-01-28 16:58:35 -0800 | [diff] [blame] | 63 | LOCAL_CFLAGS += $(libgtest_cflags) |
Nicolas Catania | cda9ca5 | 2010-02-22 11:28:02 -0800 | [diff] [blame] | 64 | LOCAL_MODULE := libgtest_main_host |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 65 | |
| 66 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 67 | |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 68 | ####################################################################### |
| 69 | # gtest lib target |
| 70 | |
| 71 | include $(CLEAR_VARS) |
| 72 | |
Elliott Hughes | 142396e | 2014-01-28 22:53:45 -0800 | [diff] [blame] | 73 | LOCAL_SDK_VERSION := 9 |
Ulas Kirazci | dac6030 | 2012-09-26 16:58:37 -0700 | [diff] [blame] | 74 | LOCAL_NDK_STL_VARIANT := stlport_static |
| 75 | |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 76 | LOCAL_CPP_EXTENSION := .cc |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 77 | LOCAL_SRC_FILES := gtest-all.cc |
Jesse Wilson | 1d24c64 | 2011-06-22 14:15:46 -0700 | [diff] [blame] | 78 | LOCAL_C_INCLUDES := $(libgtest_target_includes) |
Elliott Hughes | fc2de66 | 2014-01-28 16:58:35 -0800 | [diff] [blame] | 79 | LOCAL_CFLAGS += $(libgtest_cflags) |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 80 | LOCAL_MODULE := libgtest |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 81 | |
| 82 | include $(BUILD_STATIC_LIBRARY) |
| 83 | |
| 84 | ####################################################################### |
| 85 | # gtest_main lib target |
| 86 | |
| 87 | include $(CLEAR_VARS) |
| 88 | |
Elliott Hughes | 142396e | 2014-01-28 22:53:45 -0800 | [diff] [blame] | 89 | LOCAL_SDK_VERSION := 9 |
Ulas Kirazci | dac6030 | 2012-09-26 16:58:37 -0700 | [diff] [blame] | 90 | LOCAL_NDK_STL_VARIANT := stlport_static |
| 91 | |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 92 | LOCAL_CPP_EXTENSION := .cc |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 93 | LOCAL_SRC_FILES := gtest_main.cc |
Jesse Wilson | 1d24c64 | 2011-06-22 14:15:46 -0700 | [diff] [blame] | 94 | LOCAL_C_INCLUDES := $(libgtest_target_includes) |
Elliott Hughes | fc2de66 | 2014-01-28 16:58:35 -0800 | [diff] [blame] | 95 | LOCAL_CFLAGS += $(libgtest_cflags) |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 96 | LOCAL_MODULE := libgtest_main |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 97 | |
| 98 | include $(BUILD_STATIC_LIBRARY) |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame^] | 99 | |
| 100 | ####################################################################### |
| 101 | # libc++ |
| 102 | |
| 103 | ####################################################################### |
| 104 | # gtest lib host |
| 105 | |
| 106 | include $(CLEAR_VARS) |
| 107 | |
| 108 | LOCAL_CPP_EXTENSION := .cc |
| 109 | LOCAL_SRC_FILES := gtest-all.cc |
| 110 | LOCAL_C_INCLUDES := $(libgtest_host_includes) |
| 111 | LOCAL_CFLAGS += $(libgtest_cflags) |
| 112 | LOCAL_MODULE := libgtest_libc++_host |
| 113 | |
| 114 | include external/libcxx/libcxx.mk |
| 115 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 116 | |
| 117 | ####################################################################### |
| 118 | # gtest_main lib host |
| 119 | |
| 120 | include $(CLEAR_VARS) |
| 121 | |
| 122 | LOCAL_CPP_EXTENSION := .cc |
| 123 | LOCAL_SRC_FILES := gtest_main.cc |
| 124 | LOCAL_C_INCLUDES := $(libgtest_host_includes) |
| 125 | LOCAL_CFLAGS += $(libgtest_cflags) |
| 126 | LOCAL_MODULE := libgtest_main_libc++_host |
| 127 | |
| 128 | include external/libcxx/libcxx.mk |
| 129 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 130 | |
| 131 | ####################################################################### |
| 132 | # gtest lib target |
| 133 | |
| 134 | include $(CLEAR_VARS) |
| 135 | |
| 136 | LOCAL_CPP_EXTENSION := .cc |
| 137 | LOCAL_SRC_FILES := gtest-all.cc |
| 138 | LOCAL_C_INCLUDES := $(libgtest_target_includes) |
| 139 | LOCAL_CFLAGS += $(libgtest_cflags) |
| 140 | LOCAL_MODULE := libgtest_libc++ |
| 141 | |
| 142 | include external/libcxx/libcxx.mk |
| 143 | include $(BUILD_STATIC_LIBRARY) |
| 144 | |
| 145 | ####################################################################### |
| 146 | # gtest_main lib target |
| 147 | |
| 148 | include $(CLEAR_VARS) |
| 149 | |
| 150 | LOCAL_CPP_EXTENSION := .cc |
| 151 | LOCAL_SRC_FILES := gtest_main.cc |
| 152 | LOCAL_C_INCLUDES := $(libgtest_target_includes) |
| 153 | LOCAL_CFLAGS += $(libgtest_cflags) |
| 154 | LOCAL_MODULE := libgtest_main_libc++ |
| 155 | |
| 156 | include external/libcxx/libcxx.mk |
| 157 | include $(BUILD_STATIC_LIBRARY) |