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 | ####################################################################### |
Dan Albert | 56cad54 | 2014-11-20 11:21:27 -0800 | [diff] [blame] | 43 | # gtest lib for the NDK |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 44 | |
| 45 | include $(CLEAR_VARS) |
Dan Albert | fde6da7 | 2014-10-21 11:17:18 -0700 | [diff] [blame] | 46 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 47 | |
Elliott Hughes | 142396e | 2014-01-28 22:53:45 -0800 | [diff] [blame] | 48 | LOCAL_SDK_VERSION := 9 |
Ulas Kirazci | dac6030 | 2012-09-26 16:58:37 -0700 | [diff] [blame] | 49 | LOCAL_NDK_STL_VARIANT := stlport_static |
| 50 | |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 51 | LOCAL_CPP_EXTENSION := .cc |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 52 | LOCAL_SRC_FILES := gtest-all.cc |
Jesse Wilson | 1d24c64 | 2011-06-22 14:15:46 -0700 | [diff] [blame] | 53 | LOCAL_C_INCLUDES := $(libgtest_target_includes) |
Dan Albert | 56cad54 | 2014-11-20 11:21:27 -0800 | [diff] [blame] | 54 | LOCAL_CPPFLAGS := -std=gnu++98 |
Elliott Hughes | fc2de66 | 2014-01-28 16:58:35 -0800 | [diff] [blame] | 55 | LOCAL_CFLAGS += $(libgtest_cflags) |
Dan Albert | ce2c523 | 2014-11-10 14:43:19 -0800 | [diff] [blame] | 56 | LOCAL_MODULE := libgtest_ndk |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 57 | |
| 58 | include $(BUILD_STATIC_LIBRARY) |
| 59 | |
| 60 | ####################################################################### |
Dan Albert | 56cad54 | 2014-11-20 11:21:27 -0800 | [diff] [blame] | 61 | # gtest_main for the NDK |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 62 | |
| 63 | include $(CLEAR_VARS) |
Dan Albert | fde6da7 | 2014-10-21 11:17:18 -0700 | [diff] [blame] | 64 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 65 | |
Elliott Hughes | 142396e | 2014-01-28 22:53:45 -0800 | [diff] [blame] | 66 | LOCAL_SDK_VERSION := 9 |
Ulas Kirazci | dac6030 | 2012-09-26 16:58:37 -0700 | [diff] [blame] | 67 | LOCAL_NDK_STL_VARIANT := stlport_static |
| 68 | |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 69 | LOCAL_CPP_EXTENSION := .cc |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 70 | LOCAL_SRC_FILES := gtest_main.cc |
Jesse Wilson | 1d24c64 | 2011-06-22 14:15:46 -0700 | [diff] [blame] | 71 | LOCAL_C_INCLUDES := $(libgtest_target_includes) |
Dan Albert | 56cad54 | 2014-11-20 11:21:27 -0800 | [diff] [blame] | 72 | LOCAL_CPPFLAGS := -std=gnu++98 |
Elliott Hughes | fc2de66 | 2014-01-28 16:58:35 -0800 | [diff] [blame] | 73 | LOCAL_CFLAGS += $(libgtest_cflags) |
Dan Albert | ce2c523 | 2014-11-10 14:43:19 -0800 | [diff] [blame] | 74 | LOCAL_MODULE := libgtest_main_ndk |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 75 | |
| 76 | include $(BUILD_STATIC_LIBRARY) |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 77 | |
| 78 | ####################################################################### |
| 79 | # libc++ |
| 80 | |
| 81 | ####################################################################### |
| 82 | # gtest lib host |
| 83 | |
| 84 | include $(CLEAR_VARS) |
Dan Albert | fde6da7 | 2014-10-21 11:17:18 -0700 | [diff] [blame] | 85 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 86 | |
Dan Albert | be7f2ef | 2014-05-21 10:09:59 -0700 | [diff] [blame] | 87 | LOCAL_CLANG := true |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 88 | LOCAL_CPP_EXTENSION := .cc |
| 89 | LOCAL_SRC_FILES := gtest-all.cc |
| 90 | LOCAL_C_INCLUDES := $(libgtest_host_includes) |
| 91 | LOCAL_CFLAGS += $(libgtest_cflags) |
Dan Albert | f694f2b | 2014-11-09 00:16:39 -0800 | [diff] [blame] | 92 | LOCAL_MODULE := libgtest_host |
Christopher Ferris | e8981d1 | 2014-06-10 19:27:36 -0700 | [diff] [blame] | 93 | LOCAL_MULTILIB := both |
Dan Albert | fde6da7 | 2014-10-21 11:17:18 -0700 | [diff] [blame] | 94 | LOCAL_ADDRESS_SANITIZER := false |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 95 | |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 96 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 97 | |
| 98 | ####################################################################### |
| 99 | # gtest_main lib host |
| 100 | |
| 101 | include $(CLEAR_VARS) |
Dan Albert | fde6da7 | 2014-10-21 11:17:18 -0700 | [diff] [blame] | 102 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 103 | |
Dan Albert | be7f2ef | 2014-05-21 10:09:59 -0700 | [diff] [blame] | 104 | LOCAL_CLANG := true |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 105 | LOCAL_CPP_EXTENSION := .cc |
| 106 | LOCAL_SRC_FILES := gtest_main.cc |
| 107 | LOCAL_C_INCLUDES := $(libgtest_host_includes) |
| 108 | LOCAL_CFLAGS += $(libgtest_cflags) |
Dan Albert | f694f2b | 2014-11-09 00:16:39 -0800 | [diff] [blame] | 109 | LOCAL_MODULE := libgtest_main_host |
Christopher Ferris | e8981d1 | 2014-06-10 19:27:36 -0700 | [diff] [blame] | 110 | LOCAL_MULTILIB := both |
Dan Albert | fde6da7 | 2014-10-21 11:17:18 -0700 | [diff] [blame] | 111 | LOCAL_ADDRESS_SANITIZER := false |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 112 | |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 113 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 114 | |
| 115 | ####################################################################### |
Ying Wang | e826aa4 | 2015-05-27 16:43:12 -0700 | [diff] [blame] | 116 | # Don't build for unbundled branches |
| 117 | ifeq (,$(TARGET_BUILD_APPS)) |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 118 | # gtest lib target |
| 119 | |
| 120 | include $(CLEAR_VARS) |
Dan Albert | fde6da7 | 2014-10-21 11:17:18 -0700 | [diff] [blame] | 121 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 122 | |
Dan Albert | be7f2ef | 2014-05-21 10:09:59 -0700 | [diff] [blame] | 123 | LOCAL_CLANG := true |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 124 | LOCAL_CPP_EXTENSION := .cc |
| 125 | LOCAL_SRC_FILES := gtest-all.cc |
| 126 | LOCAL_C_INCLUDES := $(libgtest_target_includes) |
| 127 | LOCAL_CFLAGS += $(libgtest_cflags) |
Dan Albert | ce2c523 | 2014-11-10 14:43:19 -0800 | [diff] [blame] | 128 | LOCAL_MODULE := libgtest |
Dan Albert | fde6da7 | 2014-10-21 11:17:18 -0700 | [diff] [blame] | 129 | LOCAL_ADDRESS_SANITIZER := false |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 130 | |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 131 | include $(BUILD_STATIC_LIBRARY) |
| 132 | |
| 133 | ####################################################################### |
| 134 | # gtest_main lib target |
| 135 | |
| 136 | include $(CLEAR_VARS) |
Dan Albert | fde6da7 | 2014-10-21 11:17:18 -0700 | [diff] [blame] | 137 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 138 | |
Dan Albert | be7f2ef | 2014-05-21 10:09:59 -0700 | [diff] [blame] | 139 | LOCAL_CLANG := true |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 140 | LOCAL_CPP_EXTENSION := .cc |
| 141 | LOCAL_SRC_FILES := gtest_main.cc |
| 142 | LOCAL_C_INCLUDES := $(libgtest_target_includes) |
| 143 | LOCAL_CFLAGS += $(libgtest_cflags) |
Dan Albert | ce2c523 | 2014-11-10 14:43:19 -0800 | [diff] [blame] | 144 | LOCAL_MODULE := libgtest_main |
Dan Albert | fde6da7 | 2014-10-21 11:17:18 -0700 | [diff] [blame] | 145 | LOCAL_ADDRESS_SANITIZER := false |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 146 | |
Dan Albert | d72b5dc | 2014-04-28 10:05:00 -0700 | [diff] [blame] | 147 | include $(BUILD_STATIC_LIBRARY) |
Dan Albert | 75949c6 | 2014-05-16 16:40:16 -0700 | [diff] [blame] | 148 | endif |