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 | |
Nicolas Catania | cda9ca5 | 2010-02-22 11:28:02 -0800 | [diff] [blame] | 31 | ifeq ($(BUILD_WITH_ASTL),true) |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 32 | libgtest_includes:= \ |
| 33 | bionic/libstdc++/include \ |
| 34 | external/astl/include \ |
| 35 | $(LOCAL_PATH)/.. \ |
| 36 | $(LOCAL_PATH)/../include |
Nicolas Catania | cda9ca5 | 2010-02-22 11:28:02 -0800 | [diff] [blame] | 37 | else |
| 38 | # BUILD_WITH_ASTL could be undefined, force it to false. |
| 39 | BUILD_WITH_ASTL := false |
| 40 | libgtest_includes := \ |
| 41 | bionic \ |
| 42 | external/stlport/stlport \ |
| 43 | $(LOCAL_PATH)/.. \ |
| 44 | $(LOCAL_PATH)/../include |
| 45 | endif |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 46 | |
Nicolas Catania | cda9ca5 | 2010-02-22 11:28:02 -0800 | [diff] [blame] | 47 | # Gtest depends on STLPort which does not build on host/simulator. |
| 48 | ifeq ($(HOST_OS)-$(BUILD_WITH_ASTL),linux-true) |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 49 | |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 50 | ####################################################################### |
| 51 | # gtest lib host |
| 52 | |
| 53 | include $(CLEAR_VARS) |
| 54 | |
| 55 | LOCAL_CPP_EXTENSION := .cc |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 56 | |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 57 | LOCAL_SRC_FILES := gtest-all.cc |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 58 | |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 59 | LOCAL_C_INCLUDES := $(libgtest_includes) |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 60 | |
Nicolas Catania | f6071db | 2009-06-24 08:24:18 -0700 | [diff] [blame] | 61 | LOCAL_CFLAGS += -O0 |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 62 | |
Nicolas Catania | cda9ca5 | 2010-02-22 11:28:02 -0800 | [diff] [blame] | 63 | LOCAL_MODULE := libgtest_host |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 64 | LOCAL_MODULE_TAGS := eng |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 65 | |
| 66 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 67 | |
| 68 | ####################################################################### |
| 69 | # gtest_main lib host |
| 70 | |
| 71 | include $(CLEAR_VARS) |
| 72 | |
| 73 | LOCAL_CPP_EXTENSION := .cc |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 74 | |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 75 | LOCAL_SRC_FILES := gtest_main.cc |
| 76 | |
| 77 | LOCAL_C_INCLUDES := $(libgtest_includes) |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 78 | |
Nicolas Catania | f6071db | 2009-06-24 08:24:18 -0700 | [diff] [blame] | 79 | LOCAL_CFLAGS += -O0 |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 80 | |
| 81 | LOCAL_STATIC_LIBRARIES := libgtest |
| 82 | |
Nicolas Catania | cda9ca5 | 2010-02-22 11:28:02 -0800 | [diff] [blame] | 83 | LOCAL_MODULE := libgtest_main_host |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 84 | LOCAL_MODULE_TAGS := eng |
| 85 | |
| 86 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 87 | |
| 88 | endif # HOST_OS == linux |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame] | 89 | |
| 90 | ####################################################################### |
| 91 | # gtest lib target |
| 92 | |
| 93 | include $(CLEAR_VARS) |
| 94 | |
| 95 | LOCAL_CPP_EXTENSION := .cc |
| 96 | |
| 97 | LOCAL_SRC_FILES := gtest-all.cc |
| 98 | |
| 99 | LOCAL_C_INCLUDES := $(libgtest_includes) |
| 100 | |
| 101 | LOCAL_MODULE := libgtest |
| 102 | LOCAL_MODULE_TAGS := eng |
| 103 | |
| 104 | include $(BUILD_STATIC_LIBRARY) |
| 105 | |
| 106 | ####################################################################### |
| 107 | # gtest_main lib target |
| 108 | |
| 109 | include $(CLEAR_VARS) |
| 110 | |
| 111 | LOCAL_CPP_EXTENSION := .cc |
| 112 | |
| 113 | LOCAL_SRC_FILES := gtest_main.cc |
| 114 | |
| 115 | LOCAL_C_INCLUDES := $(libgtest_includes) |
| 116 | |
| 117 | LOCAL_STATIC_LIBRARIES := libgtest |
| 118 | |
| 119 | LOCAL_MODULE := libgtest_main |
| 120 | LOCAL_MODULE_TAGS := eng |
| 121 | |
| 122 | include $(BUILD_STATIC_LIBRARY) |