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 := \ |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 32 | bionic/libstdc++/include \ |
Jesse Wilson | 1d24c64 | 2011-06-22 14:15:46 -0700 | [diff] [blame^] | 33 | external/stlport/stlport \ |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 34 | $(LOCAL_PATH)/.. \ |
| 35 | $(LOCAL_PATH)/../include |
Jesse Wilson | 1d24c64 | 2011-06-22 14:15:46 -0700 | [diff] [blame^] | 36 | |
| 37 | libgtest_host_includes := \ |
| 38 | $(LOCAL_PATH)/.. \ |
| 39 | $(LOCAL_PATH)/../include |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 40 | |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 41 | ####################################################################### |
| 42 | # gtest lib host |
| 43 | |
| 44 | include $(CLEAR_VARS) |
| 45 | |
| 46 | LOCAL_CPP_EXTENSION := .cc |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 47 | |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 48 | LOCAL_SRC_FILES := gtest-all.cc |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 49 | |
Jesse Wilson | 1d24c64 | 2011-06-22 14:15:46 -0700 | [diff] [blame^] | 50 | LOCAL_C_INCLUDES := $(libgtest_host_includes) |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 51 | |
Nicolas Catania | f6071db | 2009-06-24 08:24:18 -0700 | [diff] [blame] | 52 | LOCAL_CFLAGS += -O0 |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 53 | |
Nicolas Catania | cda9ca5 | 2010-02-22 11:28:02 -0800 | [diff] [blame] | 54 | LOCAL_MODULE := libgtest_host |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 55 | LOCAL_MODULE_TAGS := eng |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 56 | |
| 57 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 58 | |
| 59 | ####################################################################### |
| 60 | # gtest_main lib host |
| 61 | |
| 62 | include $(CLEAR_VARS) |
| 63 | |
| 64 | LOCAL_CPP_EXTENSION := .cc |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 65 | |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 66 | LOCAL_SRC_FILES := gtest_main.cc |
| 67 | |
Jesse Wilson | 1d24c64 | 2011-06-22 14:15:46 -0700 | [diff] [blame^] | 68 | LOCAL_C_INCLUDES := $(libgtest_host_includes) |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 69 | |
Nicolas Catania | f6071db | 2009-06-24 08:24:18 -0700 | [diff] [blame] | 70 | LOCAL_CFLAGS += -O0 |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 71 | |
| 72 | LOCAL_STATIC_LIBRARIES := libgtest |
| 73 | |
Nicolas Catania | cda9ca5 | 2010-02-22 11:28:02 -0800 | [diff] [blame] | 74 | LOCAL_MODULE := libgtest_main_host |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 75 | LOCAL_MODULE_TAGS := eng |
| 76 | |
| 77 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 78 | |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 79 | ####################################################################### |
| 80 | # gtest lib target |
| 81 | |
| 82 | include $(CLEAR_VARS) |
| 83 | |
| 84 | LOCAL_CPP_EXTENSION := .cc |
| 85 | |
| 86 | LOCAL_SRC_FILES := gtest-all.cc |
| 87 | |
Jesse Wilson | 1d24c64 | 2011-06-22 14:15:46 -0700 | [diff] [blame^] | 88 | LOCAL_C_INCLUDES := $(libgtest_target_includes) |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 89 | |
Patrick Scott | 40b3718 | 2010-10-01 14:11:39 -0400 | [diff] [blame] | 90 | ifneq ($(BUILD_WITH_ASTL),true) |
| 91 | ifneq ($(TARGET_SIMULATOR),true) |
| 92 | include external/stlport/libstlport.mk |
| 93 | endif |
| 94 | endif |
| 95 | |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 96 | LOCAL_MODULE := libgtest |
| 97 | LOCAL_MODULE_TAGS := eng |
| 98 | |
| 99 | include $(BUILD_STATIC_LIBRARY) |
| 100 | |
| 101 | ####################################################################### |
| 102 | # gtest_main lib target |
| 103 | |
| 104 | include $(CLEAR_VARS) |
| 105 | |
| 106 | LOCAL_CPP_EXTENSION := .cc |
| 107 | |
| 108 | LOCAL_SRC_FILES := gtest_main.cc |
| 109 | |
Jesse Wilson | 1d24c64 | 2011-06-22 14:15:46 -0700 | [diff] [blame^] | 110 | LOCAL_C_INCLUDES := $(libgtest_target_includes) |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 111 | |
Patrick Scott | 40b3718 | 2010-10-01 14:11:39 -0400 | [diff] [blame] | 112 | ifneq ($(BUILD_WITH_ASTL),true) |
| 113 | ifneq ($(TARGET_SIMULATOR),true) |
| 114 | include external/stlport/libstlport.mk |
| 115 | endif |
| 116 | endif |
| 117 | |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 118 | LOCAL_STATIC_LIBRARIES := libgtest |
| 119 | |
| 120 | LOCAL_MODULE := libgtest_main |
| 121 | LOCAL_MODULE_TAGS := eng |
| 122 | |
| 123 | include $(BUILD_STATIC_LIBRARY) |