Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 1 | // Copyright (C) 2008 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 | cc_defaults { |
| 16 | name: "bsdiff_defaults", |
| 17 | host_supported: true, |
| 18 | static_libs: ["libbz"], |
Alex Deymo | dcd423b | 2017-09-13 20:54:24 +0200 | [diff] [blame] | 19 | // Allow internal includes to be referenced with the "bsdiff/" prefix in the |
| 20 | // path. |
| 21 | include_dirs: ["external"], |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 22 | export_include_dirs: [ |
| 23 | "include", |
| 24 | // TODO(deymo): Remove include/bsdiff when all callers use the "bsdiff/" |
| 25 | // prefix when including code. |
| 26 | "include/bsdiff", |
| 27 | ], |
| 28 | cflags: [ |
| 29 | "-D_FILE_OFFSET_BITS=64", |
| 30 | "-Wall", |
| 31 | "-Werror", |
| 32 | "-Wextra", |
| 33 | "-Wno-unused-parameter", |
| 34 | ], |
| 35 | } |
| 36 | |
| 37 | // Host and target static libraries. |
| 38 | cc_library_static { |
| 39 | name: "libbspatch", |
| 40 | defaults: ["bsdiff_defaults"], |
| 41 | |
| 42 | srcs: [ |
| 43 | "bspatch.cc", |
| 44 | "buffer_file.cc", |
| 45 | "extents.cc", |
| 46 | "extents_file.cc", |
| 47 | "file.cc", |
| 48 | "memory_file.cc", |
| 49 | "sink_file.cc", |
| 50 | ], |
| 51 | } |
| 52 | |
| 53 | cc_library_static { |
| 54 | name: "libbsdiff", |
| 55 | defaults: ["bsdiff_defaults"], |
| 56 | |
Alex Deymo | a28e019 | 2017-09-08 14:21:05 +0200 | [diff] [blame] | 57 | srcs: [ |
| 58 | "bsdiff.cc", |
| 59 | "bz2_compressor.cc", |
Alex Deymo | 68c0e7f | 2017-10-02 20:38:12 +0200 | [diff] [blame^] | 60 | "diff_encoder.cc", |
Alex Deymo | a28e019 | 2017-09-08 14:21:05 +0200 | [diff] [blame] | 61 | "patch_writer.cc", |
| 62 | ], |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 63 | static_libs: [ |
| 64 | "libdivsufsort64", |
| 65 | "libdivsufsort", |
| 66 | ], |
| 67 | } |
| 68 | |
| 69 | // Host and target Executables. |
| 70 | cc_binary { |
| 71 | name: "bspatch", |
| 72 | defaults: ["bsdiff_defaults"], |
| 73 | |
| 74 | srcs: ["bspatch_main.cc"], |
| 75 | static_libs: [ |
| 76 | "libbspatch", |
| 77 | "libbz", |
| 78 | ], |
| 79 | } |
| 80 | |
| 81 | // Host executables, bsdiff is only built for the host. |
| 82 | cc_binary_host { |
| 83 | name: "bsdiff", |
| 84 | defaults: ["bsdiff_defaults"], |
| 85 | |
| 86 | srcs: ["bsdiff_main.cc"], |
| 87 | static_libs: [ |
| 88 | "libbsdiff", |
| 89 | "libdivsufsort64", |
| 90 | "libdivsufsort", |
| 91 | "libbz", |
| 92 | ], |
| 93 | } |
| 94 | |
| 95 | // Unit tests. |
| 96 | cc_test { |
| 97 | name: "bsdiff_unittest", |
| 98 | defaults: ["bsdiff_defaults"], |
| 99 | test_suites: ["device-tests"], |
| 100 | srcs: [ |
| 101 | "bsdiff_unittest.cc", |
| 102 | "bspatch_unittest.cc", |
Alex Deymo | 68c0e7f | 2017-10-02 20:38:12 +0200 | [diff] [blame^] | 103 | "diff_encoder_unittest.cc", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 104 | "extents_file_unittest.cc", |
| 105 | "extents_unittest.cc", |
Alex Deymo | fb3b632 | 2017-09-27 14:28:54 +0200 | [diff] [blame] | 106 | "patch_writer_unittest.cc", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 107 | "test_utils.cc", |
| 108 | "testrunner.cc", |
| 109 | ], |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 110 | static_libs: [ |
| 111 | "libbsdiff", |
| 112 | "libbspatch", |
| 113 | "libgmock", |
| 114 | "libdivsufsort64", |
| 115 | "libdivsufsort", |
| 116 | "libbz", |
| 117 | ], |
Alex Deymo | fb3b632 | 2017-09-27 14:28:54 +0200 | [diff] [blame] | 118 | target: { |
| 119 | android: { |
| 120 | cflags: ["-DBSDIFF_TARGET_UNITTEST"], |
| 121 | }, |
| 122 | }, |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 123 | } |