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 |
| 23 | # it is running linux. The linux build and tests are run under |
| 24 | # valgrind by 'runtest'. |
| 25 | # |
| 26 | # Includes: |
| 27 | # * For a host build we need to specify bionic/libstdc++/include |
| 28 | # otherwise gcc will pick the system's STL. For targets build this |
| 29 | # is automatically done by the toolchain but we add it for the |
| 30 | # simulator builds.. |
| 31 | # * libjingle's include directives start at the 'talk' level which is |
| 32 | # 2 directories up. We use $(LOCAL_PATH) to get an absolute include |
| 33 | # path just in case talk has been symlinked. |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 34 | |
| 35 | LOCAL_PATH := $(call my-dir) |
| 36 | |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame^] | 37 | libgtest_includes:= \ |
| 38 | bionic/libstdc++/include \ |
| 39 | external/astl/include \ |
| 40 | $(LOCAL_PATH)/.. \ |
| 41 | $(LOCAL_PATH)/../include |
| 42 | |
| 43 | ifeq ($(HOST_OS),linux) |
| 44 | |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 45 | ####################################################################### |
| 46 | # gtest lib host |
| 47 | |
| 48 | include $(CLEAR_VARS) |
| 49 | |
| 50 | LOCAL_CPP_EXTENSION := .cc |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 51 | |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame^] | 52 | LOCAL_SRC_FILES := gtest-all.cc |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 53 | |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame^] | 54 | LOCAL_C_INCLUDES := $(libgtest_includes) |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 55 | |
Nicolas Catania | f6071db | 2009-06-24 08:24:18 -0700 | [diff] [blame] | 56 | LOCAL_CFLAGS += -O0 |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 57 | |
| 58 | LOCAL_MODULE := libgtest |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame^] | 59 | LOCAL_MODULE_TAGS := eng |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 60 | |
| 61 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 62 | |
| 63 | ####################################################################### |
| 64 | # gtest_main lib host |
| 65 | |
| 66 | include $(CLEAR_VARS) |
| 67 | |
| 68 | LOCAL_CPP_EXTENSION := .cc |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 69 | |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame^] | 70 | LOCAL_SRC_FILES := gtest_main.cc |
| 71 | |
| 72 | LOCAL_C_INCLUDES := $(libgtest_includes) |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 73 | |
Nicolas Catania | f6071db | 2009-06-24 08:24:18 -0700 | [diff] [blame] | 74 | LOCAL_CFLAGS += -O0 |
Nicolas Catania | 1be2c9d | 2009-05-28 19:30:30 -0700 | [diff] [blame] | 75 | |
| 76 | LOCAL_STATIC_LIBRARIES := libgtest |
| 77 | |
| 78 | LOCAL_MODULE := libgtest_main |
| 79 | LOCAL_MODULE_TAGS := eng |
| 80 | |
| 81 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 82 | |
| 83 | endif # HOST_OS == linux |
Nicolas Catania | 97bd226 | 2010-02-09 11:44:38 -0800 | [diff] [blame^] | 84 | |
| 85 | ####################################################################### |
| 86 | # gtest lib target |
| 87 | |
| 88 | include $(CLEAR_VARS) |
| 89 | |
| 90 | LOCAL_CPP_EXTENSION := .cc |
| 91 | |
| 92 | LOCAL_SRC_FILES := gtest-all.cc |
| 93 | |
| 94 | LOCAL_C_INCLUDES := $(libgtest_includes) |
| 95 | |
| 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 | |
| 110 | LOCAL_C_INCLUDES := $(libgtest_includes) |
| 111 | |
| 112 | LOCAL_STATIC_LIBRARIES := libgtest |
| 113 | |
| 114 | LOCAL_MODULE := libgtest_main |
| 115 | LOCAL_MODULE_TAGS := eng |
| 116 | |
| 117 | include $(BUILD_STATIC_LIBRARY) |