| 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 |  | 
|  | 23 | cc_library { | 
|  | 24 | name: "libbase", | 
|  | 25 | clang: true, | 
|  | 26 | host_supported: true, | 
|  | 27 | srcs: [ | 
|  | 28 | "file.cpp", | 
|  | 29 | "logging.cpp", | 
|  | 30 | "parsenetaddress.cpp", | 
| Josh Gao | 0c44256 | 2016-09-13 14:50:57 -0700 | [diff] [blame] | 31 | "quick_exit.cpp", | 
| Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 32 | "stringprintf.cpp", | 
|  | 33 | "strings.cpp", | 
|  | 34 | "test_utils.cpp", | 
|  | 35 | ], | 
|  | 36 | local_include_dirs: ["include"], | 
|  | 37 | cppflags: libbase_cppflags, | 
|  | 38 | export_include_dirs: ["include"], | 
|  | 39 | shared_libs: ["liblog"], | 
|  | 40 | target: { | 
|  | 41 | android: { | 
| Elliott Hughes | 1e88c8c | 2016-09-21 16:53:15 -0700 | [diff] [blame] | 42 | srcs: [ | 
|  | 43 | "errors_unix.cpp", | 
|  | 44 | "properties.cpp", | 
| James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 45 | "chrono_utils.cpp", | 
| Elliott Hughes | 1e88c8c | 2016-09-21 16:53:15 -0700 | [diff] [blame] | 46 | ], | 
| Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 47 | cppflags: ["-Wexit-time-destructors"], | 
| Elliott Hughes | ec46f4e | 2017-02-14 15:46:33 -0800 | [diff] [blame] | 48 | sanitize: { | 
|  | 49 | misc_undefined: ["integer"], | 
|  | 50 | }, | 
| James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 51 |  | 
| Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 52 | }, | 
|  | 53 | darwin: { | 
| James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 54 | srcs: [ | 
|  | 55 | "chrono_utils.cpp", | 
|  | 56 | "errors_unix.cpp", | 
|  | 57 | ], | 
| Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 58 | cppflags: ["-Wexit-time-destructors"], | 
|  | 59 | }, | 
| Dan Willemsen | ab34b47 | 2016-11-29 13:32:55 -0800 | [diff] [blame] | 60 | linux_bionic: { | 
| James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 61 | srcs: [ | 
|  | 62 | "chrono_utils.cpp", | 
|  | 63 | "errors_unix.cpp", | 
|  | 64 | ], | 
| Dan Willemsen | ab34b47 | 2016-11-29 13:32:55 -0800 | [diff] [blame] | 65 | cppflags: ["-Wexit-time-destructors"], | 
|  | 66 | enabled: true, | 
|  | 67 | }, | 
| Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 68 | linux: { | 
| James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 69 | srcs: [ | 
|  | 70 | "chrono_utils.cpp", | 
|  | 71 | "errors_unix.cpp", | 
|  | 72 | ], | 
| Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 73 | cppflags: ["-Wexit-time-destructors"], | 
| James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 74 | host_ldlibs: ["-lrt"], | 
| Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 75 | }, | 
|  | 76 | windows: { | 
|  | 77 | srcs: [ | 
|  | 78 | "errors_windows.cpp", | 
|  | 79 | "utf8.cpp", | 
|  | 80 | ], | 
|  | 81 | enabled: true, | 
|  | 82 | }, | 
|  | 83 | }, | 
|  | 84 | } | 
|  | 85 |  | 
|  | 86 | // Tests | 
|  | 87 | // ------------------------------------------------------------------------------ | 
|  | 88 | cc_test { | 
|  | 89 | name: "libbase_test", | 
|  | 90 | host_supported: true, | 
|  | 91 | clang: true, | 
|  | 92 | srcs: [ | 
| Elliott Hughes | 1dbd976 | 2017-02-24 14:02:05 -0800 | [diff] [blame] | 93 | "endian_test.cpp", | 
| Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 94 | "errors_test.cpp", | 
|  | 95 | "file_test.cpp", | 
|  | 96 | "logging_test.cpp", | 
| Yabin Cui | 997cba4 | 2016-10-05 10:54:35 -0700 | [diff] [blame] | 97 | "parsedouble_test.cpp", | 
| Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 98 | "parseint_test.cpp", | 
|  | 99 | "parsenetaddress_test.cpp", | 
| Josh Gao | 0c44256 | 2016-09-13 14:50:57 -0700 | [diff] [blame] | 100 | "quick_exit_test.cpp", | 
| Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 101 | "stringprintf_test.cpp", | 
|  | 102 | "strings_test.cpp", | 
|  | 103 | "test_main.cpp", | 
|  | 104 | ], | 
|  | 105 | target: { | 
| Elliott Hughes | 1e88c8c | 2016-09-21 16:53:15 -0700 | [diff] [blame] | 106 | android: { | 
| James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 107 | srcs: [ | 
|  | 108 | "chrono_utils_test.cpp", | 
|  | 109 | "properties_test.cpp" | 
|  | 110 | ], | 
| Elliott Hughes | ec46f4e | 2017-02-14 15:46:33 -0800 | [diff] [blame] | 111 | sanitize: { | 
|  | 112 | misc_undefined: ["integer"], | 
|  | 113 | }, | 
| Elliott Hughes | 1e88c8c | 2016-09-21 16:53:15 -0700 | [diff] [blame] | 114 | }, | 
| James Hawkins | e78ea77 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 115 | linux: { | 
|  | 116 | srcs: ["chrono_utils_test.cpp"], | 
|  | 117 | host_ldlibs: ["-lrt"], | 
|  | 118 | }, | 
| Colin Cross | fc06bd0 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 119 | windows: { | 
|  | 120 | srcs: ["utf8_test.cpp"], | 
|  | 121 | enabled: true, | 
|  | 122 | }, | 
|  | 123 | }, | 
|  | 124 | local_include_dirs: ["."], | 
|  | 125 | cppflags: libbase_cppflags, | 
|  | 126 | shared_libs: ["libbase"], | 
|  | 127 | compile_multilib: "both", | 
|  | 128 | multilib: { | 
|  | 129 | lib32: { | 
|  | 130 | suffix: "32", | 
|  | 131 | }, | 
|  | 132 | lib64: { | 
|  | 133 | suffix: "64", | 
|  | 134 | }, | 
|  | 135 | }, | 
|  | 136 | } |