Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2017 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 | // ========================================================== |
| 18 | // Build the host executable: stats-log-api-gen |
| 19 | // ========================================================== |
| 20 | cc_binary_host { |
| 21 | name: "stats-log-api-gen", |
| 22 | srcs: [ |
| 23 | "Collation.cpp", |
| 24 | "main.cpp", |
| 25 | ], |
Chih-Hung Hsieh | ca189f4 | 2017-11-10 15:06:53 -0800 | [diff] [blame] | 26 | cflags: [ |
| 27 | "-Wall", |
| 28 | "-Werror", |
| 29 | ], |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 30 | |
| 31 | shared_libs: [ |
| 32 | "libstats_proto_host", |
| 33 | "libprotobuf-cpp-full", |
| 34 | ], |
| 35 | |
| 36 | proto: { |
| 37 | type: "full", |
| 38 | }, |
| 39 | } |
| 40 | |
| 41 | // ========================================================== |
| 42 | // Build the host test executable: stats-log-api-gen |
| 43 | // ========================================================== |
| 44 | cc_test_host { |
| 45 | name: "stats-log-api-gen-test", |
| 46 | cflags: [ |
| 47 | "-Wall", |
| 48 | "-Wextra", |
| 49 | "-Werror", |
| 50 | "-g", |
| 51 | "-DUNIT_TEST", |
| 52 | ], |
| 53 | srcs: [ |
| 54 | "Collation.cpp", |
| 55 | "test_collation.cpp", |
| 56 | "test.proto", |
| 57 | ], |
| 58 | |
| 59 | static_libs: [ |
| 60 | "libgmock_host", |
| 61 | ], |
| 62 | |
| 63 | shared_libs: [ |
| 64 | "libstats_proto_host", |
Yao Chen | 9c1debe | 2018-02-19 14:39:19 -0800 | [diff] [blame] | 65 | "libprotobuf-cpp-full", |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 66 | ], |
| 67 | |
| 68 | proto: { |
| 69 | type: "full", |
Yao Chen | 9c1debe | 2018-02-19 14:39:19 -0800 | [diff] [blame] | 70 | include_dirs: [ |
| 71 | "external/protobuf/src", |
| 72 | ], |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 73 | }, |
| 74 | } |
| 75 | |
| 76 | // ========================================================== |
| 77 | // Native library |
| 78 | // ========================================================== |
| 79 | genrule { |
| 80 | name: "statslog.h", |
| 81 | tools: ["stats-log-api-gen"], |
| 82 | cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog.h", |
| 83 | out: [ |
| 84 | "statslog.h", |
| 85 | ], |
| 86 | } |
| 87 | |
| 88 | genrule { |
| 89 | name: "statslog.cpp", |
| 90 | tools: ["stats-log-api-gen"], |
| 91 | cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog.cpp", |
| 92 | out: [ |
| 93 | "statslog.cpp", |
| 94 | ], |
| 95 | } |
| 96 | |
| 97 | cc_library_shared { |
| 98 | name: "libstatslog", |
| 99 | generated_sources: ["statslog.cpp"], |
| 100 | generated_headers: ["statslog.h"], |
Chih-Hung Hsieh | ca189f4 | 2017-11-10 15:06:53 -0800 | [diff] [blame] | 101 | cflags: [ |
| 102 | "-Wall", |
| 103 | "-Werror", |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 104 | "-fexceptions", |
Chih-Hung Hsieh | ca189f4 | 2017-11-10 15:06:53 -0800 | [diff] [blame] | 105 | ], |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 106 | export_generated_headers: ["statslog.h"], |
| 107 | shared_libs: [ |
| 108 | "liblog", |
Yangster-mac | 330af58 | 2018-02-08 15:24:38 -0800 | [diff] [blame] | 109 | "libutils", |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 110 | ], |
| 111 | } |
| 112 | |