Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2015 The Android Open Source Project |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | // |
| 16 | |
| 17 | libbase_cppflags = [ |
| 18 | "-Wall", |
| 19 | "-Wextra", |
| 20 | "-Werror", |
| 21 | ] |
| 22 | |
Steven Moreland | 3c71bbd | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 23 | cc_library_headers { |
| 24 | name: "libbase_headers", |
| 25 | vendor_available: true, |
| 26 | host_supported: true, |
| 27 | export_include_dirs: ["include"], |
| 28 | |
| 29 | header_libs: ["libutils_headers"], |
| 30 | export_header_lib_headers: ["libutils_headers"], |
| 31 | |
| 32 | target: { |
| 33 | linux_bionic: { |
| 34 | enabled: true, |
| 35 | }, |
| 36 | windows: { |
| 37 | enabled: true, |
| 38 | }, |
| 39 | }, |
| 40 | } |
| 41 | |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 42 | cc_library { |
| 43 | name: "libbase", |
| 44 | clang: true, |
| 45 | host_supported: true, |
| 46 | srcs: [ |
| 47 | "file.cpp", |
| 48 | "logging.cpp", |
| 49 | "parsenetaddress.cpp", |
Josh Gao | 0c44256 | 2016-09-13 14:50:57 -0700 | [diff] [blame] | 50 | "quick_exit.cpp", |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 51 | "stringprintf.cpp", |
| 52 | "strings.cpp", |
| 53 | "test_utils.cpp", |
| 54 | ], |
Steven Moreland | 3c71bbd | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 55 | |
| 56 | header_libs: ["libbase_headers"], |
| 57 | export_header_lib_headers: ["libbase_headers"], |
| 58 | |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 59 | cppflags: libbase_cppflags, |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 60 | shared_libs: ["liblog"], |
| 61 | target: { |
| 62 | android: { |
Elliott Hughes | 1e88c8c | 2016-09-21 16:53:15 -0700 | [diff] [blame] | 63 | srcs: [ |
| 64 | "errors_unix.cpp", |
| 65 | "properties.cpp", |
James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 66 | "chrono_utils.cpp", |
Elliott Hughes | 1e88c8c | 2016-09-21 16:53:15 -0700 | [diff] [blame] | 67 | ], |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 68 | cppflags: ["-Wexit-time-destructors"], |
Elliott Hughes | ec46f4e | 2017-02-14 15:46:33 -0800 | [diff] [blame] | 69 | sanitize: { |
| 70 | misc_undefined: ["integer"], |
| 71 | }, |
James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 72 | |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 73 | }, |
| 74 | darwin: { |
James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 75 | srcs: [ |
| 76 | "chrono_utils.cpp", |
| 77 | "errors_unix.cpp", |
| 78 | ], |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 79 | cppflags: ["-Wexit-time-destructors"], |
| 80 | }, |
Dan Willemsen | ab34b47 | 2016-11-29 13:32:55 -0800 | [diff] [blame] | 81 | linux_bionic: { |
James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 82 | srcs: [ |
| 83 | "chrono_utils.cpp", |
| 84 | "errors_unix.cpp", |
| 85 | ], |
Dan Willemsen | ab34b47 | 2016-11-29 13:32:55 -0800 | [diff] [blame] | 86 | cppflags: ["-Wexit-time-destructors"], |
| 87 | enabled: true, |
| 88 | }, |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 89 | linux: { |
James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 90 | srcs: [ |
| 91 | "chrono_utils.cpp", |
| 92 | "errors_unix.cpp", |
| 93 | ], |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 94 | cppflags: ["-Wexit-time-destructors"], |
James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 95 | host_ldlibs: ["-lrt"], |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 96 | }, |
| 97 | windows: { |
| 98 | srcs: [ |
| 99 | "errors_windows.cpp", |
| 100 | "utf8.cpp", |
| 101 | ], |
| 102 | enabled: true, |
| 103 | }, |
| 104 | }, |
| 105 | } |
| 106 | |
| 107 | // Tests |
| 108 | // ------------------------------------------------------------------------------ |
| 109 | cc_test { |
| 110 | name: "libbase_test", |
| 111 | host_supported: true, |
| 112 | clang: true, |
| 113 | srcs: [ |
Elliott Hughes | 1dbd976 | 2017-02-24 14:02:05 -0800 | [diff] [blame] | 114 | "endian_test.cpp", |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 115 | "errors_test.cpp", |
| 116 | "file_test.cpp", |
| 117 | "logging_test.cpp", |
Yabin Cui | 997cba4 | 2016-10-05 10:54:35 -0700 | [diff] [blame] | 118 | "parsedouble_test.cpp", |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 119 | "parseint_test.cpp", |
| 120 | "parsenetaddress_test.cpp", |
Josh Gao | 0c44256 | 2016-09-13 14:50:57 -0700 | [diff] [blame] | 121 | "quick_exit_test.cpp", |
Tom Cherry | c996a8e | 2017-04-05 14:15:31 -0700 | [diff] [blame] | 122 | "scopeguard_test.cpp", |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 123 | "stringprintf_test.cpp", |
| 124 | "strings_test.cpp", |
| 125 | "test_main.cpp", |
| 126 | ], |
| 127 | target: { |
Elliott Hughes | 1e88c8c | 2016-09-21 16:53:15 -0700 | [diff] [blame] | 128 | android: { |
James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 129 | srcs: [ |
| 130 | "chrono_utils_test.cpp", |
| 131 | "properties_test.cpp" |
| 132 | ], |
Elliott Hughes | ec46f4e | 2017-02-14 15:46:33 -0800 | [diff] [blame] | 133 | sanitize: { |
| 134 | misc_undefined: ["integer"], |
| 135 | }, |
Elliott Hughes | 1e88c8c | 2016-09-21 16:53:15 -0700 | [diff] [blame] | 136 | }, |
James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 137 | linux: { |
| 138 | srcs: ["chrono_utils_test.cpp"], |
| 139 | host_ldlibs: ["-lrt"], |
| 140 | }, |
Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 141 | windows: { |
| 142 | srcs: ["utf8_test.cpp"], |
| 143 | enabled: true, |
| 144 | }, |
| 145 | }, |
| 146 | local_include_dirs: ["."], |
| 147 | cppflags: libbase_cppflags, |
| 148 | shared_libs: ["libbase"], |
| 149 | compile_multilib: "both", |
| 150 | multilib: { |
| 151 | lib32: { |
| 152 | suffix: "32", |
| 153 | }, |
| 154 | lib64: { |
| 155 | suffix: "64", |
| 156 | }, |
| 157 | }, |
| 158 | } |